Skip to content

test: Add unit test case and fix workflow failure #12

test: Add unit test case and fix workflow failure

test: Add unit test case and fix workflow failure #12

Workflow file for this run

name: test
on:
push:
branches: [ main ]
tags:
- '*'
pull_request:
branches: [ main ]
jobs:
build:
name: Lint, Build and Image
runs-on: ubuntu-latest
timeout-minutes: 10
env:
GOPATH: /home/runner/go
steps:
- name: "Step 1: Checkout repository"
uses: actions/checkout@v3
with:
fetch-depth: '0'
- name: "Step 2: Run prerequisite steps"
run: |
echo "IMAGE_TAG=$(git describe --tags --always)" >> $GITHUB_ENV
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.55.0
- name: "Step 3: Setup Golang"
uses: actions/setup-go@v4.0.0
with:
go-version: '1.21'
- name: "Step 4: Restore Go build cache"
uses: actions/cache@v3
with:
path: ~/.cache/go-build
key: ${{ runner.os }}-go-build-v1-${{ hashFiles('**/go.mod') }}
- name: "Step 5: Run Lint"
run: make lint
- name: "Step 6: Build and create docker image"
run: make image
env:
TAG: "${{ env.IMAGE_TAG }}"
- name: "Step 7: Docker Login"
if: startsWith(github.ref, 'refs/tags/v')
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAYIO_USERNAME }}
password: ${{ secrets.QUAYIO_PASSWORD }}
- name: "Step 8: Build docker image"
if: startsWith(github.ref, 'refs/tags/v')
run: docker push "quay.io/numaio/numaproj-contrib/aws-sqs-sink-go:${{ env.IMAGE_TAG }}"
- name: "Step 9: Store docker image"
run: |
docker tag "quay.io/numaio/numaproj-contrib/aws-sqs-sink-go:${{ env.IMAGE_TAG }}" "quay.io/numaio/numaproj-contrib/aws-sqs-sink-go:sqs-e2e"
docker save -o /tmp/aws-sqs-queue-image.tar "quay.io/numaio/numaproj-contrib/aws-sqs-sink-go:sqs-e2e"
- name: "Step 10: Upload docker artifact"
uses: actions/upload-artifact@v3
with:
name: aws-sqs-queue
path: /tmp/aws-sqs-queue-image.tar
e2e:
name: Run E2E test
needs:
- build
runs-on: ubuntu-latest
timeout-minutes: 10
env:
GOPATH: /home/runner/go
steps:
- name: "Step 1: Checkout repository"
uses: actions/checkout@v3
- name: "Step 2: Download docker artifact"
uses: actions/download-artifact@v3
with:
name: aws-sqs-queue
path: /tmp
- name: "Step 3: Setup Golang"
uses: actions/setup-go@v4.0.0
with:
go-version: '1.21'
- name: "step 4: Add bins to PATH"
run: |
echo /home/runner/go/bin >> $GITHUB_PATH
echo /usr/local/bin >> $GITHUB_PATH
- name: "Step 5: Install k3d"
run: curl -s https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash
- name: "Step 6: Create a registry and a cluster"
run: |
k3d registry create e2e-registry --port 5111
k3d cluster create e2e --registry-use k3d-e2e-registry:5111
k3d kubeconfig get e2e > ~/.kube/numaflow-e2e-config
echo '127.0.0.1 k3d-e2e-registry' | sudo tee -a /etc/hosts
- name: "Step 7: Load image in cluster"
run: |
docker load --input /tmp/aws-sqs-queue-image.tar
k3d image import "quay.io/numaio/numaproj-contrib/aws-sqs-sink-go:sqs-e2e" --cluster e2e
- name: "Step 8: Install Numaflow"
env:
KUBECONFIG: ~/.kube/numaflow-e2e-config
run: KUBECONFIG=~/.kube/numaflow-e2e-config make install-numaflow
- name: "step 9: Run E2E tests"
env:
KUBECONFIG: ~/.kube/numaflow-e2e-config
# These values are for moto configuration, ref: https://docs.getmoto.org/en/latest/
AWS_REGION: "us-east-1"
AWS_ACCESS_KEY_ID: "testing"
AWS_SECRET_ACCESS_KEY: "testing"
AWS_ENDPOINT_URL: "http://localhost:5000"
run: KUBECONFIG=~/.kube/numaflow-e2e-config make test-e2e