Skip to content

Commit

Permalink
Adjusted tests to new behaviour on init and promotion
Browse files Browse the repository at this point in the history
  • Loading branch information
Iaroslav Vorozhko committed May 13, 2021
1 parent 4385de3 commit 9ee487f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/router/ingress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,15 @@ func TestIngressRouter_Reconcile(t *testing.T) {
require.NoError(t, err)

canaryAn := "custom.ingress.kubernetes.io/canary"
canaryWeightAn := "custom.ingress.kubernetes.io/canary-weight"

canaryName := fmt.Sprintf("%s-canary", mocks.ingressCanary.Spec.IngressRef.Name)
inCanary, err := router.kubeClient.NetworkingV1beta1().Ingresses("default").Get(context.TODO(), canaryName, metav1.GetOptions{})
require.NoError(t, err)

// test initialisation
assert.Equal(t, "false", inCanary.Annotations[canaryAn])
assert.Equal(t, "true", inCanary.Annotations[canaryAn])
assert.Equal(t, "0", inCanary.Annotations[canaryWeightAn])
}

func TestIngressRouter_GetSetRoutes(t *testing.T) {
Expand Down Expand Up @@ -94,7 +96,8 @@ func TestIngressRouter_GetSetRoutes(t *testing.T) {
require.NoError(t, err)

// test promotion
assert.Equal(t, "false", inCanary.Annotations[canaryAn])
assert.Equal(t, "true", inCanary.Annotations[canaryAn])
assert.Equal(t, "0", inCanary.Annotations[canaryWeightAn])
}

func TestIngressRouter_ABTest(t *testing.T) {
Expand Down

0 comments on commit 9ee487f

Please sign in to comment.