@@ -415,10 +415,92 @@ func Test_TenantAddZone(t *testing.T) {
415415 Body : & models.Zone {
416416 Name : "zone-1" ,
417417 Servers : swag .Int64 (int64 (4 )),
418+ VolumeConfiguration : & models.ZoneVolumeConfiguration {
419+ Size : swag .Int64 (2147483648 ),
420+ StorageClassName : "standard" ,
421+ },
422+ VolumesPerServer : swag .Int32 (4 ),
418423 },
419424 },
420425 },
421426 wantErr : false ,
427+ }, {
428+ name : "Add zone, error size" ,
429+ args : args {
430+ ctx : context .Background (),
431+ operatorClient : opClient ,
432+ nameSpace : "default" ,
433+ mockTenantPatch : func (ctx context.Context , namespace string , tenantName string , pt types.PatchType , data []byte , options metav1.PatchOptions ) (* v1.Tenant , error ) {
434+ return & v1.Tenant {}, nil
435+ },
436+ mockTenantGet : func (ctx context.Context , namespace string , tenantName string , options metav1.GetOptions ) (* v1.Tenant , error ) {
437+ return & v1.Tenant {}, nil
438+ },
439+ params : admin_api.TenantAddZoneParams {
440+ Body : & models.Zone {
441+ Name : "zone-1" ,
442+ Servers : swag .Int64 (int64 (4 )),
443+ VolumeConfiguration : & models.ZoneVolumeConfiguration {
444+ Size : swag .Int64 (0 ),
445+ StorageClassName : "standard" ,
446+ },
447+ VolumesPerServer : swag .Int32 (4 ),
448+ },
449+ },
450+ },
451+ wantErr : true ,
452+ },
453+ {
454+ name : "Add zone, error servers negative" ,
455+ args : args {
456+ ctx : context .Background (),
457+ operatorClient : opClient ,
458+ nameSpace : "default" ,
459+ mockTenantPatch : func (ctx context.Context , namespace string , tenantName string , pt types.PatchType , data []byte , options metav1.PatchOptions ) (* v1.Tenant , error ) {
460+ return & v1.Tenant {}, nil
461+ },
462+ mockTenantGet : func (ctx context.Context , namespace string , tenantName string , options metav1.GetOptions ) (* v1.Tenant , error ) {
463+ return & v1.Tenant {}, nil
464+ },
465+ params : admin_api.TenantAddZoneParams {
466+ Body : & models.Zone {
467+ Name : "zone-1" ,
468+ Servers : swag .Int64 (int64 (- 1 )),
469+ VolumeConfiguration : & models.ZoneVolumeConfiguration {
470+ Size : swag .Int64 (2147483648 ),
471+ StorageClassName : "standard" ,
472+ },
473+ VolumesPerServer : swag .Int32 (4 ),
474+ },
475+ },
476+ },
477+ wantErr : true ,
478+ },
479+ {
480+ name : "Add zone, error volumes per server negative" ,
481+ args : args {
482+ ctx : context .Background (),
483+ operatorClient : opClient ,
484+ nameSpace : "default" ,
485+ mockTenantPatch : func (ctx context.Context , namespace string , tenantName string , pt types.PatchType , data []byte , options metav1.PatchOptions ) (* v1.Tenant , error ) {
486+ return & v1.Tenant {}, nil
487+ },
488+ mockTenantGet : func (ctx context.Context , namespace string , tenantName string , options metav1.GetOptions ) (* v1.Tenant , error ) {
489+ return & v1.Tenant {}, nil
490+ },
491+ params : admin_api.TenantAddZoneParams {
492+ Body : & models.Zone {
493+ Name : "zone-1" ,
494+ Servers : swag .Int64 (int64 (4 )),
495+ VolumeConfiguration : & models.ZoneVolumeConfiguration {
496+ Size : swag .Int64 (2147483648 ),
497+ StorageClassName : "standard" ,
498+ },
499+ VolumesPerServer : swag .Int32 (- 1 ),
500+ },
501+ },
502+ },
503+ wantErr : true ,
422504 },
423505 {
424506 name : "Error on patch, handle error" ,
0 commit comments