-
Notifications
You must be signed in to change notification settings - Fork 72
Add acceptance tests and ignore no such file or directory
errors in cleaning rendered website dir
#296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Add acceptance tests and ignore no such file or directory
errors in cleaning rendered website dir
#296
Changes from 9 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
228c175
Add acceptance tests for `generate` command
SBGoods e624bce
Ignore file does not exist error when cleaning up rendered website dir.
SBGoods a3fe761
Add more template rendering unit tests
SBGoods 8908af8
Merge branch 'main' into SBGoods/acceptance-tests
SBGoods 5bbfb85
Run `go mod tidy`
SBGoods b9a26fb
Run tests from makefile
SBGoods 86b4533
Add changelog entry
SBGoods c7707c1
Add copyright headers
SBGoods 5085dd7
Add flag to skip tests for non-unix systems
SBGoods 9095948
Add unit test target
SBGoods 10c8455
Add Acceptance Testing section to Readme
SBGoods 33a8541
Move `build` package and update goreleaser `idflags`
SBGoods 3de537e
Add `.SchemaMarkdown` field and `printf` functions to Readme
SBGoods 7adb551
Add copyright headers
SBGoods 86c418d
Merge branch 'main' into SBGoods/acceptance-tests
SBGoods File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: BUG FIXES | ||
body: 'generate: fix `no such file or directory` error when running `generate` with | ||
no existing rendered website directory.' | ||
time: 2023-11-08T17:25:58.561956-05:00 | ||
custom: | ||
Issue: "296" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) HashiCorp, Inc. | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
package build | ||
|
||
var ( | ||
// These vars will be set by goreleaser. | ||
SBGoods marked this conversation as resolved.
Show resolved
Hide resolved
|
||
version string = `dev` | ||
commit string = `` | ||
) | ||
|
||
func GetVersion() string { | ||
version := "tfplugindocs" + " Version " + version | ||
if commit != "" { | ||
version += " from commit " + commit | ||
} | ||
return version | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright (c) HashiCorp, Inc. | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
package main | ||
|
||
import ( | ||
"os" | ||
"testing" | ||
|
||
"github.com/rogpeppe/go-internal/testscript" | ||
|
||
"github.com/hashicorp/terraform-plugin-docs/internal/cmd" | ||
) | ||
|
||
func TestMain(m *testing.M) { | ||
os.Exit(testscript.RunMain(m, map[string]func() int{ | ||
"tfplugindocs": cmd.Main, | ||
})) | ||
} | ||
|
||
func Test_GenerateAcceptanceTests(t *testing.T) { | ||
t.Parallel() | ||
if os.Getenv("ACCTEST") == "" { | ||
t.Skip("ACCTEST env var not set; skipping acceptance tests.") | ||
} | ||
SBGoods marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// Setting a custom temp dir instead of relying on os.TempDir() | ||
// because Terraform providers fail to start up when $TMPDIR | ||
// length is too long: https://github.com/hashicorp/terraform/issues/32787 | ||
tmpDir := "/tmp/tftmp" | ||
SBGoods marked this conversation as resolved.
Show resolved
Hide resolved
|
||
err := os.MkdirAll(tmpDir, 0755) | ||
if err != nil { | ||
t.Errorf("Error creating temp dir for testing: %s", err.Error()) | ||
} | ||
defer os.RemoveAll(tmpDir) | ||
|
||
testscript.Run(t, testscript.Params{ | ||
Dir: "testdata/scripts/generate", | ||
WorkdirRoot: tmpDir, | ||
}) | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.