mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-05-04 15:25:00 -04:00
cli: store upgrade files in versioned folders (#1929)
* upgrade versioning * dont pass upgrade kind as boolean * whitespace * fix godot lint check * clarify upgrade check directory suffix * cli: dry-run Terraform migrations on `upgrade check` (#1942) * dry-run Terraform migrations on upgrade check * clean whole upgrade dir * clean up check workspace after planning * fix parsing * extend upgrade check test * rename unused parameters * exclude false positives in test
This commit is contained in:
parent
f3c2198a9a
commit
b25228d175
13 changed files with 300 additions and 127 deletions
|
@ -133,6 +133,7 @@ func TestPrepareUpgradeWorkspace(t *testing.T) {
|
|||
provider cloudprovider.Provider
|
||||
oldWorkingDir string
|
||||
newWorkingDir string
|
||||
backupDir string
|
||||
oldWorkspaceFiles []string
|
||||
newWorkspaceFiles []string
|
||||
expectedFiles []string
|
||||
|
@ -144,6 +145,7 @@ func TestPrepareUpgradeWorkspace(t *testing.T) {
|
|||
provider: cloudprovider.AWS,
|
||||
oldWorkingDir: "old",
|
||||
newWorkingDir: "new",
|
||||
backupDir: "backup",
|
||||
oldWorkspaceFiles: []string{"terraform.tfstate"},
|
||||
expectedFiles: []string{
|
||||
"main.tf",
|
||||
|
@ -158,6 +160,7 @@ func TestPrepareUpgradeWorkspace(t *testing.T) {
|
|||
provider: cloudprovider.AWS,
|
||||
oldWorkingDir: "old",
|
||||
newWorkingDir: "new",
|
||||
backupDir: "backup",
|
||||
oldWorkspaceFiles: []string{},
|
||||
expectedFiles: []string{},
|
||||
wantErr: true,
|
||||
|
@ -167,6 +170,7 @@ func TestPrepareUpgradeWorkspace(t *testing.T) {
|
|||
provider: cloudprovider.AWS,
|
||||
oldWorkingDir: "old",
|
||||
newWorkingDir: "new",
|
||||
backupDir: "backup",
|
||||
oldWorkspaceFiles: []string{"terraform.tfstate"},
|
||||
newWorkspaceFiles: []string{"main.tf"},
|
||||
wantErr: true,
|
||||
|
@ -185,7 +189,7 @@ func TestPrepareUpgradeWorkspace(t *testing.T) {
|
|||
createFiles(t, file, tc.oldWorkspaceFiles, tc.oldWorkingDir)
|
||||
createFiles(t, file, tc.newWorkspaceFiles, tc.newWorkingDir)
|
||||
|
||||
err := prepareUpgradeWorkspace(path, file, tc.oldWorkingDir, tc.newWorkingDir)
|
||||
err := prepareUpgradeWorkspace(path, file, tc.oldWorkingDir, tc.newWorkingDir, tc.backupDir)
|
||||
|
||||
if tc.wantErr {
|
||||
require.Error(err)
|
||||
|
@ -194,7 +198,7 @@ func TestPrepareUpgradeWorkspace(t *testing.T) {
|
|||
}
|
||||
checkFiles(t, file, func(err error) { assert.NoError(err) }, tc.newWorkingDir, tc.expectedFiles)
|
||||
checkFiles(t, file, func(err error) { assert.NoError(err) },
|
||||
filepath.Join(constants.UpgradeDir, constants.TerraformUpgradeBackupDir),
|
||||
tc.backupDir,
|
||||
tc.oldWorkspaceFiles,
|
||||
)
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue