Skip to content

fix: remove the useless test #329

fix: remove the useless test

fix: remove the useless test #329

Workflow file for this run

# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: Run hstream operator test cases
concurrency:
group: test-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
## For update codecov.io
branches:
- main
paths-ignore:
- "**.md"
pull_request:
branches:
- main
paths-ignore:
- "**.md"
workflow_dispatch:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
- uses: golangci/golangci-lint-action@v3
with:
## TODO: https://github.com/golangci/golangci-lint-action/issues/759
version: v1.52.2
args: --timeout=5m
- name: Check manifests
run: |
make manifests
if ! git diff --quiet; then
echo "Need to run: make manifests"
exit 1
fi
- name: Check generate
run: |
make generate
if ! git diff --quiet; then
echo "Need to run: make generate"
exit 1
fi
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
testMode:
- e2e-test
- unit-test
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
- name: Run unit tests that don't depend on a real k8s cluster
if: matrix.testMode == 'unit-test'
run: make test
- name: Setup minikube
if: matrix.testMode == 'e2e-test'
uses: medyagh/setup-minikube@v0.0.14
- name: Install hmeta cluster
if: matrix.testMode == 'e2e-test'
uses: ./.github/actions/deploy-hmeta
# FIXME: use make command to run e2e tests
- name: Install ginkgo
if: matrix.testMode == 'e2e-test'
run: go install github.com/onsi/ginkgo/v2/ginkgo
- name: Run e2e tests that depend on an existing k8s cluster
if: matrix.testMode == 'e2e-test'
env:
USE_EXISTING_CLUSTER: true
# Set label filter 'k8s' to ignore the test cases that don't deponed on a real k8s cluster
run: ginkgo run --cover --covermode=atomic -coverpkg=./... --coverprofile ./cover.out --label-filter 'k8s' internal/controller/
- name: Report code coverage
uses: codecov/codecov-action@v3
with:
files: ./cover.out # optional
fail_ci_if_error: true # optional (default = false)
verbose: true # optional (default = false)
deployment:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
install:
- yaml
- yaml_with_external_hmeta
- helm
steps:
- uses: actions/checkout@v4
- name: Setup minikube
uses: medyagh/setup-minikube@v0.0.14
- uses: ./.github/actions/deploy-hmeta
if: matrix.install == 'yaml_with_external_hmeta'
- name: Build image
run: |
eval $(minikube docker-env)
make docker-build
- name: Deploy controller by yaml
if: matrix.install == 'yaml'
run: make deploy
- name: Deploy controller by helm
if: matrix.install != 'yaml'
run: |
helm install hstream-operator deploy/charts/hstream-operator \
--set image.tag=latest \
--namespace hstream-operator-system \
--create-namespace
- name: Check operator
timeout-minutes: 5
run: |
set -euo pipefail
while [ "$(kubectl get pods -l 'control-plane=hstream-operator-manager' -n hstream-operator-system -o json | jq '.items[0].status.containerStatuses[] | select(.ready==true) | .containerID')" = "" ]; do
echo "waiting operator controller pod running"
sleep 5
done
- name: Deploy a minimal hstreamdb cluster
if: matrix.install == 'yaml'
run: |
kubectl apply -f config/samples/hstreamdb.yaml
- name: Deploy a complete hstreamdb cluster
if: matrix.install == 'helm'
run: |
kubectl apply -f config/samples/hstreamdb_complete_sample.yaml
- name: Deploy a hstreamdb cluster with an external hmeta cluster
if: matrix.install == 'yaml_with_external_hmeta'
run: |
kubectl apply -f config/samples/hstreamdb_with_external_hmeta.yaml
- name: Check hstream custom resource status
timeout-minutes: 5
shell: bash
run: |
while
condition="$(kubectl get hstreamdb -n hstreamdb hstreamdb-sample -o json | jq '.status.conditions[] | select(.type == "Ready" and .status == "True")')";
[[ "$condition" == "null" ]] || [[ "$condition" == "" ]]
do
echo "waiting hstreamdb ready"
sleep 5
done
- uses: ./.github/actions/deploy-client
if: matrix.install != 'yaml'
timeout-minutes: 5
- if: failure()
run: kubectl describe po hstream-operator-controller-manager -n hstream-operator-system
- if: failure()
run: kubectl logs -l "control-plane=hstream-operator-manager" -n hstream-operator-system --tail=1000
- if: failure()
run: kubectl describe hstreamdb -n hstreamdb hstreamdb-sample
- if: failure()
run: kubectl get pods -A