Skip to content

Commit 56d8aad

Browse files
test: add logging statements when we wait for something in e2e tests
Signed-off-by: Kostis Kapelonis <[email protected]>
1 parent 9bca0b6 commit 56d8aad

10 files changed

+27
-15
lines changed

test/e2e/single_grpcroute_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ func setupSingleGRPCRouteEnv(ctx context.Context, t *testing.T, config *envconf.
107107
}
108108
logrus.Infof("rollout %q was created", resourcesMap[ROLLOUT_KEY].GetName())
109109
waitCondition := conditions.New(clusterResources)
110+
logrus.Infof("waiting for grpcRoute %q to connect with rollout %q (expecting canary weight: %d)", resourcesMap[GRPC_ROUTE_KEY].GetName(), resourcesMap[ROLLOUT_KEY].GetName(), FIRST_CANARY_ROUTE_WEIGHT)
110111
err = wait.For(
111112
waitCondition.ResourceMatch(
112113
resourcesMap[GRPC_ROUTE_KEY],
@@ -180,6 +181,7 @@ func testSingleGRPCRoute(ctx context.Context, t *testing.T, config *envconf.Conf
180181
}
181182
logrus.Infof("rollout %q was updated", resourcesMap[ROLLOUT_KEY].GetName())
182183
waitCondition := conditions.New(clusterResources)
184+
logrus.Infof("waiting for grpcRoute %q to update canary weight to %d after rollout image change", resourcesMap[GRPC_ROUTE_KEY].GetName(), LAST_CANARY_ROUTE_WEIGHT)
183185
err = wait.For(
184186
waitCondition.ResourceMatch(
185187
resourcesMap[GRPC_ROUTE_KEY],
@@ -232,14 +234,14 @@ func getMatchGRPCRouteFetcher(t *testing.T, targetWeight int32) func(k8s.Object)
232234
t.Error()
233235
return false
234236
}
235-
logrus.Info("k8s object was type asserted")
237+
// logrus.Info("k8s object was type asserted")
236238
err := runtime.DefaultUnstructuredConverter.FromUnstructured(unstructuredGRPCRoute.Object, &grpcRoute)
237239
if err != nil {
238240
logrus.Errorf("conversation from unstructured grpcRoute %q to the typed grpcRoute was failed", unstructuredGRPCRoute.GetName())
239241
t.Error()
240242
return false
241243
}
242-
logrus.Infof("unstructured grpcRoute %q was converted to the typed grpcRoute", grpcRoute.GetName())
244+
// logrus.Infof("Looking for grpcRoute %q to reach weight %d", grpcRoute.GetName(), targetWeight)
243245
return *grpcRoute.Spec.Rules[ROLLOUT_ROUTE_RULE_INDEX].BackendRefs[CANARY_BACKEND_REF_INDEX].Weight == targetWeight
244246
}
245247
}

test/e2e/single_header_based_grpcroute_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ func setupSingleHeaderBasedGRPCRouteEnv(ctx context.Context, t *testing.T, confi
107107
}
108108
logrus.Infof("rollout %q was created", resourcesMap[ROLLOUT_KEY].GetName())
109109
waitCondition := conditions.New(clusterResources)
110+
logrus.Infof("waiting for grpcRoute %q to connect with rollout %q (expecting canary weight: %d)", resourcesMap[GRPC_ROUTE_KEY].GetName(), resourcesMap[ROLLOUT_KEY].GetName(), FIRST_CANARY_ROUTE_WEIGHT)
110111
err = wait.For(
111112
waitCondition.ResourceMatch(
112113
resourcesMap[GRPC_ROUTE_KEY],
@@ -180,6 +181,7 @@ func testSingleHeaderBasedGRPCRoute(ctx context.Context, t *testing.T, config *e
180181
}
181182
logrus.Infof("rollout %q was updated", resourcesMap[ROLLOUT_KEY].GetName())
182183
waitCondition := conditions.New(clusterResources)
184+
logrus.Infof("waiting for grpcRoute %q to update with header-based routing and canary weight %d", resourcesMap[GRPC_ROUTE_KEY].GetName(), LAST_CANARY_ROUTE_WEIGHT)
183185
err = wait.For(
184186
waitCondition.ResourceMatch(
185187
resourcesMap[GRPC_ROUTE_KEY],
@@ -198,6 +200,7 @@ func testSingleHeaderBasedGRPCRoute(ctx context.Context, t *testing.T, config *e
198200
return ctx
199201
}
200202
logrus.Infof("grpcRoute %q was updated", resourcesMap[GRPC_ROUTE_KEY].GetName())
203+
logrus.Infof("waiting for grpcRoute %q to clean up header-based routing and reset canary weight to %d", resourcesMap[GRPC_ROUTE_KEY].GetName(), FIRST_CANARY_ROUTE_WEIGHT)
201204
err = wait.For(
202205
waitCondition.ResourceMatch(
203206
resourcesMap[GRPC_ROUTE_KEY],
@@ -254,14 +257,14 @@ func getMatchHeaderBasedGRPCRouteFetcher(t *testing.T, targetWeight int32, targe
254257
t.Error()
255258
return false
256259
}
257-
logrus.Info("k8s object was type asserted")
260+
// logrus.Info("k8s object was type asserted")
258261
err := runtime.DefaultUnstructuredConverter.FromUnstructured(unstructuredGRPCRoute.Object, &grpcRoute)
259262
if err != nil {
260263
logrus.Errorf("conversation from unstructured grpcRoute %q to the typed grpcRoute was failed", unstructuredGRPCRoute.GetName())
261264
t.Error()
262265
return false
263266
}
264-
logrus.Infof("unstructured grpcRoute %q was converted to the typed grpcRoute", grpcRoute.GetName())
267+
// logrus.Infof("unstructured grpcRoute %q was converted to the typed grpcRoute", grpcRoute.GetName())
265268
rules := grpcRoute.Spec.Rules
266269
if targetHeaderBasedRouteValue.Type == nil {
267270
return len(rules) == LAST_HEADER_BASED_RULES_LENGTH &&

test/e2e/single_header_based_httproute_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ func setupSingleHeaderBasedHTTPRouteEnv(ctx context.Context, t *testing.T, confi
107107
}
108108
logrus.Infof("rollout %q was created", resourcesMap[ROLLOUT_KEY].GetName())
109109
waitCondition := conditions.New(clusterResources)
110+
logrus.Infof("waiting for httpRoute %q to connect with rollout %q (expecting canary weight: %d)", resourcesMap[HTTP_ROUTE_KEY].GetName(), resourcesMap[ROLLOUT_KEY].GetName(), FIRST_CANARY_ROUTE_WEIGHT)
110111
err = wait.For(
111112
waitCondition.ResourceMatch(
112113
resourcesMap[HTTP_ROUTE_KEY],
@@ -180,6 +181,7 @@ func testSingleHeaderBasedHTTPRoute(ctx context.Context, t *testing.T, config *e
180181
}
181182
logrus.Infof("rollout %q was updated", resourcesMap[ROLLOUT_KEY].GetName())
182183
waitCondition := conditions.New(clusterResources)
184+
logrus.Infof("waiting for httpRoute %q to update with header-based routing and canary weight %d", resourcesMap[HTTP_ROUTE_KEY].GetName(), LAST_CANARY_ROUTE_WEIGHT)
183185
err = wait.For(
184186
waitCondition.ResourceMatch(
185187
resourcesMap[HTTP_ROUTE_KEY],
@@ -198,6 +200,7 @@ func testSingleHeaderBasedHTTPRoute(ctx context.Context, t *testing.T, config *e
198200
return ctx
199201
}
200202
logrus.Infof("httpRoute %q was updated", resourcesMap[HTTP_ROUTE_KEY].GetName())
203+
logrus.Infof("waiting for httpRoute %q to clean up header-based routing and reset canary weight to %d", resourcesMap[HTTP_ROUTE_KEY].GetName(), FIRST_CANARY_ROUTE_WEIGHT)
201204
err = wait.For(
202205
waitCondition.ResourceMatch(
203206
resourcesMap[HTTP_ROUTE_KEY],
@@ -254,14 +257,14 @@ func getMatchHeaderBasedHTTPRouteFetcher(t *testing.T, targetWeight int32, targe
254257
t.Error()
255258
return false
256259
}
257-
logrus.Info("k8s object was type asserted")
260+
// logrus.Info("k8s object was type asserted")
258261
err := runtime.DefaultUnstructuredConverter.FromUnstructured(unstructuredHTTPRoute.Object, &httpRoute)
259262
if err != nil {
260263
logrus.Errorf("conversation from unstructured httpRoute %q to the typed httpRoute was failed", unstructuredHTTPRoute.GetName())
261264
t.Error()
262265
return false
263266
}
264-
logrus.Infof("unstructured httpRoute %q was converted to the typed httpRoute", httpRoute.GetName())
267+
// logrus.Infof("unstructured httpRoute %q was converted to the typed httpRoute", httpRoute.GetName())
265268
rules := httpRoute.Spec.Rules
266269
if targetHeaderBasedRouteValue.Type == nil {
267270
return len(rules) == LAST_HEADER_BASED_RULES_LENGTH &&

test/e2e/single_httproute_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ func setupSingleHTTPRouteEnv(ctx context.Context, t *testing.T, config *envconf.
109109
}
110110
logrus.Infof("rollout %q was created", resourcesMap[ROLLOUT_KEY].GetName())
111111
waitCondition := conditions.New(clusterResources)
112+
logrus.Infof("waiting for httpRoute %q to connect with rollout %q (expecting canary weight: %d)", resourcesMap[HTTP_ROUTE_KEY].GetName(), resourcesMap[ROLLOUT_KEY].GetName(), FIRST_CANARY_ROUTE_WEIGHT)
112113
err = wait.For(
113114
waitCondition.ResourceMatch(
114115
resourcesMap[HTTP_ROUTE_KEY],
@@ -182,6 +183,7 @@ func testSingleHTTPRoute(ctx context.Context, t *testing.T, config *envconf.Conf
182183
}
183184
logrus.Infof("rollout %q was updated", resourcesMap[ROLLOUT_KEY].GetName())
184185
waitCondition := conditions.New(clusterResources)
186+
logrus.Infof("waiting for httpRoute %q to update canary weight to %d after rollout image change", resourcesMap[HTTP_ROUTE_KEY].GetName(), LAST_CANARY_ROUTE_WEIGHT)
185187
err = wait.For(
186188
waitCondition.ResourceMatch(
187189
resourcesMap[HTTP_ROUTE_KEY],
@@ -234,14 +236,14 @@ func getMatchHTTPRouteFetcher(t *testing.T, targetWeight int32) func(k8s.Object)
234236
t.Error()
235237
return false
236238
}
237-
logrus.Info("k8s object was type asserted")
239+
// logrus.Info("k8s object was type asserted")
238240
err := runtime.DefaultUnstructuredConverter.FromUnstructured(unstructuredHTTPRoute.Object, &httpRoute)
239241
if err != nil {
240242
logrus.Errorf("conversation from unstructured httpRoute %q to the typed httpRoute was failed", unstructuredHTTPRoute.GetName())
241243
t.Error()
242244
return false
243245
}
244-
logrus.Infof("unstructured httpRoute %q was converted to the typed httpRoute", httpRoute.GetName())
246+
// logrus.Infof("unstructured httpRoute %q was converted to the typed httpRoute", httpRoute.GetName())
245247
return *httpRoute.Spec.Rules[ROLLOUT_ROUTE_RULE_INDEX].BackendRefs[CANARY_BACKEND_REF_INDEX].Weight == targetWeight
246248
}
247249
}

test/e2e/single_tcproute_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ func setupSingleTCPRouteEnv(ctx context.Context, t *testing.T, config *envconf.C
107107
}
108108
logrus.Infof("rollout %q was created", resourcesMap[ROLLOUT_KEY].GetName())
109109
waitCondition := conditions.New(clusterResources)
110+
logrus.Infof("waiting for tcpRoute %q to connect with rollout %q (expecting canary weight: %d)", resourcesMap[TCP_ROUTE_KEY].GetName(), resourcesMap[ROLLOUT_KEY].GetName(), FIRST_CANARY_ROUTE_WEIGHT)
110111
err = wait.For(
111112
waitCondition.ResourceMatch(
112113
resourcesMap[TCP_ROUTE_KEY],
@@ -180,6 +181,7 @@ func testSingleTCPRoute(ctx context.Context, t *testing.T, config *envconf.Confi
180181
}
181182
logrus.Infof("rollout %q was updated", resourcesMap[ROLLOUT_KEY].GetName())
182183
waitCondition := conditions.New(clusterResources)
184+
logrus.Infof("waiting for tcpRoute %q to update canary weight to %d after rollout image change", resourcesMap[TCP_ROUTE_KEY].GetName(), LAST_CANARY_ROUTE_WEIGHT)
183185
err = wait.For(
184186
waitCondition.ResourceMatch(
185187
resourcesMap[TCP_ROUTE_KEY],
@@ -232,14 +234,14 @@ func getMatchTCPRouteFetcher(t *testing.T, targetWeight int32) func(k8s.Object)
232234
t.Error()
233235
return false
234236
}
235-
logrus.Info("k8s object was type asserted")
237+
// logrus.Info("k8s object was type asserted")
236238
err := runtime.DefaultUnstructuredConverter.FromUnstructured(unstructuredTCPRoute.Object, &tcpRoute)
237239
if err != nil {
238240
logrus.Errorf("conversation from unstructured tcpRoute %q to the typed tcpRoute was failed", unstructuredTCPRoute.GetName())
239241
t.Error()
240242
return false
241243
}
242-
logrus.Infof("unstructured tcpRoute %q was converted to the typed tcpRoute", tcpRoute.GetName())
244+
// logrus.Infof("unstructured tcpRoute %q was converted to the typed tcpRoute", tcpRoute.GetName())
243245
return *tcpRoute.Spec.Rules[ROLLOUT_ROUTE_RULE_INDEX].BackendRefs[CANARY_BACKEND_REF_INDEX].Weight == targetWeight
244246
}
245247
}

test/e2e/testdata/single-grpcroute-rollout.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ spec:
1616
namespace: default
1717
steps:
1818
- setWeight: 30
19-
- pause: { 30 }
19+
- pause: { }
2020
revisionHistoryLimit: 1
2121
selector:
2222
matchLabels:

test/e2e/testdata/single-header-based-grpcroute-rollout.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ spec:
2626
- headerName: X-Test
2727
headerValue:
2828
exact: test
29-
- pause: { 30 }
29+
- pause: { }
3030
revisionHistoryLimit: 2
3131
selector:
3232
matchLabels:

test/e2e/testdata/single-header-based-httproute-rollout.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ spec:
2626
- headerName: X-Test
2727
headerValue:
2828
exact: test
29-
- pause: { 30 }
29+
- pause: { }
3030
revisionHistoryLimit: 2
3131
selector:
3232
matchLabels:

test/e2e/testdata/single-httproute-rollout.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ spec:
1616
namespace: default
1717
steps:
1818
- setWeight: 30
19-
- pause: { 30 }
19+
- pause: { }
2020
revisionHistoryLimit: 1
2121
selector:
2222
matchLabels:

test/e2e/testdata/single-tcproute-rollout.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ spec:
1616
namespace: default
1717
steps:
1818
- setWeight: 30
19-
- pause: { 30 }
19+
- pause: { }
2020
revisionHistoryLimit: 1
2121
selector:
2222
matchLabels:

0 commit comments

Comments
 (0)