Skip to content

Commit

Permalink
feature(integration-tests): Run same gemini command as in SCT
Browse files Browse the repository at this point in the history
In order to be sure everything will work properly inside SCT,
we are adding `integration-tests` CI pipeline, to run the same command
with same arguments on every pull requests and push to the master branch

Signed-off-by: Dusan Malusev <[email protected]>
  • Loading branch information
CodeLieutenant committed Sep 12, 2024
1 parent accfcf2 commit 94e52f3
Show file tree
Hide file tree
Showing 5 changed files with 124 additions and 40 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Gemini Integrations Tests

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name:
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.23"
- name: Build
run: make build
- uses: actions/upload-artifact@v4
with:
name: bin
path: "./bin/gemini"
if-no-files-found: error
retention-days: 1
test:
needs: [build]
runs-on: ubuntu-latest
strategy:
max-parallel: 1
matrix:
gemini-features: ["basic", "normal", "all"]
gemini-concurrency: [16]
oracle-scylla-version: ["6.1.1"]
test-scylla-version: ["6.1.1"]
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
- name: Start ScyllaDB
id: scylla
run: |
make scylla-setup \
SCYLLA_TEST_VERSION=${{ matrix.test-scylla-version }} \
SCYLLA_ORACLE_VERSION=${{ matrix.oracle-scylla-version }}
- name: Test
shell: bash
run: |
make integration-test \
CONCURRENCY=${{ matrix.gemini-concurrency }} \
CQL_FEATURES=${{ matrix.gemini-features }}
- name: Shutdown ScyllaDB
run: |
make scylla-shutdown \
SCYLLA_TEST_VERSION=${{ matrix.test-scylla-version }} \
SCYLLA_ORACLE_VERSION=${{ matrix.oracle-scylla-version }}
- uses: actions/upload-artifact@v4
with:
path: |
./results/gemini_result.log
./results/gemini_seed
if-no-files-found: error
retention-days: 30
72 changes: 53 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
MAKEFILE_PATH := $(abspath $(dir $(abspath $(lastword $(MAKEFILE_LIST)))))

GO111MODULE := on
# GO_UPGRADE - do not remove this comment, used by scripts/go-upgrade.sh
GOOS := $(shell uname | tr '[:upper:]' '[:lower:]')
GOARCH := $(shell go env GOARCH)

DOCKER_COMPOSE_TESTING := scylla
DOCKER_VERSION := latest

ifndef GOBIN
export GOBIN := $(MAKEFILE_PATH)/bin
endif
Expand All @@ -23,26 +25,13 @@ $(GOBIN)/golangci-lint: GOLANGCI_VERSION = 1.60.3
$(GOBIN)/golangci-lint: Makefile
$(call dl_tgz,golangci-lint,https://github.com/golangci/golangci-lint/releases/download/v$(GOLANGCI_VERSION)/golangci-lint-$(GOLANGCI_VERSION)-$(GOOS)-amd64.tar.gz)

.PHONY: check-golangci
check-golangci: $(GOBIN)/golangci-lint
$(GOBIN)/golangci-lint run

# fix-golangci Automated fix for golangci-lint errors.
.PHONY: fix-golangci
fix-golangci: $(GOBIN)/golangci-lint
$(GOBIN)/golangci-lint run --fix

# check Run all static code analysis. (use make fix to attempt automatic fix)
.PHONY: check
check: check-golangci
check: $(GOBIN)/golangci-lint
$(GOBIN)/golangci-lint run

# fix make all static code analysis tools to fix the issues
.PHONY: fix
fix: fix-golangci

.PHONY: test
test:
go test -covermode=atomic -race -coverprofile=coverage.txt -timeout 5m -json -v ./... 2>&1 | gotestfmt -showteststatus
fix: $(GOBIN)/golangci-lint
$(GOBIN)/golangci-lint run --fix

.PHONY: build
build:
Expand All @@ -53,4 +42,49 @@ debug-build:

.PHONY: build-docker
build-docker:
docker build --target production -t scylladb/gemini:latest --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

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

.PHONY: test
test:
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

.PHONY: integration-test
integration-test:
mkdir -p ./results
./bin/gemini \
--fail-fast \
--dataset-size=small \
--seed=$(date +%s | tee ./results/gemini_seed ) \
--test-cluster=$(docker inspect --format='{{ .NetworkSettings.Networks.gemini.IPAddress }}' gemini-test) \
--oracle-cluster=$(docker inspect --format='{{ .NetworkSettings.Networks.gemini.IPAddress }}' gemini-oracle) \
--outfile ./results/gemini_result.log \
--duration $(DURATION) \
--warmup $(WARMUP) \
-m mixed \
--non-interactive \
--cql-features $(CQL_FEATURES) \
--request-timeout 180s \
--connect-timeout 120s \
--async-objects-stabilization-attempts 5 \
--async-objects-stabilization-backoff 500ms \
--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)
6 changes: 2 additions & 4 deletions scripts/docker-compose-cassandra.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.5'

networks:
gemini:
name: gemini
Expand All @@ -17,8 +15,8 @@ services:
gemini:

gemini-test:
image: scylladb/scylla:5.2.2
image: scylladb/scylla:${SCYLLA_TEST_VERSION:-6.1.1}
container_name: gemini-test
command: --smp 2 --memory 1024M --api-address 0.0.0.0
command: --smp 1 --memory 512M --api-address 0.0.0.0
networks:
gemini:
10 changes: 4 additions & 6 deletions scripts/docker-compose-scylla.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.5'

networks:
gemini:
name: gemini
Expand All @@ -11,15 +9,15 @@ networks:

services:
gemini-oracle:
image: scylladb/scylla:5.2.2
image: scylladb/scylla:${SCYLLA_ORACLE_VERSION:-6.1.1}
container_name: gemini-oracle
command: --smp 2 --memory 512M --api-address 0.0.0.0
command: --smp 1 --memory 512M --api-address 0.0.0.0
networks:
gemini:

gemini-test:
image: scylladb/scylla:5.2.2
image: scylladb/scylla:${SCYLLA_TEST_VERSION:-6.1.1}
container_name: gemini-test
command: --smp 2 --memory 512M --api-address 0.0.0.0
command: --smp 1 --memory 512M --api-address 0.0.0.0
networks:
gemini:
11 changes: 0 additions & 11 deletions scripts/prepare-environment.sh

This file was deleted.

0 comments on commit 94e52f3

Please sign in to comment.