@@ -252,6 +252,25 @@ func portForward(ctx context.Context, svcName string, svcNamespace string, port
252252 }, Timeout , test .Interval ).Should (BeNil ())
253253}
254254
255+ func emptyStorageDefaultFields (storage * v1alpha1.Storage ) {
256+ storage .Spec .Image = nil
257+ storage .Spec .Resources = nil
258+ storage .Spec .Service = nil
259+ storage .Spec .Monitoring = nil
260+ }
261+
262+ func emptyDatabaseDefaultFields (database * v1alpha1.Database ) {
263+ database .Spec .StorageClusterRef .Namespace = ""
264+ database .Spec .Image = nil
265+ database .Spec .Service = nil
266+ database .Spec .Domain = ""
267+ database .Spec .Path = ""
268+ database .Spec .Encryption = nil
269+ database .Spec .Datastreams = nil
270+ database .Spec .Monitoring = nil
271+ database .Spec .StorageEndpoint = ""
272+ }
273+
255274var _ = Describe ("Operator smoke test" , func () {
256275 var ctx context.Context
257276 var namespace corev1.Namespace
@@ -284,37 +303,22 @@ var _ = Describe("Operator smoke test", func() {
284303 })
285304
286305 It ("Check webhook defaulter" , func () {
287- storageSample .Spec .Image = nil
288- storageSample .Spec .Resources = nil
289- storageSample .Spec .Service = nil
290- storageSample .Spec .Monitoring = nil
306+ emptyStorageDefaultFields (storageSample )
291307 Expect (k8sClient .Create (ctx , storageSample )).Should (Succeed ())
292308 defer func () {
293309 Expect (k8sClient .Delete (ctx , storageSample )).Should (Succeed ())
294310 }()
295311
296- databaseSample .Spec .StorageClusterRef .Namespace = ""
297- databaseSample .Spec .Image = nil
298- databaseSample .Spec .Service = nil
299- databaseSample .Spec .Domain = ""
300- databaseSample .Spec .Path = ""
301- databaseSample .Spec .Encryption = nil
302- databaseSample .Spec .Datastreams = nil
303- databaseSample .Spec .Monitoring = nil
304- databaseSample .Spec .StorageEndpoint = ""
312+ emptyDatabaseDefaultFields (databaseSample )
305313 Expect (k8sClient .Create (ctx , databaseSample )).Should (Succeed ())
306314 defer func () {
307315 Expect (k8sClient .Delete (ctx , databaseSample )).Should (Succeed ())
308316 }()
309317 })
310318
311319 It ("Check webhook defaulter with dynconfig and nodeSets" , func () {
312- storageSample = testobjects .DefaultStorage (filepath .Join ("." , "data" , "storage-mirror-3-dc-config-dynconfig.yaml" ))
313-
314- storageSample .Spec .Image = nil
315- storageSample .Spec .Resources = nil
316- storageSample .Spec .Service = nil
317- storageSample .Spec .Monitoring = nil
320+ storageSample = testobjects .DefaultStorage (filepath .Join ("." , "data" , "storage-mirror-3-dc-dynconfig.yaml" ))
321+ emptyStorageDefaultFields (storageSample )
318322 storageSample .Spec .NodeSets = []v1alpha1.StorageNodeSetSpecInline {
319323 {
320324 Name : "storage-nodeset-1" ,
@@ -329,30 +333,6 @@ var _ = Describe("Operator smoke test", func() {
329333 defer func () {
330334 Expect (k8sClient .Delete (ctx , storageSample )).Should (Succeed ())
331335 }()
332-
333- databaseSample .Spec .StorageClusterRef .Namespace = ""
334- databaseSample .Spec .Image = nil
335- databaseSample .Spec .Service = nil
336- databaseSample .Spec .Domain = ""
337- databaseSample .Spec .Path = ""
338- databaseSample .Spec .Encryption = nil
339- databaseSample .Spec .Datastreams = nil
340- databaseSample .Spec .Monitoring = nil
341- databaseSample .Spec .StorageEndpoint = ""
342- databaseSample .Spec .NodeSets = []v1alpha1.DatabaseNodeSetSpecInline {
343- {
344- Name : "database-nodeset-1" ,
345- DatabaseNodeSpec : v1alpha1.DatabaseNodeSpec {Nodes : 1 },
346- },
347- {
348- Name : "database-nodeset-2" ,
349- DatabaseNodeSpec : v1alpha1.DatabaseNodeSpec {Nodes : 2 },
350- },
351- }
352- Expect (k8sClient .Create (ctx , databaseSample )).Should (Succeed ())
353- defer func () {
354- Expect (k8sClient .Delete (ctx , databaseSample )).Should (Succeed ())
355- }()
356336 })
357337
358338 It ("general smoke pipeline, create storage + database" , func () {
@@ -541,7 +521,7 @@ var _ = Describe("Operator smoke test", func() {
541521
542522 It ("create storage and database with nodeSets" , func () {
543523 By ("issuing create commands..." )
544- storageSample = testobjects .DefaultStorage (filepath .Join ("." , "data" , "storage-mirror-3-dc-config-nodeSets .yaml" ))
524+ storageSample = testobjects .DefaultStorage (filepath .Join ("." , "data" , "storage-mirror-3-dc-config.yaml" ))
545525 testNodeSetName := "nodeset"
546526 for idx := 1 ; idx <= 3 ; idx ++ {
547527 storageSample .Spec .NodeSets = append (storageSample .Spec .NodeSets , v1alpha1.StorageNodeSetSpecInline {
0 commit comments