You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"during an init command, the working directory is initialized and a backend state file is created": {
2082
-
isInitCommand: true,
2088
+
"an init command prompts users for input when the default workspace needs to be created": {
2089
+
inputEnabled: true,
2090
+
createDefaultWorkspace: true,
2091
+
inputText: "yes",
2092
+
isInitCommand: true,
2093
+
expectDefaultWorkspaceExists: true,
2094
+
},
2095
+
"an init command with input disabled will create the default workspace automatically": {
2096
+
inputEnabled: false,
2097
+
createDefaultWorkspace: true,
2098
+
isInitCommand: true,
2099
+
expectDefaultWorkspaceExists: true,
2083
2100
},
2084
-
"during a non-init command, the command ends in with an error telling the user to run an init command": {
2085
-
isInitCommand: false,
2086
-
expectedError: "State store initialization required, please run \"terraform init\": Reason: Initial configuration of the requested state_store \"foo_bar\" in provider foo (\"registry.terraform.io/my-org/foo\")",
2101
+
"an init command with input disabled and the flag -create-default-workspace=false will not make the default workspace": {
2102
+
inputEnabled: false,
2103
+
createDefaultWorkspace: false,
2104
+
isInitCommand: true,
2105
+
expectDefaultWorkspaceExists: false,
2087
2106
},
2107
+
// "during a non-init command, the command ends in with an error telling the user to run an init command": {
2108
+
// isInitCommand: false,
2109
+
// expectedError: "State store initialization required, please run \"terraform init\": Reason: Initial configuration of the requested state_store \"foo_bar\" in provider foo (\"registry.terraform.io/my-org/foo\")",
t.Fatalf("backend state file contains unexpected raw config data for the state store, want %q, got %q", expectedStoreConfig, cleanString(string(s.StateStore.ConfigRaw)))
2198
2228
}
2229
+
2230
+
w, err:=b.Workspaces()
2231
+
iferr!=nil {
2232
+
t.Fatalf("unexpected error: %s", err)
2233
+
}
2234
+
iflen(w) ==0 {
2235
+
iftc.expectDefaultWorkspaceExists {
2236
+
t.Fatal("expected the default workspace to exist, but there are no workspaces")
2237
+
}
2238
+
return
2239
+
}
2240
+
iflen(w) >0 {
2241
+
iftc.expectDefaultWorkspaceExists {
2242
+
iflen(w) ==1&&w[0] !="default" {
2243
+
t.Fatalf("expected the default workspace to exist, but instead got: %v", w)
2244
+
}
2245
+
}
2246
+
t.Fatalf("expected the default workspace to be the only existing workspace, but instead got: %v", w)
0 commit comments