Skip to content

Commit d408611

Browse files
committed
chore: debug kube test flake
Signed-off-by: zirain <[email protected]>
1 parent 58eab94 commit d408611

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

internal/provider/kubernetes/kubernetes_test.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ package kubernetes
99

1010
import (
1111
"context"
12-
"fmt"
1312
"os"
1413
"path/filepath"
1514
"testing"
@@ -249,7 +248,7 @@ func testGatewayScheduledStatus(ctx context.Context, t *testing.T, provider *Pro
249248
}
250249

251250
return false
252-
}, defaultWait, defaultTick)
251+
}, defaultWait, defaultTick, " timed out waiting for GatewayClass %s to report Accepted=True condition", gc.Name)
253252

254253
defer func() {
255254
require.NoError(t, cli.Delete(ctx, gc))
@@ -331,22 +330,21 @@ func testGatewayScheduledStatus(ctx context.Context, t *testing.T, provider *Pro
331330
require.NoError(t, cli.Create(ctx, deploy))
332331
require.NoError(t, cli.Create(ctx, svc))
333332

334-
// Ensure the Gateway reports "Scheduled".
333+
// Ensure the Gateway reports "Accepted".
335334
require.Eventually(t, func() bool {
336335
if err := cli.Get(ctx, utils.NamespacedName(gw), gw); err != nil {
337336
return false
338337
}
339338

340339
for _, cond := range gw.Status.Conditions {
341-
fmt.Printf("Condition: %v\n", cond)
342340
if cond.Type == string(gwapiv1.GatewayConditionAccepted) && cond.Status == metav1.ConditionTrue {
343341
return true
344342
}
345343
}
346344

347-
// Scheduled=True condition not found.
345+
t.Logf("Accepted=True condition not found in Gateway %s/%s conditions: %+v", gw.Namespace, gw.Name, gw.Status.Conditions)
348346
return false
349-
}, defaultWait, defaultTick)
347+
}, defaultWait, defaultTick, " timed out waiting for Gateway %s to report Accepted=True condition", utils.NamespacedName(gw))
350348

351349
defer func() {
352350
require.NoError(t, cli.Delete(ctx, gw))

tools/make/golang.mk

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ go.test.fuzz: ## Run all fuzzers in the test/fuzz folder one by one
5353
go.test.unit: ## Run go unit tests
5454
go test -race ./...
5555

56+
.PHONY: go.test.integration
57+
go.test.integration: manifests ## Run go integration tests
58+
@$(LOG_TARGET)
59+
KUBEBUILDER_ASSETS="$$($(GO_TOOL) setup-envtest use $(ENVTEST_K8S_VERSION) -p path)" \
60+
go test ./internal/provider/kubernetes --tags=integration -race
61+
5662
.PHONY: go.testdata.complete
5763
go.testdata.complete: ## Override test ouputdata
5864
@$(LOG_TARGET)

tools/make/kube.mk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
22
# To know the available versions check:
33
# - https://github.com/kubernetes-sigs/controller-tools/blob/main/envtest-releases.yaml
4-
ENVTEST_K8S_VERSION ?= 1.29.5
4+
ENVTEST_K8S_VERSION ?= 1.33.0
55
# Need run cel validation across multiple versions of k8s
6-
# TODO: zhaohuabing update kubebuilder assets to 1.33.0 when available
7-
ENVTEST_K8S_VERSIONS ?= 1.29.5 1.30.3 1.31.0 1.32.0
6+
# TODO: update kubebuilder assets to 1.34.0 when available
7+
ENVTEST_K8S_VERSIONS ?= 1.30.3 1.31.0 1.32.0 v1.33.0
88

99
# GATEWAY_API_VERSION refers to the version of Gateway API CRDs.
1010
# For more details, see https://gateway-api.sigs.k8s.io/guides/getting-started/#installing-gateway-api

0 commit comments

Comments
 (0)