From b11b3e1e637138921612f8b59831e05947c84e55 Mon Sep 17 00:00:00 2001 From: paulobressan Date: Thu, 27 Jun 2024 11:20:04 -0300 Subject: [PATCH] chore(github): moved test integration to test workflow as a job --- .github/workflows/integration.yml | 48 ------------------------------- .github/workflows/test.yml | 38 ++++++++++++++++++++++++ test/expect | 1 + 3 files changed, 39 insertions(+), 48 deletions(-) delete mode 100644 .github/workflows/integration.yml diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml deleted file mode 100644 index e600742..0000000 --- a/.github/workflows/integration.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: Integration Testing - -on: - push: - branches: - - main - pull_request: - branches: - - main - -jobs: - test: - services: - zookeeper: - image: confluentinc/cp-zookeeper:latest - options: >- - --env ZOOKEEPER_CLIENT_PORT=2181 - - kafka: - image: confluentinc/cp-kafka:latest - ports: - - 9092:9092 - options: >- - --env KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181 - --env KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://kafka:29092,PLAINTEXT_HOST://localhost:9092 - - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Create k8s Kind Cluster - uses: helm/kind-action@v1.10.0 - with: - cluster_name: "k8scluster" - - - name: Build RPC - run: docker build -t rpc:1.0 -f docker/dockerfile.rpc . - - - name: Load Docker Image - run: kind load docker-image rpc:1.0 --name k8scluster - - - name: Apply main manifest - run: kubectl apply -f test/main.yaml - - - name: Validate controller - run: ./test/expect - diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8af7d17..e3338fe 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,3 +20,41 @@ jobs: - name: Run Unit Tests run: cargo test --lib + + integration: + services: + zookeeper: + image: confluentinc/cp-zookeeper:latest + options: >- + --env ZOOKEEPER_CLIENT_PORT=2181 + + kafka: + image: confluentinc/cp-kafka:latest + ports: + - 9092:9092 + options: >- + --env KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181 + --env KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://kafka:29092,PLAINTEXT_HOST://localhost:9092 + + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Create k8s Kind Cluster + uses: helm/kind-action@v1.10.0 + with: + cluster_name: "k8scluster" + + - name: Build RPC + run: docker build -t rpc:1.0 -f docker/dockerfile.rpc . + + - name: Load Docker Image + run: kind load docker-image rpc:1.0 --name k8scluster + + - name: Apply main manifest + run: kubectl apply -f test/main.yaml + + - name: Validate controller + run: ./test/expect + diff --git a/test/expect b/test/expect index b222102..fd1cb09 100755 --- a/test/expect +++ b/test/expect @@ -5,6 +5,7 @@ echo "Checking executation" while [ $ATTEMPT -lt $MAX_ATTEMPT ]; do let ATTEMPT=ATTEMPT+1 kubectl get pod -n demeter-rpc + kubectl logs -n demeter-rpc $(kubectl get pods -n demeter-rpc -o json | jq -r '.items | sort_by(.metadata.creationTimestamp) | .[0].metadata.name') sleep 2 done