mirror of
https://github.com/vmware-tanzu/velero.git
synced 2025-12-23 14:25:22 +00:00
Set schedule labels to subsequent backups
Signed-off-by: Zsolt Varga <zsolt.varga@console.hu>
This commit is contained in:
@@ -403,6 +403,9 @@ func TestGetBackup(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Namespace: "foo",
|
||||
Name: "bar-20170725091500",
|
||||
Labels: map[string]string{
|
||||
"ark-schedule": "bar",
|
||||
},
|
||||
},
|
||||
Spec: api.BackupSpec{},
|
||||
},
|
||||
@@ -423,6 +426,9 @@ func TestGetBackup(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Namespace: "foo",
|
||||
Name: "bar-20170725141500",
|
||||
Labels: map[string]string{
|
||||
"ark-schedule": "bar",
|
||||
},
|
||||
},
|
||||
Spec: api.BackupSpec{},
|
||||
},
|
||||
@@ -450,6 +456,9 @@ func TestGetBackup(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Namespace: "foo",
|
||||
Name: "bar-20170725091500",
|
||||
Labels: map[string]string{
|
||||
"ark-schedule": "bar",
|
||||
},
|
||||
},
|
||||
Spec: api.BackupSpec{
|
||||
IncludedNamespaces: []string{"ns-1", "ns-2"},
|
||||
@@ -461,6 +470,35 @@ func TestGetBackup(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "ensure schedule labels is copied",
|
||||
schedule: &api.Schedule{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Namespace: "foo",
|
||||
Name: "bar",
|
||||
Labels: map[string]string{
|
||||
"foo": "bar",
|
||||
"bar": "baz",
|
||||
},
|
||||
},
|
||||
Spec: api.ScheduleSpec{
|
||||
Template: api.BackupSpec{},
|
||||
},
|
||||
},
|
||||
testClockTime: "2017-07-25 14:15:00",
|
||||
expectedBackup: &api.Backup{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Namespace: "foo",
|
||||
Name: "bar-20170725141500",
|
||||
Labels: map[string]string{
|
||||
"ark-schedule": "bar",
|
||||
"bar": "baz",
|
||||
"foo": "bar",
|
||||
},
|
||||
},
|
||||
Spec: api.BackupSpec{},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
@@ -472,6 +510,7 @@ func TestGetBackup(t *testing.T) {
|
||||
|
||||
assert.Equal(t, test.expectedBackup.Namespace, backup.Namespace)
|
||||
assert.Equal(t, test.expectedBackup.Name, backup.Name)
|
||||
assert.Equal(t, test.expectedBackup.Labels, backup.Labels)
|
||||
assert.Equal(t, test.expectedBackup.Spec, backup.Spec)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user