Adjusted tests to new behaviour on init and promotion

Signed-off-by: Iaroslav Vorozhko <iaroslav.vorozhko@mcmakler.de>
This commit is contained in:
Iaroslav Vorozhko
2021-05-13 14:45:33 +02:00
parent e926486b0f
commit 41481c1ca8
+5 -2
View File
@@ -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) {
@@ -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) {