-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Elie
committed
Aug 4, 2021
1 parent
75cd450
commit 0f30aa4
Showing
3 changed files
with
54 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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,36 @@ | ||
package schemas | ||
|
||
import ( | ||
"os" | ||
"testing" | ||
|
||
"github.com/cloudskiff/driftctl/pkg/terraform" | ||
terraformtest "github.com/cloudskiff/driftctl/test/terraform" | ||
) | ||
|
||
// You can use this test function to create a schema file for a given provider in a given version | ||
// You may want to update part of this code to change provider and version to generate desired schema | ||
// To use this test you should run this command from the repository root | ||
// DCTL_UPDATE_TEST_SCHEMA=true go test ./test/schemas | ||
// You may need to setup proper environment variable to make the terraform provider work | ||
// DCTL_UPDATE_TEST_SCHEMA=true AWS_PROFILE=myprofile go test ./test/schemas | ||
func TestCreateNewSchema(t *testing.T) { | ||
|
||
if os.Getenv("DCTL_UPDATE_TEST_SCHEMA") != "true" { | ||
t.SkipNow() | ||
} | ||
|
||
providerLibrary := terraform.NewProviderLibrary() | ||
|
||
// Replace this with provider you want to create schema | ||
realProvider, _ := terraformtest.InitTestAwsProvider(providerLibrary, "3.19.0") | ||
|
||
err := realProvider.Init() | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
err = writeTestSchema(realProvider.Schema(), realProvider.Name(), realProvider.Version()) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
} |
This file contains 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 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