Skip to content

Commit 2a12266

Browse files
committed
test: Refactor to contain paths in reused variable, remove unnecessary .gitkeep
1 parent 188cd06 commit 2a12266

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

internal/command/e2etest/pluggable_state_store_test.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ func TestPrimary_stateStore_workspaceCmd(t *testing.T) {
4242
// Move the provider binaries into a directory that we will point terraform
4343
// to using the -plugin-dir cli flag.
4444
platform := getproviders.CurrentPlatform.String()
45-
hashiDir := "cache/registry.terraform.io/hashicorp/"
46-
if err := os.MkdirAll(tf.Path(hashiDir, "simple6/0.0.1/", platform), os.ModePerm); err != nil {
45+
fsMirrorPath := "cache/registry.terraform.io/hashicorp/simple6/0.0.1/"
46+
if err := os.MkdirAll(tf.Path(fsMirrorPath, platform), os.ModePerm); err != nil {
4747
t.Fatal(err)
4848
}
49-
if err := os.Rename(simple6ProviderExe, tf.Path(hashiDir, "simple6/0.0.1/", platform, "terraform-provider-simple6")); err != nil {
49+
if err := os.Rename(simple6ProviderExe, tf.Path(fsMirrorPath, platform, "terraform-provider-simple6")); err != nil {
5050
t.Fatal(err)
5151
}
5252

@@ -149,13 +149,14 @@ func TestPrimary_stateStore_stateCmds(t *testing.T) {
149149
simple6Provider := filepath.Join(tf.WorkDir(), "terraform-provider-simple6")
150150
simple6ProviderExe := e2e.GoBuild("github.com/hashicorp/terraform/internal/provider-simple-v6/main", simple6Provider)
151151

152-
// Move the provider binaries into the correct directory .terraform/providers/ directory
152+
// Move the provider binaries into the correct .terraform/providers/ directory
153153
// that will contain provider binaries in an initialized working directory.
154154
platform := getproviders.CurrentPlatform.String()
155-
if err := os.MkdirAll(tf.Path(".terraform/providers/registry.terraform.io/hashicorp/simple6/0.0.1/", platform), os.ModePerm); err != nil {
155+
providerCachePath := ".terraform/providers/registry.terraform.io/hashicorp/simple6/0.0.1/"
156+
if err := os.MkdirAll(tf.Path(providerCachePath, platform), os.ModePerm); err != nil {
156157
t.Fatal(err)
157158
}
158-
if err := os.Rename(simple6ProviderExe, tf.Path(".terraform/providers/registry.terraform.io/hashicorp/simple6/0.0.1/", platform, "terraform-provider-simple6")); err != nil {
159+
if err := os.Rename(simple6ProviderExe, tf.Path(providerCachePath, platform, "terraform-provider-simple6")); err != nil {
159160
t.Fatal(err)
160161
}
161162

internal/command/e2etest/testdata/initialized-directory-with-state-store-fs/.terraform/providers/registry.terraform.io/hashicorp/simple6/0.0.1/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)