From eb4ac6be02b35adb755b46c64fa46f7ce84ef16f Mon Sep 17 00:00:00 2001 From: Dusan Malusev Date: Wed, 23 Oct 2024 11:53:45 +0200 Subject: [PATCH 1/2] fix(gh-actions): Upload gemini results to github 1. When we run integrations tests, there was a bug when uploading gemini results to github actifacts. Issue was in `Makefile`, path to the `./results` is relative to the `./bin` directory from where `gemini` is run. This directory does not exist in `./bin`. Easy fix is just to use `$(PWD)`. 2. Modified the command for `integrations-tests` to match whats running inside SCT (mainly added `--schema-seed` to be the same as the `--seed`). 3. We migrated to `Makefile` fully, there is no need to have `./scripts` They are broken, and all commands have been migrated. Signed-off-by: Dusan Malusev --- .github/workflows/integration-tests.yml | 14 ++-- Makefile | 68 ++++++++++++------- .../docker-compose-cassandra.yml | 0 {scripts => docker}/docker-compose-scylla.yml | 0 scripts/compile-and-install-gemini.sh | 9 --- scripts/run-gemini-test.sh | 25 ------- scripts/test.sh | 26 ------- 7 files changed, 52 insertions(+), 90 deletions(-) rename {scripts => docker}/docker-compose-cassandra.yml (100%) rename {scripts => docker}/docker-compose-scylla.yml (100%) delete mode 100755 scripts/compile-and-install-gemini.sh delete mode 100755 scripts/run-gemini-test.sh delete mode 100755 scripts/test.sh diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 1b068c96..9bac6413 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -32,14 +32,17 @@ jobs: matrix: gemini-features: ["basic", "normal", "all"] gemini-concurrency: [16] - oracle-scylla-version: ["6.1.1"] - test-scylla-version: ["6.1.1"] + duration: ["5m"] + dataset-size: [large, small] + oracle-scylla-version: ["6.1"] + test-scylla-version: ["6.1"] fail-fast: false steps: - uses: actions/checkout@v4 - uses: actions/download-artifact@v4 - name: Start ScyllaDB id: scylla + shell: bash run: | chmod +x ./bin/gemini make scylla-setup \ @@ -51,16 +54,19 @@ jobs: make integration-test \ CONCURRENCY=${{ matrix.gemini-concurrency }} \ CQL_FEATURES=${{ matrix.gemini-features }} \ - DURATION=5m + DURATION=${{ matrix.duration }} \ + DATASET_SIZE=${{ matrix.dataset-size }} \ - name: Shutdown ScyllaDB + shell: bash run: | make scylla-shutdown \ SCYLLA_TEST_VERSION=${{ matrix.test-scylla-version }} \ SCYLLA_ORACLE_VERSION=${{ matrix.oracle-scylla-version }} - uses: actions/upload-artifact@v4 + if: always() with: - name: results-${{ matrix.gemini-features }}-${{ matrix.gemini-concurrency }} + name: results-${{ matrix.gemini-features }}-${{ matrix.gemini-concurrency }}-${{ matrix.duration }}-${{ matrix.dataset-size }}-${{ matrix.test-scylla-version }}-${{ matrix.oracle-scylla-version }}-${{ github.run_number }} path: ./results if-no-files-found: error retention-days: 30 diff --git a/Makefile b/Makefile index 018f8fd4..07b0259d 100644 --- a/Makefile +++ b/Makefile @@ -35,57 +35,73 @@ fix: $(GOBIN)/golangci-lint .PHONY: build build: - CGO_ENABLED=0 go build -ldflags="-s -w" -o bin/gemini ./cmd/gemini + @CGO_ENABLED=0 go build -o bin/gemini ./cmd/gemini debug-build: - CGO_ENABLED=0 go build -gcflags "all=-N -l" -o bin/gemini ./cmd/gemini + @CGO_ENABLED=0 go build -ldflags="-asan" -gcflags "all=-N -l" -o bin/gemini ./cmd/gemini .PHONY: build-docker build-docker: - docker build --target production -t scylladb/gemini:$(DOCKER_VERSION) --compress . + @docker build --target production -t scylladb/gemini:$(DOCKER_VERSION) --compress . .PHONY: scylla-setup scylla-setup: - @docker compose -f scripts/docker-compose-$(DOCKER_COMPOSE_TESTING).yml up -d + @docker compose -f docker/docker-compose-$(DOCKER_COMPOSE_TESTING).yml up -d until docker logs gemini-oracle 2>&1 | grep "Starting listening for CQL clients" > /dev/null; do sleep 0.2; done until docker logs gemini-test 2>&1 | grep "Starting listening for CQL clients" > /dev/null; do sleep 0.2; done .PHONY: scylla-shutdown scylla-shutdown: - docker compose -f scripts/docker-compose-$(DOCKER_COMPOSE_TESTING).yml down --volumes + docker compose -f docker/docker-compose-$(DOCKER_COMPOSE_TESTING).yml down --volumes .PHONY: test test: - go test -covermode=atomic -race -coverprofile=coverage.txt -timeout 5m -json -v ./... 2>&1 | gotestfmt -showteststatus + @go test -covermode=atomic -race -coverprofile=coverage.txt -timeout 5m -json -v ./... 2>&1 | gotestfmt -showteststatus -CQL_FEATURES := normal -CONCURRENCY := 1 -DURATION := 10m -WARMUP := 1m +CQL_FEATURES ?= normal +CONCURRENCY ?= 16 +DURATION ?= 1m +WARMUP ?= 1m +DATASET_SIZE ?= large +SEED ?= $(shell date +%s | tee ./results/gemini_seed) .PHONY: integration-test -integration-test: - mkdir -p ./results - touch ./results/gemini_seed - ./bin/gemini \ +integration-test: debug-build + @mkdir -p $(PWD)/results + @touch $(PWD)/results/gemini_seed + @./bin/gemini \ + --dataset-size=$(DATASET_SIZE) \ + --seed=$(SEED) \ + --schema-seed=$(SEED) \ + --cql-features $(CQL_FEATURES) \ + --duration $(DURATION) \ + --warmup $(WARMUP) \ + --drop-schema true \ --fail-fast \ - --dataset-size=small \ - --seed=$(shell date +%s | tee ./results/gemini_seed) \ + --level info \ + --non-interactive \ + --materialized-views false \ + --consistency LOCAL_QUORUM \ + --outfile $(PWD)/results/gemini.log \ + --test-statement-log-file $(PWD)/results/gemini_test_statements.log \ + --oracle-statement-log-file $(PWD)/results/gemini_oracle_statements.log \ + --test-host-selection-policy token-aware \ + --oracle-host-selection-policy token-aware \ --test-cluster=$(shell docker inspect --format='{{ .NetworkSettings.Networks.gemini.IPAddress }}' gemini-test) \ --oracle-cluster=$(shell docker inspect --format='{{ .NetworkSettings.Networks.gemini.IPAddress }}' gemini-oracle) \ - --outfile ./results/gemini_result.log \ - --duration $(DURATION) \ - --warmup $(WARMUP) \ - -m mixed \ + --outfile $(PWD)/results/gemini_result.log \ + --mode mixed \ --non-interactive \ - --cql-features $(CQL_FEATURES) \ --request-timeout 180s \ --connect-timeout 120s \ - --async-objects-stabilization-attempts 5 \ - --async-objects-stabilization-backoff 500ms \ + --consistency LOCAL_QUORUM \ + --use-server-timestamps false \ + --async-objects-stabilization-attempts 10 \ + --async-objects-stabilization-backoff 100ms \ --replication-strategy "{'class': 'NetworkTopologyStrategy', 'replication_factor': '1'}" \ --oracle-replication-strategy "{'class': 'NetworkTopologyStrategy', 'replication_factor': '1'}" \ - --max-mutation-retries 10 \ - --max-mutation-retries-backoff 500ms \ - -c $(CONCURRENCY) + --max-mutation-retries 5 \ + --max-mutation-retries-backoff 1000ms \ + --concurrency $(CONCURRENCY) \ + --tracing-outfile $(PWD)/results/gemini_tracing.log diff --git a/scripts/docker-compose-cassandra.yml b/docker/docker-compose-cassandra.yml similarity index 100% rename from scripts/docker-compose-cassandra.yml rename to docker/docker-compose-cassandra.yml diff --git a/scripts/docker-compose-scylla.yml b/docker/docker-compose-scylla.yml similarity index 100% rename from scripts/docker-compose-scylla.yml rename to docker/docker-compose-scylla.yml diff --git a/scripts/compile-and-install-gemini.sh b/scripts/compile-and-install-gemini.sh deleted file mode 100755 index 38bd5d21..00000000 --- a/scripts/compile-and-install-gemini.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -function quit () { - echo $2 - exit $1 -} - -go mod download || quit $? "Downloading dependencies failed" -go install ./... || quit $? "Compilation failed" diff --git a/scripts/run-gemini-test.sh b/scripts/run-gemini-test.sh deleted file mode 100755 index 952dcbd6..00000000 --- a/scripts/run-gemini-test.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -set -e - -ORACLE_NAME=gemini-oracle -TEST_NAME=gemini-test - -ORACLE_IP=$(docker inspect --format='{{ .NetworkSettings.Networks.gemini.IPAddress }}' ${ORACLE_NAME}) -TEST_IP=$(docker inspect --format='{{ .NetworkSettings.Networks.gemini.IPAddress }}' ${TEST_NAME}) - -GEMINI_CMD=gemini -SEED=$(date +%s%N) -ABS_GEMINI_PATH=$(whereis ${GEMINI_CMD}) -ABS_GEMINI_PATH=${ABS_GEMINI_PATH//gemini: /} - -GOBIN="$(dirname $ABS_GEMINI_PATH)" -$GEMINI_CMD \ - --duration=10m \ - --fail-fast \ - --seed=${SEED} \ - --dataset-size=small \ - --test-cluster=${TEST_IP} \ - --oracle-cluster=${ORACLE_IP} \ - "$@" -exit $? diff --git a/scripts/test.sh b/scripts/test.sh deleted file mode 100755 index 69303209..00000000 --- a/scripts/test.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh - -test_gemini() { - echo -n "Compile gemini" - ./scripts/compile-and-install-gemini.sh || exit 1 - oracle="scylla" - if [ "$1" = "cassandra" ]; then - oracle="cassandra" - shift - fi - - echo -n "Preparing environment with $oracle as oracle" - ./scripts/prepare-environment.sh $oracle || exit 1 - - echo -n "Running test with $oracle as oracle for 'gemini $@' ... " - ./scripts/run-gemini-test.sh --drop-schema -c 8 $@ - if [ $? -eq 0 ]; then - echo "OK" - else - echo "FAILED" - fi - - exit $? -} - -test_gemini $@ From a262a44a925b3b58bcf915fd4617aaebed482aa7 Mon Sep 17 00:00:00 2001 From: Dusan Malusev Date: Wed, 23 Oct 2024 13:16:35 +0200 Subject: [PATCH 2/2] feature(ci): try to run 4 integration tests in parallel Signed-off-by: Dusan Malusev --- .github/workflows/integration-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 9bac6413..019e8b0f 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -28,7 +28,7 @@ jobs: needs: [build] runs-on: ubuntu-latest strategy: - max-parallel: 1 + max-parallel: 4 matrix: gemini-features: ["basic", "normal", "all"] gemini-concurrency: [16]