fix(conformance): increase TimeoutConfig from 10s to 30s for Kind clu… #330
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: E2E | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| packages: read | |
| env: | |
| CLUSTER_NAME: e2e | |
| GATEWAY_API_VERSION: v1.5.1 | |
| CONTROLPLANE_IMAGE: ghcr.io/nantian-gw/nantian-controlplane:ci-${{ github.sha }} | |
| jobs: | |
| smoke: | |
| name: Smoke | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| steps: | |
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 | |
| - name: Resolve dependency images | |
| run: | | |
| source scripts/ci/dependency-images.sh | |
| { | |
| echo "DATAPLANE_IMAGE=${DATAPLANE_IMAGE:-$DEFAULT_DATAPLANE_IMAGE}" | |
| echo "DASHBOARD_IMAGE=${DASHBOARD_IMAGE:-$DEFAULT_DASHBOARD_IMAGE}" | |
| } >>"${GITHUB_ENV}" | |
| - name: Install Kind tooling | |
| run: scripts/ci/install-kind-tools.sh | |
| - name: Create kind cluster | |
| run: scripts/ci/create-kind-cluster.sh | |
| - name: Install Gateway API CRDs | |
| run: scripts/ci/install-gateway-api-crds.sh | |
| - name: Build current control-plane image | |
| run: scripts/ci/build-controlplane-image.sh | |
| - name: Load images into kind | |
| run: scripts/ci/load-kind-images.sh | |
| - name: Deploy Nantian Gateway | |
| run: scripts/ci/deploy-kind-conformance.sh | |
| - name: Record image versions | |
| run: | | |
| echo "=== Images under test ===" | |
| kubectl get pods -n nantian-gw -o json | jq -r '.items[] | .spec.containers[] | " \(.name): \(.image)"' | |
| echo "=== Image digests ===" | |
| kubectl get pods -n nantian-gw -o json | jq -r '.items[] | .status.containerStatuses[] | " \(.name): \(.imageID)"' | |
| - name: Run smoke test | |
| run: CLUSTER_NAME="$CLUSTER_NAME" ./test/e2e/smoke/run.sh --no-cleanup | |
| - name: Collect diagnostics on failure | |
| if: failure() | |
| run: ARTIFACT_DIR=tmp/e2e-diagnostics scripts/ci/collect-kind-diagnostics.sh | |
| - name: Upload diagnostics | |
| if: failure() | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a | |
| with: | |
| name: e2e-diagnostics-smoke | |
| path: tmp/e2e-diagnostics/ | |
| if-no-files-found: warn | |
| - name: Cleanup | |
| if: always() | |
| run: command -v kind >/dev/null 2>&1 && kind delete cluster --name "$CLUSTER_NAME" || true | |
| scenarios: | |
| name: Scenarios | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| steps: | |
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 | |
| - name: Resolve dependency images | |
| run: | | |
| source scripts/ci/dependency-images.sh | |
| { | |
| echo "DATAPLANE_IMAGE=${DATAPLANE_IMAGE:-$DEFAULT_DATAPLANE_IMAGE}" | |
| echo "DASHBOARD_IMAGE=${DASHBOARD_IMAGE:-$DEFAULT_DASHBOARD_IMAGE}" | |
| } >>"${GITHUB_ENV}" | |
| - name: Install Kind tooling | |
| run: scripts/ci/install-kind-tools.sh | |
| - name: Create kind cluster | |
| run: CLUSTER_NAME="${CLUSTER_NAME}-scenarios" scripts/ci/create-kind-cluster.sh | |
| - name: Install Gateway API CRDs | |
| run: scripts/ci/install-gateway-api-crds.sh | |
| - name: Build current control-plane image | |
| run: scripts/ci/build-controlplane-image.sh | |
| - name: Build echo test image | |
| run: | | |
| cd test/e2e/backend/echo | |
| docker build -t nantian-echo:latest . | |
| - name: Load images into kind | |
| run: CLUSTER_NAME="${CLUSTER_NAME}-scenarios" scripts/ci/load-kind-images.sh | |
| - name: Load echo image into kind | |
| run: kind load docker-image nantian-echo:latest --name "${CLUSTER_NAME}-scenarios" | |
| - name: Deploy Nantian Gateway | |
| run: CLUSTER_NAME="${CLUSTER_NAME}-scenarios" scripts/ci/deploy-kind-conformance.sh | |
| - name: Run e2e scenarios | |
| run: | | |
| export CLUSTER_NAME="${CLUSTER_NAME}-scenarios" | |
| export SKIP_SETUP=true | |
| ECHO_IMAGE=nantian-echo:latest go test -tags=e2e -count=1 -v -timeout 30m ./test/e2e/... | |
| - name: Collect diagnostics on failure | |
| if: failure() | |
| run: ARTIFACT_DIR=tmp/e2e-diagnostics CLUSTER_NAME="${CLUSTER_NAME}-scenarios" scripts/ci/collect-kind-diagnostics.sh | |
| - name: Upload diagnostics | |
| if: failure() | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a | |
| with: | |
| name: e2e-diagnostics-scenarios | |
| path: tmp/e2e-diagnostics/ | |
| if-no-files-found: warn | |
| - name: Cleanup | |
| if: always() | |
| run: command -v kind >/dev/null 2>&1 && kind delete cluster --name "${CLUSTER_NAME}-scenarios" || true | |
| conformance: | |
| name: Conformance | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| steps: | |
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 | |
| - name: Resolve dependency images | |
| run: | | |
| source scripts/ci/dependency-images.sh | |
| { | |
| echo "DATAPLANE_IMAGE=${DATAPLANE_IMAGE:-$DEFAULT_DATAPLANE_IMAGE}" | |
| echo "DASHBOARD_IMAGE=${DASHBOARD_IMAGE:-$DEFAULT_DASHBOARD_IMAGE}" | |
| } >>"${GITHUB_ENV}" | |
| - name: Install Kind tooling | |
| run: scripts/ci/install-kind-tools.sh | |
| - name: Create kind cluster | |
| run: CLUSTER_NAME="${CLUSTER_NAME}-conformance" scripts/ci/create-kind-cluster.sh | |
| - name: Install Gateway API CRDs | |
| run: scripts/ci/install-gateway-api-crds.sh | |
| - name: Build current control-plane image | |
| run: scripts/ci/build-controlplane-image.sh | |
| - name: Load images into kind | |
| run: CLUSTER_NAME="${CLUSTER_NAME}-conformance" scripts/ci/load-kind-images.sh | |
| - name: Deploy Nantian Gateway | |
| run: CLUSTER_NAME="${CLUSTER_NAME}-conformance" scripts/ci/deploy-kind-conformance.sh | |
| - name: Create conformance GatewayClass | |
| run: | | |
| kubectl apply -f - <<'YAML' | |
| apiVersion: gateway.networking.k8s.io/v1 | |
| kind: GatewayClass | |
| metadata: | |
| name: gateway-conformance | |
| spec: | |
| controllerName: gateway.networking.k8s.io/nantian-gw | |
| description: GatewayClass for Gateway API conformance tests | |
| YAML | |
| kubectl wait --for=condition=Accepted gatewayclass/gateway-conformance --timeout=30s || true | |
| - name: Run conformance tests | |
| run: | | |
| go mod download sigs.k8s.io/gateway-api/conformance@v1.5.1 | |
| apply_file="$(go env GOMODCACHE)/sigs.k8s.io/gateway-api/conformance@v1.5.1/utils/kubernetes/apply.go" | |
| chmod u+w "$apply_file" | |
| python3 - "$apply_file" << 'PYEOF' | |
| import sys | |
| path = sys.argv[1] | |
| content = open(path).read() | |
| old = '\t\tuObj.SetResourceVersion(fetchedObj.GetResourceVersion())\n\t\ttlog.Logf(t, "Updating %s %s", uObj.GetName(), uObj.GetKind())\n\t\terr = c.Update(ctx, uObj)' | |
| new = '''\t\tuObj.SetResourceVersion(fetchedObj.GetResourceVersion()) | |
| \t\ttlog.Logf(t, "Updating %s %s", uObj.GetName(), uObj.GetKind()) | |
| \t\tfor i := 0; i < 5; i++ { | |
| \t\t\tif i > 0 { | |
| \t\t\t\ttime.Sleep(time.Duration(1<<i) * 100 * time.Millisecond) | |
| \t\t\t\tlatest := &unstructured.Unstructured{} | |
| \t\t\t\tlatest.SetGroupVersionKind(uObj.GroupVersionKind()) | |
| \t\t\t\tif getErr := c.Get(ctx, client.ObjectKeyFromObject(uObj), latest); getErr != nil { | |
| \t\t\t\t\terr = getErr | |
| \t\t\t\t\tbreak | |
| \t\t\t\t} | |
| \t\t\t\tuObj.SetResourceVersion(latest.GetResourceVersion()) | |
| \t\t\t} | |
| \t\t\terr = c.Update(ctx, uObj) | |
| \t\t\tif err == nil || !apierrors.IsConflict(err) { | |
| \t\t\t\tbreak | |
| \t\t\t} | |
| \t\t}''' | |
| content = content.replace(old, new) | |
| # Add time import | |
| content = content.replace( | |
| '"testing"', | |
| '"testing"\n\t"time"' | |
| ) | |
| open(path, 'w').write(content) | |
| print("Patched apply.go with conflict retry") | |
| PYEOF | |
| CLUSTER_NAME="${CLUSTER_NAME}-conformance" go test -tags=conformance -count=1 -v -timeout 30m ./conformance/ | |
| - name: Collect diagnostics on failure | |
| if: failure() | |
| run: ARTIFACT_DIR=tmp/e2e-diagnostics CLUSTER_NAME="${CLUSTER_NAME}-conformance" scripts/ci/collect-kind-diagnostics.sh | |
| - name: Upload diagnostics | |
| if: failure() | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a | |
| with: | |
| name: e2e-diagnostics-conformance | |
| path: tmp/e2e-diagnostics/ | |
| if-no-files-found: warn | |
| - name: Cleanup | |
| if: always() | |
| run: command -v kind >/dev/null 2>&1 && kind delete cluster --name "${CLUSTER_NAME}-conformance" || true |