From 5fdd2bf6b3361b409189f894fee5885da88cdc28 Mon Sep 17 00:00:00 2001 From: WenyXu Date: Mon, 20 May 2024 14:46:28 +0000 Subject: [PATCH] ci: add Fuzz Test for distributed mode --- .github/actions/setup-etcd-cluster/action.yml | 23 +++++++++++++++ .../setup-greptimedb-cluster/action.yml | 27 +++-------------- .github/workflows/develop.yml | 29 ++++++++++++++++++- 3 files changed, 55 insertions(+), 24 deletions(-) create mode 100644 .github/actions/setup-etcd-cluster/action.yml diff --git a/.github/actions/setup-etcd-cluster/action.yml b/.github/actions/setup-etcd-cluster/action.yml new file mode 100644 index 000000000000..802218cff8dc --- /dev/null +++ b/.github/actions/setup-etcd-cluster/action.yml @@ -0,0 +1,23 @@ +name: Setup Etcd cluster +description: Deploy Etcd cluster on Kubernetes +inputs: + etcd-replica-count: + default: 1 + description: "Etcd replica count" + namespace: + default: "etcd-cluster" + +runs: + using: composite + steps: + - name: Install etcd cluster + shell: bash + run: | + helm upgrade \ + --install etcd oci://registry-1.docker.io/bitnamicharts/etcd \ + --set replicaCount=${{ inputs.etcd-replica-count }} \ + --set auth.rbac.create=false \ + --set auth.rbac.token.enabled=false \ + --set persistence.size=1Gi \ + --create-namespace \ + -n ${{ input.namespace }} \ No newline at end of file diff --git a/.github/actions/setup-greptimedb-cluster/action.yml b/.github/actions/setup-greptimedb-cluster/action.yml index 65529886454f..d95573676818 100644 --- a/.github/actions/setup-greptimedb-cluster/action.yml +++ b/.github/actions/setup-greptimedb-cluster/action.yml @@ -22,6 +22,9 @@ inputs: image-tag: default: "latest" description: 'Image tag' + etcd-endpoints: + default: "etcd.etcd-cluster.svc.cluster.local:2379" + description: "Etcd endpoints" runs: using: composite @@ -36,34 +39,12 @@ runs: --create-namespace \ greptimedb-operator greptime/greptimedb-operator \ -n greptimedb-admin - - name: Install etcd cluster - shell: bash - run: | - helm upgrade \ - --install etcd oci://registry-1.docker.io/bitnamicharts/etcd \ - --set replicaCount=${{ inputs.etcd-replica-count }} \ - --set auth.rbac.create=false \ - --set auth.rbac.token.enabled=false \ - --set persistence.size=1Gi \ - --create-namespace \ - -n etcd-cluster - - name: Wait for etcd - shell: bash - run: | - kubectl wait \ - --for=condition=Ready \ - pod -l app.kubernetes.io/instance=etcd \ - --timeout=120s \ - -n etcd-cluster - - name: Print etcd info - shell: bash - run: kubectl get all --show-labels -n etcd-cluster - name: Install GreptimeDB cluster shell: bash run: | helm upgrade \ --install my-greptimedb \ - --set meta.etcdEndpoints=etcd.etcd-cluster.svc.cluster.local:2379 \ + --set meta.etcdEndpoints=${{ inputs.etcd-endpoints }} \ --set image.registry=${{ inputs.image-registry }} \ --set image.repository=${{ inputs.image-repository }} \ --set image.tag=${{ inputs.image-tag }} \ diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml index 61339087c607..d08847d550a7 100644 --- a/.github/workflows/develop.yml +++ b/.github/workflows/develop.yml @@ -270,13 +270,19 @@ jobs: artifacts-dir: bin version: current - e2e: + distributed-fuzztest: + name: Fuzz Test (Distributed) runs-on: ubuntu-latest needs: build-greptime-ci + strategy: + matrix: + target: [ "fuzz_create_table", "fuzz_alter_table", "fuzz_create_database", "fuzz_create_logical_table", "fuzz_alter_logical_table", "fuzz_insert", "fuzz_insert_logical_table" ] steps: - uses: actions/checkout@v4 - name: Setup Kind uses: ./.github/actions/setup-kind + - name: Setup Etcd cluser + uses: ./.github/actions/setup-etcd-cluster - name: Download pre-built binariy uses: actions/download-artifact@v4 with: @@ -284,12 +290,33 @@ jobs: path: . - name: Unzip binary run: tar -xvf ./bin.tar.gz + - name: Wait for etcd + run: | + kubectl wait \ + --for=condition=Ready \ + pod -l app.kubernetes.io/instance=etcd \ + --timeout=120s \ + -n etcd-cluster + - name: Print etcd info + shell: bash + run: kubectl get all --show-labels -n etcd-cluster - name: Build and push GreptimeDB image uses: ./.github/actions/build-and-push-ci-image - name: Setup GreptimeDB cluster uses: ./.github/actions/setup-greptimedb-cluster with: image-registry: localhost:5001 + - name: Port forward (mysql) + run: | + kubectl port-forward service/my-greptimedb-frontend 4002:4002 -n my-greptimedb& + - name: Fuzz Test + uses: ./.github/actions/fuzz-test + env: + CUSTOM_LIBFUZZER_PATH: /usr/lib/llvm-14/lib/libFuzzer.a + GT_MYSQL_ADDR: 127.0.0.1:4002 + with: + target: ${{ matrix.target }} + max-total-time: 120 sqlness: name: Sqlness Test