mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-10-01 01:36:09 -04:00
Delete cluster IDs file on terminate
This commit is contained in:
parent
259c88fa1a
commit
bc5471e9b3
@ -62,5 +62,9 @@ func terminate(cmd *cobra.Command, terminator cloudTerminator, fileHandler file.
|
||||
retErr = multierr.Append(err, fmt.Errorf("failed to remove file: '%s', please remove it manually", constants.WGQuickConfigFilename))
|
||||
}
|
||||
|
||||
if err := fileHandler.Remove(constants.ClusterIDsFileName); err != nil && !errors.Is(err, fs.ErrNotExist) {
|
||||
retErr = multierr.Append(err, fmt.Errorf("failed to remove file: '%s', please remove it manually", constants.ClusterIDsFileName))
|
||||
}
|
||||
|
||||
return retErr
|
||||
}
|
||||
|
@ -45,6 +45,7 @@ func TestTerminate(t *testing.T) {
|
||||
fileHandler := file.NewHandler(fs)
|
||||
require.NoError(fileHandler.Write(constants.AdminConfFilename, []byte{1, 2}, file.OptNone))
|
||||
require.NoError(fileHandler.Write(constants.WGQuickConfigFilename, []byte{1, 2}, file.OptNone))
|
||||
require.NoError(fileHandler.Write(constants.ClusterIDsFileName, []byte{1, 2}, file.OptNone))
|
||||
require.NoError(fileHandler.WriteJSON(constants.StateFilename, state, file.OptNone))
|
||||
return fs
|
||||
}
|
||||
@ -125,6 +126,8 @@ func TestTerminate(t *testing.T) {
|
||||
assert.Error(err)
|
||||
_, err = fileHandler.Stat(constants.WGQuickConfigFilename)
|
||||
assert.Error(err)
|
||||
_, err = fileHandler.Stat(constants.ClusterIDsFileName)
|
||||
assert.Error(err)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user