mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-07-22 06:50:43 -04:00
cli: remove ambiguity in path for CR backups (#1719)
During upgrade all custom resources are backed up to files on the local file system. Since old versions are also backed up, we need to reflect the version in the name. Co-authored-by: Otto Bittner <cobittner@posteo.net>
This commit is contained in:
parent
8a77cee919
commit
1a45c652c1
2 changed files with 2 additions and 2 deletions
|
@ -63,7 +63,7 @@ func (c *Client) backupCRs(ctx context.Context, crds []apiextensionsv1.CustomRes
|
|||
}
|
||||
|
||||
for _, cr := range crs {
|
||||
targetFolder := filepath.Join(backupFolder, cr.GetKind(), cr.GetNamespace())
|
||||
targetFolder := filepath.Join(backupFolder, gvr.Group, gvr.Version, cr.GetNamespace(), cr.GetKind())
|
||||
if err := c.fs.MkdirAll(targetFolder); err != nil {
|
||||
return fmt.Errorf("creating resource dir: %w", err)
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ func TestBackupCRs(t *testing.T) {
|
|||
}
|
||||
assert.NoError(err)
|
||||
|
||||
data, err := afero.ReadFile(memFs, filepath.Join(backupFolder, tc.resource.GetKind(), tc.resource.GetNamespace(), tc.resource.GetName()+".yaml"))
|
||||
data, err := afero.ReadFile(memFs, filepath.Join(backupFolder, tc.crd.Spec.Group, tc.crd.Spec.Versions[0].Name, tc.resource.GetNamespace(), tc.resource.GetKind(), tc.resource.GetName()+".yaml"))
|
||||
require.NoError(err)
|
||||
assert.YAMLEq(tc.expectedFile, string(data))
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue