-
Notifications
You must be signed in to change notification settings - Fork 17
Add additional import test modes #442
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
Changes from all commits
35f4e6f
2761fa9
8a9f46f
4f3dc6c
7df59d7
e3f2ff3
df54519
0c90366
6cb9373
805da5a
1b47671
2981576
7261b09
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -133,7 +133,7 @@ func runNewTest(ctx context.Context, t testing.T, c TestCase, helper *plugintest | |
|
|
||
| // use this to track last step successfully applied | ||
| // acts as default for import tests | ||
| var appliedCfg teststep.Config | ||
| var appliedCfg string | ||
| var stepNumber int | ||
|
|
||
| for stepIndex, step := range c.Steps { | ||
|
|
@@ -249,7 +249,7 @@ func runNewTest(ctx context.Context, t testing.T, c TestCase, helper *plugintest | |
| File: step.ConfigFile, | ||
| Raw: rawCfg, | ||
| TestStepConfigRequest: config.TestStepConfigRequest{ | ||
| StepNumber: stepIndex + 1, | ||
| StepNumber: stepNumber, | ||
| TestName: t.Name(), | ||
| }, | ||
| }.Exec() | ||
|
|
@@ -289,7 +289,7 @@ func runNewTest(ctx context.Context, t testing.T, c TestCase, helper *plugintest | |
| if step.ImportState { | ||
| logging.HelperResourceTrace(ctx, "TestStep is ImportState mode") | ||
|
|
||
| err := testStepNewImportState(ctx, t, helper, wd, step, appliedCfg, providers, stepIndex) | ||
| err := testStepNewImportState(ctx, t, helper, wd, step, appliedCfg, providers, stepNumber) | ||
| if step.ExpectError != nil { | ||
| logging.HelperResourceDebug(ctx, "Checking TestStep ExpectError") | ||
| if err == nil { | ||
|
|
@@ -426,7 +426,7 @@ func runNewTest(ctx context.Context, t testing.T, c TestCase, helper *plugintest | |
| } | ||
| } | ||
|
|
||
| mergedConfig, err := step.mergedConfig(ctx, c, hasTerraformBlock, hasProviderBlock, helper.TerraformVersion()) | ||
| appliedCfg, err = step.mergedConfig(ctx, c, hasTerraformBlock, hasProviderBlock, helper.TerraformVersion()) | ||
|
|
||
| if err != nil { | ||
| logging.HelperResourceError(ctx, | ||
|
|
@@ -436,18 +436,6 @@ func runNewTest(ctx context.Context, t testing.T, c TestCase, helper *plugintest | |
| t.Fatalf("Error generating merged configuration: %s", err) | ||
| } | ||
|
|
||
| confRequest := teststep.PrepareConfigurationRequest{ | ||
| Directory: step.ConfigDirectory, | ||
| File: step.ConfigFile, | ||
| Raw: mergedConfig, | ||
| TestStepConfigRequest: config.TestStepConfigRequest{ | ||
| StepNumber: stepIndex + 1, | ||
| TestName: t.Name(), | ||
| }, | ||
| }.Exec() | ||
|
|
||
| appliedCfg = teststep.Configuration(confRequest) | ||
|
|
||
|
Comment on lines
-439
to
-450
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like this was only ever needed and done for the import tests, so I've opted to move this into
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💯 |
||
| logging.HelperResourceDebug(ctx, "Finished TestStep") | ||
|
|
||
| continue | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed a nice side-effect here.
ImportCommandWithIdequals zero. So, all existing tests will default toImportCommandWithId, asTestStep.ImportStateKindwill get the zero value.