mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-10-01 01:36:09 -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.
This commit is contained in:
parent
d2cbf3dc83
commit
d5fa614df1
@ -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…
Reference in New Issue
Block a user