|
| 1 | +name: E2E tests |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + |
| 8 | +jobs: |
| 9 | + test: |
| 10 | + name: ${{ matrix.testpath }} |
| 11 | + runs-on: ubuntu-latest |
| 12 | + strategy: |
| 13 | + matrix: |
| 14 | + testpath: |
| 15 | + - ./tests/e2e/v1alpha1/setup/ |
| 16 | + |
| 17 | + steps: |
| 18 | + - name: Checkout code |
| 19 | + uses: actions/checkout@v3 |
| 20 | + |
| 21 | + - name: Build Dockerfile |
| 22 | + run: docker build . --file Dockerfile --tag rocketmq-operator:e2e |
| 23 | + |
| 24 | + - name: Install Chainsaw |
| 25 | + run: | |
| 26 | + curl -L https://github.com/kyverno/chainsaw/releases/download/v0.1.2/chainsaw_linux_amd64.tar.gz -o chainsaw.tar.gz |
| 27 | + tar -xzf chainsaw.tar.gz |
| 28 | + sudo mv chainsaw /usr/local/bin/ |
| 29 | + chainsaw version |
| 30 | +
|
| 31 | + - name: Create k8s Kind Cluster |
| 32 | + run: | |
| 33 | + # install kubectl |
| 34 | + curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" |
| 35 | + chmod +x kubectl |
| 36 | + sudo mv kubectl /usr/local/bin/ |
| 37 | + |
| 38 | + # install kind |
| 39 | + curl -LO https://github.com/kubernetes-sigs/kind/releases/download/v0.20.0/kind-linux-amd64 |
| 40 | + sudo chmod +x kind-linux-amd64 |
| 41 | + sudo mv kind-linux-amd64 /usr/local/bin/kind |
| 42 | + kind version |
| 43 | + |
| 44 | + # create kind cluster |
| 45 | + kind_node_image="kindest/node:v1.23.17" |
| 46 | + echo "Kubernetes version: ${kind_node_image}" |
| 47 | + kind create cluster --config tests/_config/kind-config.yaml |
| 48 | + kubectl version |
| 49 | + kubectl get all --all-namespaces |
| 50 | +
|
| 51 | + - name: Load Docker image into Kind |
| 52 | + run: | |
| 53 | + kubectl cluster-info --context kind-kind |
| 54 | + kind load docker-image rocketmq-operator:e2e --name kind |
| 55 | +
|
| 56 | + - name: Install RocketMQ Operator |
| 57 | + run: | |
| 58 | + make deploy |
| 59 | + kubectl set image deployment/rocketmq-operator manager=rocketmq-operator:e2e -n default |
| 60 | +
|
| 61 | + - name: Wait for RocketMQ Operator to be ready |
| 62 | + run: | |
| 63 | + kubectl wait --for=condition=available --timeout=300s deployment/rocketmq-operator -n default |
| 64 | +
|
| 65 | + - name: Run chainsaw test |
| 66 | + run: chainsaw test --test-dir ${{ matrix.testpath }} --config tests/_config/chainsaw-configuration.yaml |
0 commit comments