@@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313See the License for the specific language governing permissions and
1414limitations under the License.
1515*/
16- package general
16+ package miscellaneous_use_cases
1717
1818import (
1919 "fmt"
@@ -39,6 +39,10 @@ var _ = Describe("Repository", func() {
3939 f = framework .NewInvocation ()
4040 })
4141
42+ JustAfterEach (func () {
43+ f .PrintDebugInfoOnFailure ()
44+ })
45+
4246 AfterEach (func () {
4347 err := f .CleanupTestResources ()
4448 Expect (err ).NotTo (HaveOccurred ())
@@ -48,7 +52,7 @@ var _ = Describe("Repository", func() {
4852 Context ("Invalid MountPath" , func () {
4953 It ("should reject to create Repository for using `/stash` as `mountPath`" , func () {
5054 // Deploy a Deployment
51- _ , err := f .DeployDeployment (fmt . Sprintf ( "source-deployment1-%s" , f . App ()), int32 (1 ))
55+ _ , err := f .DeployDeployment (framework . SourceDeployment , int32 (1 ), framework . SourceVolume )
5256 Expect (err ).NotTo (HaveOccurred ())
5357
5458 // Create Storage Secret
@@ -59,11 +63,11 @@ var _ = Describe("Repository", func() {
5963 f .AppendToCleanupList (& cred )
6064
6165 // We are going to use an PVC as backend
62- pvc , err := f .CreateNewPVC (rand .WithUniqSuffix ("pvc" ))
66+ pvc , err := f .CreateNewPVC (rand .WithUniqSuffix ("backend- pvc" ))
6367 Expect (err ).NotTo (HaveOccurred ())
6468
6569 // Generate Repository Definition
66- repo := f .NewLocalRepository (cred .Name , pvc .Name )
70+ repo := f .NewLocalRepositoryWithPVC (cred .Name , pvc .Name )
6771
6872 // Use `/stash` as `mountPath`
6973 repo .Spec .Backend .Local .MountPath = "/stash"
@@ -72,12 +76,11 @@ var _ = Describe("Repository", func() {
7276 By ("reject to create Repository" )
7377 _ , err = f .StashClient .StashV1alpha1 ().Repositories (repo .Namespace ).Create (repo )
7478 Expect (err ).To (HaveOccurred ())
75-
7679 })
7780
7881 It ("should reject to create Repository for using `/stash/data` as `mountPath`" , func () {
7982 // Deploy a Deployment
80- _ , err := f .DeployDeployment (fmt . Sprintf ( "source-deployment1-%s" , f . App ()), int32 (1 ))
83+ _ , err := f .DeployDeployment (framework . SourceDeployment , int32 (1 ), framework . SourceVolume )
8184 Expect (err ).NotTo (HaveOccurred ())
8285
8386 // Create Storage Secret
@@ -88,11 +91,11 @@ var _ = Describe("Repository", func() {
8891 f .AppendToCleanupList (& cred )
8992
9093 // We are going to use an PVC as backend
91- pvc , err := f .CreateNewPVC (rand .WithUniqSuffix ("pvc" ))
94+ pvc , err := f .CreateNewPVC (rand .WithUniqSuffix ("backend- pvc" ))
9295 Expect (err ).NotTo (HaveOccurred ())
9396
9497 // Generate Repository Definition
95- repo := f .NewLocalRepository (cred .Name , pvc .Name )
98+ repo := f .NewLocalRepositoryWithPVC (cred .Name , pvc .Name )
9699
97100 // Use `/stash` as `mountPath`
98101 repo .Spec .Backend .Local .MountPath = "/stash/data"
@@ -101,17 +104,15 @@ var _ = Describe("Repository", func() {
101104 By ("reject to create Repository" )
102105 _ , err = f .StashClient .StashV1alpha1 ().Repositories (repo .Namespace ).Create (repo )
103106 Expect (err ).To (HaveOccurred ())
104-
105107 })
106108 })
107109
108110 Context ("Invalid MountPath in Auto-Backup" , func () {
109-
110111 annotations := func (backupBlueprintName string ) map [string ]string {
111112 return map [string ]string {
112113 v1beta1 .KeyBackupBlueprint : backupBlueprintName ,
113114 v1beta1 .KeyTargetPaths : framework .TestSourceDataTargetPath ,
114- v1beta1 .KeyVolumeMounts : framework .TestSourceDataVolumeMount ,
115+ v1beta1 .KeyVolumeMounts : framework .TestSourceVolumeAndMount ,
115116 }
116117 }
117118
@@ -123,7 +124,7 @@ var _ = Describe("Repository", func() {
123124 f .AppendToCleanupList (& cred )
124125
125126 // We are going to use an PVC as backend
126- pvc , err := f .CreateNewPVC (rand .WithUniqSuffix ("pvc" ))
127+ pvc , err := f .CreateNewPVC (rand .WithUniqSuffix ("backend- pvc" ))
127128 Expect (err ).NotTo (HaveOccurred ())
128129
129130 // Generate BackupBlueprint definition
@@ -143,7 +144,7 @@ var _ = Describe("Repository", func() {
143144 f .AppendToCleanupList (createdBB )
144145
145146 // Deploy a DaemonSet
146- deployment , err := f .DeployDeployment (fmt . Sprintf ( "deployment-%s" , f . App ()), int32 (1 ))
147+ deployment , err := f .DeployDeployment (framework . SourceDeployment , int32 (1 ), framework . SourceVolume )
147148 Expect (err ).NotTo (HaveOccurred ())
148149
149150 // Add auto-backup annotations to Target
@@ -152,10 +153,7 @@ var _ = Describe("Repository", func() {
152153
153154 // AutoBackup Resource creation failed
154155 f .EventuallyEvent (deployment .ObjectMeta , apis .KindDeployment ).Should (matcher .HaveEvent (eventer .EventReasonAutoBackupResourcesCreationFailed ))
155-
156156 })
157157 })
158-
159158 })
160-
161159})
0 commit comments