Tests for getTenantMonitoringResponse, getTenantUsage and getTenantPods (#2599)
This commit is contained in:
@@ -39,7 +39,7 @@ func TestArnsList(t *testing.T) {
|
||||
assert := asrt.New(t)
|
||||
adminClient := AdminClientMock{}
|
||||
// Test-1 : getArns() returns proper arn list
|
||||
minioServerInfoMock = func(ctx context.Context) (madmin.InfoMessage, error) {
|
||||
MinioServerInfoMock = func(ctx context.Context) (madmin.InfoMessage, error) {
|
||||
return madmin.InfoMessage{
|
||||
SQSARN: []string{"uno"},
|
||||
}, nil
|
||||
@@ -54,7 +54,7 @@ func TestArnsList(t *testing.T) {
|
||||
assert.Nil(err, "Error should have been nil")
|
||||
|
||||
// Test-2 : getArns(ctx) fails for whatever reason
|
||||
minioServerInfoMock = func(ctx context.Context) (madmin.InfoMessage, error) {
|
||||
MinioServerInfoMock = func(ctx context.Context) (madmin.InfoMessage, error) {
|
||||
return madmin.InfoMessage{}, errors.New("some reason")
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ import (
|
||||
type AdminClientMock struct{}
|
||||
|
||||
var (
|
||||
minioServerInfoMock func(ctx context.Context) (madmin.InfoMessage, error)
|
||||
MinioServerInfoMock func(ctx context.Context) (madmin.InfoMessage, error)
|
||||
minioChangePasswordMock func(ctx context.Context, accessKey, secretKey string) error
|
||||
|
||||
minioHelpConfigKVMock func(subSys, key string, envOnly bool) (madmin.Help, error)
|
||||
@@ -87,7 +87,7 @@ var (
|
||||
)
|
||||
|
||||
func (ac AdminClientMock) serverInfo(ctx context.Context) (madmin.InfoMessage, error) {
|
||||
return minioServerInfoMock(ctx)
|
||||
return MinioServerInfoMock(ctx)
|
||||
}
|
||||
|
||||
func (ac AdminClientMock) listRemoteBuckets(ctx context.Context, bucket, arnType string) (targets []madmin.BucketTarget, err error) {
|
||||
|
||||
@@ -44,7 +44,7 @@ type AdminInfoTestSuite struct {
|
||||
func (suite *AdminInfoTestSuite) SetupSuite() {
|
||||
suite.assert = assert.New(suite.T())
|
||||
suite.adminClient = AdminClientMock{}
|
||||
minioServerInfoMock = func(ctx context.Context) (madmin.InfoMessage, error) {
|
||||
MinioServerInfoMock = func(ctx context.Context) (madmin.InfoMessage, error) {
|
||||
return madmin.InfoMessage{
|
||||
Servers: []madmin.ServerProperties{{
|
||||
Disks: []madmin.Disk{{}},
|
||||
|
||||
@@ -35,7 +35,7 @@ func TestServiceRestart(t *testing.T) {
|
||||
minioServiceRestartMock = func(ctx context.Context) error {
|
||||
return nil
|
||||
}
|
||||
minioServerInfoMock = func(ctx context.Context) (madmin.InfoMessage, error) {
|
||||
MinioServerInfoMock = func(ctx context.Context) (madmin.InfoMessage, error) {
|
||||
return madmin.InfoMessage{}, nil
|
||||
}
|
||||
if err := serviceRestart(ctx, adminClient); err != nil {
|
||||
@@ -47,7 +47,7 @@ func TestServiceRestart(t *testing.T) {
|
||||
minioServiceRestartMock = func(ctx context.Context) error {
|
||||
return errors.New("error")
|
||||
}
|
||||
minioServerInfoMock = func(ctx context.Context) (madmin.InfoMessage, error) {
|
||||
MinioServerInfoMock = func(ctx context.Context) (madmin.InfoMessage, error) {
|
||||
return madmin.InfoMessage{}, nil
|
||||
}
|
||||
if err := serviceRestart(ctx, adminClient); assert.Error(err) {
|
||||
@@ -59,7 +59,7 @@ func TestServiceRestart(t *testing.T) {
|
||||
minioServiceRestartMock = func(ctx context.Context) error {
|
||||
return nil
|
||||
}
|
||||
minioServerInfoMock = func(ctx context.Context) (madmin.InfoMessage, error) {
|
||||
MinioServerInfoMock = func(ctx context.Context) (madmin.InfoMessage, error) {
|
||||
return madmin.InfoMessage{}, errors.New("error on server info")
|
||||
}
|
||||
if err := serviceRestart(ctx, adminClient); assert.Error(err) {
|
||||
|
||||
@@ -47,7 +47,7 @@ func (suite *AdminSubnetTestSuite) SetupSuite() {
|
||||
minioGetConfigKVMock = func(key string) ([]byte, error) {
|
||||
return []byte("subnet license=mock api_key=mock proxy=http://mock.com"), nil
|
||||
}
|
||||
minioServerInfoMock = func(ctx context.Context) (madmin.InfoMessage, error) {
|
||||
MinioServerInfoMock = func(ctx context.Context) (madmin.InfoMessage, error) {
|
||||
return madmin.InfoMessage{Servers: []madmin.ServerProperties{{}}}, nil
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user