From a7529454829682dd81f020669e7645b26df3b1a8 Mon Sep 17 00:00:00 2001 From: Casey Brooks Date: Thu, 21 May 2026 07:49:07 +0000 Subject: [PATCH 1/4] ci: add centralized e2e workflow --- .github/workflows/e2e.yml | 41 +++++++++++++++++++++++++++++++ devspace.yaml | 51 +++------------------------------------ test/e2e/main_test.go | 27 --------------------- test/e2e/threads_test.go | 41 ------------------------------- 4 files changed, 44 insertions(+), 116 deletions(-) create mode 100644 .github/workflows/e2e.yml delete mode 100644 test/e2e/main_test.go delete mode 100644 test/e2e/threads_test.go diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml new file mode 100644 index 0000000..0ba5cf3 --- /dev/null +++ b/.github/workflows/e2e.yml @@ -0,0 +1,41 @@ +name: E2E + +on: + push: + branches: + - main + pull_request: + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: e2e-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }} + cancel-in-progress: true + +jobs: + e2e: + runs-on: ubuntu-latest + timeout-minutes: 60 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Provision cluster + uses: agynio/bootstrap/.github/actions/provision@main + + - name: Setup DevSpace + uses: agynio/e2e/.github/actions/setup-devspace@main + + - name: Deploy threads from source + run: devspace dev + + - name: Run E2E tests + uses: agynio/e2e/.github/actions/run-tests@main + with: + service: threads + + - name: Restore ArgoCD auto-sync + if: always() + run: devspace run-pipeline restore-argocd diff --git a/devspace.yaml b/devspace.yaml index 0af57b9..2814804 100644 --- a/devspace.yaml +++ b/devspace.yaml @@ -2,7 +2,6 @@ version: v2beta1 vars: THREADS_NAMESPACE: platform - E2E_IMAGE: ghcr.io/agynio/devcontainer-go:1 functions: disable_argocd_sync: |- @@ -40,7 +39,7 @@ functions: emptyDir: {} containers: - name: threads - image: ghcr.io/agynio/devcontainer-go:1 # keep in sync with E2E_IMAGE + image: ghcr.io/agynio/devcontainer-go:1 workingDir: /opt/app/data command: - sh @@ -77,26 +76,6 @@ functions: EOF )" -deployments: - e2e-runner: - namespace: ${THREADS_NAMESPACE} - helm: - chart: - name: component-chart - repo: https://charts.devspace.sh - values: - containers: - - image: ${E2E_IMAGE} - env: - - name: THREADS_ADDRESS - value: "threads:50051" - labels: - app.kubernetes.io/name: threads-e2e - -commands: - test:e2e: |- - devspace run-pipeline test:e2e $@ - pipelines: dev: flags: @@ -127,19 +106,9 @@ pipelines: stop_dev threads fi - test:e2e: + restore-argocd: run: |- - create_deployments e2e-runner - start_dev e2e-runner & - sleep 5 - exec_container \ - --label-selector "app.kubernetes.io/name=threads-e2e" \ - -n ${THREADS_NAMESPACE} \ - -- bash -c 'cd /opt/app/data && buf generate buf.build/agynio/api --path agynio/api/threads/v1 --path agynio/api/notifications/v1 --path agynio/api/identity/v1 --path agynio/api/metering/v1 --path agynio/api/authorization/v1 --path agynio/api/agents/v1 && go test -v -count=1 -tags e2e ./test/e2e/' - EXIT_CODE=$? - stop_dev e2e-runner - purge_deployments e2e-runner - exit $EXIT_CODE + restore_argocd_sync hooks: - name: restore-argocd-auto-sync @@ -181,17 +150,3 @@ dev: lastLines: 200 ports: - port: "50051" - - e2e-runner: - namespace: ${THREADS_NAMESPACE} - labelSelector: - app.kubernetes.io/name: threads-e2e - command: ["sleep", "infinity"] - workingDir: /opt/app/data - sync: - - path: ./:/opt/app/data - excludePaths: - - .git/ - - .devspace/ - - /.gen/ - - /tmp/ diff --git a/test/e2e/main_test.go b/test/e2e/main_test.go deleted file mode 100644 index e87b9c2..0000000 --- a/test/e2e/main_test.go +++ /dev/null @@ -1,27 +0,0 @@ -//go:build e2e - -package e2e - -import ( - "os" - "strings" - "testing" -) - -var threadsAddress = envOrDefault("THREADS_ADDRESS", "threads:50051") - -func envOrDefault(key, fallback string) string { - value, ok := os.LookupEnv(key) - if !ok { - return fallback - } - trimmed := strings.TrimSpace(value) - if trimmed == "" { - return fallback - } - return trimmed -} - -func TestMain(m *testing.M) { - os.Exit(m.Run()) -} diff --git a/test/e2e/threads_test.go b/test/e2e/threads_test.go deleted file mode 100644 index c008db1..0000000 --- a/test/e2e/threads_test.go +++ /dev/null @@ -1,41 +0,0 @@ -//go:build e2e - -package e2e - -import ( - "context" - "testing" - "time" - - threadsv1 "github.com/agynio/threads/.gen/go/agynio/api/threads/v1" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/credentials/insecure" - "google.golang.org/grpc/status" -) - -func TestThreadsRejectsMissingParticipant(t *testing.T) { - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) - defer cancel() - - conn, err := grpc.DialContext(ctx, threadsAddress, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock()) - if err != nil { - t.Fatalf("dial threads: %v", err) - } - defer conn.Close() - - client := threadsv1.NewThreadsServiceClient(conn) - - _, err = client.GetThreads(ctx, &threadsv1.GetThreadsRequest{}) - if err == nil { - t.Fatal("expected invalid argument error") - } - - st, ok := status.FromError(err) - if !ok { - t.Fatalf("expected gRPC status error, got %v", err) - } - if st.Code() != codes.InvalidArgument { - t.Fatalf("expected InvalidArgument, got %s: %s", st.Code(), st.Message()) - } -} From 7d9f93f45fa80b9771b4bfb74ef19db2468986c9 Mon Sep 17 00:00:00 2001 From: Casey Brooks Date: Thu, 21 May 2026 08:07:02 +0000 Subject: [PATCH 2/4] fix: patch threads deployment name --- devspace.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devspace.yaml b/devspace.yaml index 2814804..b9a184e 100644 --- a/devspace.yaml +++ b/devspace.yaml @@ -26,7 +26,7 @@ functions: fi patch_deployment: |- echo "Patching threads deployment for DevSpace..." - kubectl patch deployment threads-threads -n ${THREADS_NAMESPACE} --type strategic --patch "$(cat <<'EOF' + kubectl patch deployment threads -n ${THREADS_NAMESPACE} --type strategic --patch "$(cat <<'EOF' spec: template: spec: From a889784e479a16b0b174e2b0e1031b1ed6fa7f91 Mon Sep 17 00:00:00 2001 From: Casey Brooks Date: Thu, 21 May 2026 08:30:51 +0000 Subject: [PATCH 3/4] fix: let devspace readiness run --- devspace.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/devspace.yaml b/devspace.yaml index b9a184e..e5d2151 100644 --- a/devspace.yaml +++ b/devspace.yaml @@ -88,7 +88,8 @@ pipelines: if [ "$(get_flag "watch")" == "true" ]; then start_dev --disable-pod-replace threads else - start_dev --disable-pod-replace threads + start_dev --disable-pod-replace threads & + DEVSPACE_PID=$! echo "Waiting for threads to be healthy on :50051..." healthy=false for i in $(seq 1 60); do @@ -104,6 +105,7 @@ pipelines: fi echo "Dev environment ready. Stopping dev session." stop_dev threads + wait "$DEVSPACE_PID" fi restore-argocd: From e851cd36c2ba46aaa1054dc33a03a4f0e91439a8 Mon Sep 17 00:00:00 2001 From: Casey Brooks Date: Thu, 21 May 2026 09:04:06 +0000 Subject: [PATCH 4/4] fix: use shell available in dev image --- devspace.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devspace.yaml b/devspace.yaml index e5d2151..9cdcbd1 100644 --- a/devspace.yaml +++ b/devspace.yaml @@ -93,7 +93,7 @@ pipelines: echo "Waiting for threads to be healthy on :50051..." healthy=false for i in $(seq 1 60); do - if exec_container --label-selector=app.kubernetes.io/name=threads -n ${THREADS_NAMESPACE} -- bash -c 'nc -z localhost 50051 >/dev/null 2>&1 || (echo > /dev/tcp/localhost/50051) >/dev/null 2>&1'; then + if kubectl exec deployment/threads -n ${THREADS_NAMESPACE} -c threads -- sh -c 'nc -z localhost 50051 >/dev/null 2>&1 || (echo > /dev/tcp/localhost/50051) >/dev/null 2>&1' 2>/dev/null; then healthy=true break fi