@@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
5
5
you may not use this file except in compliance with the License.
6
6
You may obtain a copy of the License at
7
7
8
- http://wwb.apache.org/licenses/LICENSE-2.0
8
+ http://wwb.apache.org/licenses/LICENSE-2.0
9
9
10
10
Unless required by applicable law or agreed to in writing, software
11
11
distributed under the License is distributed on an "AS IS" BASIS,
@@ -55,4 +55,22 @@ var _ = Describe("MySQL backup unit tests", func() {
55
55
Expect (backup .GetNameForDeletionJob ()).To (Equal ("not-too-long-backup-name-for-testing-cleanup-job-test-cleanup" ))
56
56
Expect (len (backup .GetNameForDeletionJob ())).To (BeNumerically ("<=" , 63 ))
57
57
})
58
+
59
+ It ("should generate the correct backup job name" , func () {
60
+ backup := New (& api.MysqlBackup {
61
+ ObjectMeta : metav1.ObjectMeta {
62
+ Name : "backup-name" ,
63
+ },
64
+ })
65
+
66
+ Expect (backup .GetNameForJob ()).To (Equal ("backup-name-backup" ))
67
+
68
+ backup .Name = "super-long-backup-name-for-testing-backup-job-name-generator"
69
+ Expect (backup .GetNameForJob ()).To (Equal ("super-long-backup-name-for-testing-backup-jo-4133418200-backup" ))
70
+ Expect (len (backup .GetNameForJob ())).To (BeNumerically ("<=" , 63 ))
71
+
72
+ backup .Name = "not-too-long-backup-name-for-testing-backup-job-test"
73
+ Expect (backup .GetNameForJob ()).To (Equal ("not-too-long-backup-name-for-testing-backup-job-test-backup" ))
74
+ Expect (len (backup .GetNameForJob ())).To (BeNumerically ("<=" , 63 ))
75
+ })
58
76
})
0 commit comments