Skip to content

Commit

Permalink
[MESH-2199] - Reformatting code
Browse files Browse the repository at this point in the history
Signed-off-by: vgonuguntla <vinay_gonuguntla@intuit.com>
  • Loading branch information
vinaygonuguntla committed Sep 16, 2022
1 parent b826e36 commit 6fac595
Showing 1 changed file with 18 additions and 22 deletions.
40 changes: 18 additions & 22 deletions admiral/pkg/clusters/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ import (
"testing"
"time"

"github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/model"
istiofake "istio.io/client-go/pkg/clientset/versioned/fake"
"os"
argo "github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1"
"github.com/google/go-cmp/cmp/cmpopts"
"github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/model"
v1 "github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/v1"
admiralFake "github.com/istio-ecosystem/admiral/admiral/pkg/client/clientset/versioned/fake"
"github.com/istio-ecosystem/admiral/admiral/pkg/controller/admiral"
"github.com/istio-ecosystem/admiral/admiral/pkg/controller/common"
log "github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
istiofake "istio.io/client-go/pkg/clientset/versioned/fake"
v12 "k8s.io/api/apps/v1"
v13 "k8s.io/api/core/v1"
time2 "k8s.io/apimachinery/pkg/apis/meta/v1"
"os"
)

var ignoreUnexported = cmpopts.IgnoreUnexported(v1.GlobalTrafficPolicy{}.Status)
Expand Down Expand Up @@ -481,24 +481,20 @@ func TestRoutingPolicyReadOnly(t *testing.T) {

testcases := []struct {
name string
rp *v1.RoutingPolicy
readOnly bool
rp *v1.RoutingPolicy
readOnly bool
doesError bool
}{
{
name: "Readonly test - Routing Policy",
rp: &v1.RoutingPolicy{

},
readOnly: true,
name: "Readonly test - Routing Policy",
rp: &v1.RoutingPolicy{},
readOnly: true,
doesError: true,
},
{
name: "Readonly false test - Routing Policy",
rp: &v1.RoutingPolicy{

},
readOnly: false,
name: "Readonly false test - Routing Policy",
rp: &v1.RoutingPolicy{},
readOnly: false,
doesError: false,
},
}
Expand All @@ -509,7 +505,7 @@ func TestRoutingPolicyReadOnly(t *testing.T) {
t.Run(c.name, func(t *testing.T) {
if c.readOnly {
CurrentAdmiralState.ReadOnly = true
}else{
} else {
CurrentAdmiralState.ReadOnly = false
}
var buf bytes.Buffer
Expand All @@ -520,20 +516,20 @@ func TestRoutingPolicyReadOnly(t *testing.T) {
// Add routing policy test
handler.Added(ctx, c.rp)
t.Log(buf.String())
val := strings.Contains(buf.String(),"skipping read-only mode")
assert.Equal(t, c.doesError,val)
val := strings.Contains(buf.String(), "skipping read-only mode")
assert.Equal(t, c.doesError, val)

// Update routing policy test
handler.Updated(ctx, c.rp)
t.Log(buf.String())
val = strings.Contains(buf.String(),"skipping read-only mode")
assert.Equal(t, c.doesError,val)
val = strings.Contains(buf.String(), "skipping read-only mode")
assert.Equal(t, c.doesError, val)

// Delete routing policy test
handler.Deleted(ctx, c.rp)
t.Log(buf.String())
val = strings.Contains(buf.String(),"skipping read-only mode")
assert.Equal(t, c.doesError,val)
val = strings.Contains(buf.String(), "skipping read-only mode")
assert.Equal(t, c.doesError, val)
})
}
}

0 comments on commit 6fac595

Please sign in to comment.