Update console to use latest operator (#476)
Main changes Rename everything from Zone->Pool
This commit is contained in:
@@ -287,9 +287,9 @@ func Test_TenantInfo(t *testing.T) {
|
||||
Namespace: "minio-ns",
|
||||
},
|
||||
Spec: operator.TenantSpec{
|
||||
Zones: []operator.Zone{
|
||||
Pools: []operator.Pool{
|
||||
{
|
||||
Name: "zone1",
|
||||
Name: "pool1",
|
||||
Servers: int32(2),
|
||||
VolumesPerServer: 4,
|
||||
VolumeClaimTemplate: &corev1.PersistentVolumeClaim{
|
||||
@@ -317,12 +317,12 @@ func Test_TenantInfo(t *testing.T) {
|
||||
Name: "tenant1",
|
||||
TotalSize: int64(8388608),
|
||||
CurrentState: "ready",
|
||||
Zones: []*models.Zone{
|
||||
Pools: []*models.Pool{
|
||||
{
|
||||
Name: "zone1",
|
||||
Name: "pool1",
|
||||
Servers: swag.Int64(int64(2)),
|
||||
VolumesPerServer: swag.Int32(4),
|
||||
VolumeConfiguration: &models.ZoneVolumeConfiguration{
|
||||
VolumeConfiguration: &models.PoolVolumeConfiguration{
|
||||
StorageClassName: "standard",
|
||||
Size: swag.Int64(1024 * 1024),
|
||||
},
|
||||
@@ -352,9 +352,9 @@ func Test_TenantInfo(t *testing.T) {
|
||||
},
|
||||
},
|
||||
Spec: operator.TenantSpec{
|
||||
Zones: []operator.Zone{
|
||||
Pools: []operator.Pool{
|
||||
{
|
||||
Name: "zone1",
|
||||
Name: "pool1",
|
||||
Servers: int32(2),
|
||||
VolumesPerServer: 4,
|
||||
VolumeClaimTemplate: &corev1.PersistentVolumeClaim{
|
||||
@@ -382,12 +382,12 @@ func Test_TenantInfo(t *testing.T) {
|
||||
Name: "tenant1",
|
||||
TotalSize: int64(8388608),
|
||||
CurrentState: "ready",
|
||||
Zones: []*models.Zone{
|
||||
Pools: []*models.Pool{
|
||||
{
|
||||
Name: "zone1",
|
||||
Name: "pool1",
|
||||
Servers: swag.Int64(int64(2)),
|
||||
VolumesPerServer: swag.Int32(4),
|
||||
VolumeConfiguration: &models.ZoneVolumeConfiguration{
|
||||
VolumeConfiguration: &models.PoolVolumeConfiguration{
|
||||
StorageClassName: "standard",
|
||||
Size: swag.Int64(1024 * 1024),
|
||||
},
|
||||
@@ -414,7 +414,7 @@ func Test_TenantInfo(t *testing.T) {
|
||||
},
|
||||
},
|
||||
Spec: operator.TenantSpec{
|
||||
Zones: []operator.Zone{},
|
||||
Pools: []operator.Pool{},
|
||||
Image: "minio/minio:RELEASE.2020-06-14T18-32-17Z",
|
||||
},
|
||||
Status: operator.TenantStatus{
|
||||
@@ -446,7 +446,7 @@ func Test_TenantInfo(t *testing.T) {
|
||||
},
|
||||
},
|
||||
Spec: operator.TenantSpec{
|
||||
Zones: []operator.Zone{},
|
||||
Pools: []operator.Pool{},
|
||||
Image: "minio/minio:RELEASE.2020-06-14T18-32-17Z",
|
||||
Console: &operator.ConsoleConfiguration{
|
||||
Image: "minio/console:master",
|
||||
@@ -540,7 +540,7 @@ func Test_deleteTenantAction(t *testing.T) {
|
||||
Namespace: "minio-tenant",
|
||||
Labels: map[string]string{
|
||||
operator.TenantLabel: "tenant1",
|
||||
operator.ZoneLabel: "zone-1",
|
||||
operator.PoolLabel: "pool-1",
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -567,7 +567,7 @@ func Test_deleteTenantAction(t *testing.T) {
|
||||
Namespace: "minio-tenant",
|
||||
Labels: map[string]string{
|
||||
operator.TenantLabel: "tenant1",
|
||||
operator.ZoneLabel: "zone-1",
|
||||
operator.PoolLabel: "pool-1",
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -594,7 +594,7 @@ func Test_deleteTenantAction(t *testing.T) {
|
||||
Namespace: "minio-tenant",
|
||||
Labels: map[string]string{
|
||||
operator.TenantLabel: "tenant1",
|
||||
operator.ZoneLabel: "zone-1",
|
||||
operator.PoolLabel: "pool-1",
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -621,7 +621,7 @@ func Test_deleteTenantAction(t *testing.T) {
|
||||
Namespace: "minio-tenant",
|
||||
Labels: map[string]string{
|
||||
operator.TenantLabel: "tenant1",
|
||||
operator.ZoneLabel: "zone-1",
|
||||
operator.PoolLabel: "pool-1",
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -649,7 +649,7 @@ func Test_deleteTenantAction(t *testing.T) {
|
||||
Namespace: "minio-tenant",
|
||||
Labels: map[string]string{
|
||||
operator.TenantLabel: "tenant1",
|
||||
operator.ZoneLabel: "zone-1",
|
||||
operator.PoolLabel: "pool-1",
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -672,7 +672,7 @@ func Test_deleteTenantAction(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func Test_TenantAddZone(t *testing.T) {
|
||||
func Test_TenantAddPool(t *testing.T) {
|
||||
opClient := opClientMock{}
|
||||
|
||||
type args struct {
|
||||
@@ -681,7 +681,7 @@ func Test_TenantAddZone(t *testing.T) {
|
||||
nameSpace string
|
||||
mockTenantPatch func(ctx context.Context, namespace string, tenantName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*v1.Tenant, error)
|
||||
mockTenantGet func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*v1.Tenant, error)
|
||||
params admin_api.TenantAddZoneParams
|
||||
params admin_api.TenantAddPoolParams
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
@@ -689,7 +689,7 @@ func Test_TenantAddZone(t *testing.T) {
|
||||
wantErr bool
|
||||
}{
|
||||
{
|
||||
name: "Add zone, no errors",
|
||||
name: "Add pool, no errors",
|
||||
args: args{
|
||||
ctx: context.Background(),
|
||||
operatorClient: opClient,
|
||||
@@ -700,11 +700,11 @@ func Test_TenantAddZone(t *testing.T) {
|
||||
mockTenantGet: func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*v1.Tenant, error) {
|
||||
return &v1.Tenant{}, nil
|
||||
},
|
||||
params: admin_api.TenantAddZoneParams{
|
||||
Body: &models.Zone{
|
||||
Name: "zone-1",
|
||||
params: admin_api.TenantAddPoolParams{
|
||||
Body: &models.Pool{
|
||||
Name: "pool-1",
|
||||
Servers: swag.Int64(int64(4)),
|
||||
VolumeConfiguration: &models.ZoneVolumeConfiguration{
|
||||
VolumeConfiguration: &models.PoolVolumeConfiguration{
|
||||
Size: swag.Int64(2147483648),
|
||||
StorageClassName: "standard",
|
||||
},
|
||||
@@ -714,7 +714,7 @@ func Test_TenantAddZone(t *testing.T) {
|
||||
},
|
||||
wantErr: false,
|
||||
}, {
|
||||
name: "Add zone, error size",
|
||||
name: "Add pool, error size",
|
||||
args: args{
|
||||
ctx: context.Background(),
|
||||
operatorClient: opClient,
|
||||
@@ -725,11 +725,11 @@ func Test_TenantAddZone(t *testing.T) {
|
||||
mockTenantGet: func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*v1.Tenant, error) {
|
||||
return &v1.Tenant{}, nil
|
||||
},
|
||||
params: admin_api.TenantAddZoneParams{
|
||||
Body: &models.Zone{
|
||||
Name: "zone-1",
|
||||
params: admin_api.TenantAddPoolParams{
|
||||
Body: &models.Pool{
|
||||
Name: "pool-1",
|
||||
Servers: swag.Int64(int64(4)),
|
||||
VolumeConfiguration: &models.ZoneVolumeConfiguration{
|
||||
VolumeConfiguration: &models.PoolVolumeConfiguration{
|
||||
Size: swag.Int64(0),
|
||||
StorageClassName: "standard",
|
||||
},
|
||||
@@ -740,7 +740,7 @@ func Test_TenantAddZone(t *testing.T) {
|
||||
wantErr: true,
|
||||
},
|
||||
{
|
||||
name: "Add zone, error servers negative",
|
||||
name: "Add pool, error servers negative",
|
||||
args: args{
|
||||
ctx: context.Background(),
|
||||
operatorClient: opClient,
|
||||
@@ -751,11 +751,11 @@ func Test_TenantAddZone(t *testing.T) {
|
||||
mockTenantGet: func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*v1.Tenant, error) {
|
||||
return &v1.Tenant{}, nil
|
||||
},
|
||||
params: admin_api.TenantAddZoneParams{
|
||||
Body: &models.Zone{
|
||||
Name: "zone-1",
|
||||
params: admin_api.TenantAddPoolParams{
|
||||
Body: &models.Pool{
|
||||
Name: "pool-1",
|
||||
Servers: swag.Int64(int64(-1)),
|
||||
VolumeConfiguration: &models.ZoneVolumeConfiguration{
|
||||
VolumeConfiguration: &models.PoolVolumeConfiguration{
|
||||
Size: swag.Int64(2147483648),
|
||||
StorageClassName: "standard",
|
||||
},
|
||||
@@ -766,7 +766,7 @@ func Test_TenantAddZone(t *testing.T) {
|
||||
wantErr: true,
|
||||
},
|
||||
{
|
||||
name: "Add zone, error volumes per server negative",
|
||||
name: "Add pool, error volumes per server negative",
|
||||
args: args{
|
||||
ctx: context.Background(),
|
||||
operatorClient: opClient,
|
||||
@@ -777,11 +777,11 @@ func Test_TenantAddZone(t *testing.T) {
|
||||
mockTenantGet: func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*v1.Tenant, error) {
|
||||
return &v1.Tenant{}, nil
|
||||
},
|
||||
params: admin_api.TenantAddZoneParams{
|
||||
Body: &models.Zone{
|
||||
Name: "zone-1",
|
||||
params: admin_api.TenantAddPoolParams{
|
||||
Body: &models.Pool{
|
||||
Name: "pool-1",
|
||||
Servers: swag.Int64(int64(4)),
|
||||
VolumeConfiguration: &models.ZoneVolumeConfiguration{
|
||||
VolumeConfiguration: &models.PoolVolumeConfiguration{
|
||||
Size: swag.Int64(2147483648),
|
||||
StorageClassName: "standard",
|
||||
},
|
||||
@@ -803,9 +803,9 @@ func Test_TenantAddZone(t *testing.T) {
|
||||
mockTenantGet: func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*v1.Tenant, error) {
|
||||
return &v1.Tenant{}, nil
|
||||
},
|
||||
params: admin_api.TenantAddZoneParams{
|
||||
Body: &models.Zone{
|
||||
Name: "zone-1",
|
||||
params: admin_api.TenantAddPoolParams{
|
||||
Body: &models.Pool{
|
||||
Name: "pool-1",
|
||||
Servers: swag.Int64(int64(4)),
|
||||
},
|
||||
},
|
||||
@@ -824,9 +824,9 @@ func Test_TenantAddZone(t *testing.T) {
|
||||
mockTenantGet: func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*v1.Tenant, error) {
|
||||
return nil, errors.New("errors")
|
||||
},
|
||||
params: admin_api.TenantAddZoneParams{
|
||||
Body: &models.Zone{
|
||||
Name: "zone-1",
|
||||
params: admin_api.TenantAddPoolParams{
|
||||
Body: &models.Pool{
|
||||
Name: "pool-1",
|
||||
Servers: swag.Int64(int64(4)),
|
||||
},
|
||||
},
|
||||
@@ -838,8 +838,8 @@ func Test_TenantAddZone(t *testing.T) {
|
||||
opClientTenantGetMock = tt.args.mockTenantGet
|
||||
opClientTenantPatchMock = tt.args.mockTenantPatch
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if err := addTenantZone(tt.args.ctx, tt.args.operatorClient, tt.args.params); (err != nil) != tt.wantErr {
|
||||
t.Errorf("addTenantZone() error = %v, wantErr %v", err, tt.wantErr)
|
||||
if err := addTenantPool(tt.args.ctx, tt.args.operatorClient, tt.args.params); (err != nil) != tt.wantErr {
|
||||
t.Errorf("addTenantPool() error = %v, wantErr %v", err, tt.wantErr)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user