mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-05-03 23:04:53 -04:00
Terraform: Try to use existing files on partially unpacked workspace
This commit is contained in:
parent
4a2cba988c
commit
e93527144e
2 changed files with 41 additions and 4 deletions
|
@ -21,8 +21,9 @@ import (
|
|||
|
||||
func TestLoader(t *testing.T) {
|
||||
testCases := map[string]struct {
|
||||
provider cloudprovider.Provider
|
||||
fileList []string
|
||||
provider cloudprovider.Provider
|
||||
fileList []string
|
||||
testAlreadyUnpacked bool
|
||||
}{
|
||||
"aws": {
|
||||
provider: cloudprovider.AWS,
|
||||
|
@ -51,6 +52,16 @@ func TestLoader(t *testing.T) {
|
|||
"modules",
|
||||
},
|
||||
},
|
||||
"continue on (partially) unpacked": {
|
||||
provider: cloudprovider.AWS,
|
||||
fileList: []string{
|
||||
"main.tf",
|
||||
"variables.tf",
|
||||
"outputs.tf",
|
||||
"modules",
|
||||
},
|
||||
testAlreadyUnpacked: true,
|
||||
},
|
||||
}
|
||||
|
||||
for name, tc := range testCases {
|
||||
|
@ -62,9 +73,16 @@ func TestLoader(t *testing.T) {
|
|||
|
||||
err := prepareWorkspace(file, tc.provider, constants.TerraformWorkingDir)
|
||||
require.NoError(err)
|
||||
|
||||
checkFiles(t, file, func(err error) { assert.NoError(err) }, tc.fileList)
|
||||
|
||||
if tc.testAlreadyUnpacked {
|
||||
// Let's try the same again and check if we don't get a "file already exists" error.
|
||||
require.NoError(file.Remove(filepath.Join(constants.TerraformWorkingDir, "variables.tf")))
|
||||
err := prepareWorkspace(file, tc.provider, constants.TerraformWorkingDir)
|
||||
assert.NoError(err)
|
||||
checkFiles(t, file, func(err error) { assert.NoError(err) }, tc.fileList)
|
||||
}
|
||||
|
||||
err = cleanUpWorkspace(file, constants.TerraformWorkingDir)
|
||||
require.NoError(err)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue