diff --git a/testing/config.cockroach.yml b/testing/config.cockroach.yml new file mode 100644 index 0000000..a2c525f --- /dev/null +++ b/testing/config.cockroach.yml @@ -0,0 +1,39 @@ +env: production + +server: + listen_ipv4: 127.0.0.1 + listen_ipv6: + tls_cert_path: + tls_key_path: + port: 3000 + base_path: / + public_url: http://localhost:3000 + +app: + aggregation_time: '02:15' + report_time_weekly: 'fri,18:00' + heartbeat_max_age: 87600h # 10 years + inactive_days: 7 + custom_languages: + vue: Vue + jsx: JSX + svelte: Svelte + +db: + host: 127.0.0.1 + port: 56257 + user: root + password: + name: defaultdb + dialect: cockroach + charset: + max_conn: 2 + ssl: false + automgirate_fail_silently: false + +security: + password_salt: + insecure_cookies: true + cookie_max_age: 172800 + allow_signup: true + expose_metrics: true diff --git a/testing/docker-compose.yml b/testing/docker-compose.yml index 77cab91..853a8aa 100644 --- a/testing/docker-compose.yml +++ b/testing/docker-compose.yml @@ -9,8 +9,6 @@ services: POSTGRES_DB: "wakapi" PGPORT: 55432 network_mode: host - volumes: - - wakapi-postgres:/var/lib/postgresql/data mysql: image: mysql:8 @@ -21,8 +19,6 @@ services: MYSQL_DATABASE: "wakapi" MYSQL_ROOT_PASSWORD: example network_mode: host - volumes: - - wakapi-mysql:/var/lib/mysql mariadb: image: mariadb:10 @@ -33,10 +29,8 @@ services: MARIADB_DATABASE: "wakapi" MARIADB_ROOT_PASSWORD: example network_mode: host - volumes: - - wakapi-mariadb:/var/lib/mysql -volumes: - wakapi-postgres: {} - wakapi-mysql: {} - wakapi-mariadb: {} + cockroach: + image: cockroachdb/cockroach + entrypoint: '/cockroach/cockroach start-single-node --insecure --sql-addr=:56257' + network_mode: host diff --git a/testing/run_api_tests.sh b/testing/run_api_tests.sh index dccf5e1..ee9f37c 100755 --- a/testing/run_api_tests.sh +++ b/testing/run_api_tests.sh @@ -46,9 +46,8 @@ trap cleanup EXIT # Initialise test data case $1 in - postgres|mysql|mariadb) + postgres|mysql|mariadb|cockroach) docker compose -f "$script_dir/docker-compose.yml" down - docker volume rm "testing_wakapi-$1" docker_down=1 docker compose -f "$script_dir/docker-compose.yml" up --wait -d "$1" @@ -61,8 +60,10 @@ case $1 in db_port=0 if [ "$1" == "postgres" ]; then db_port=55432 + elif [ "$1" == "cockroach" ]; then + db_port=56257 else - db_port=53306 + db_port=26257 fi for _ in $(seq 0 30); do @@ -90,8 +91,8 @@ wait_for_wakapi () { counter=0 echo "Waiting for Wakapi to come up ..." until curl --output /dev/null --silent --get --fail http://localhost:3000/api/health; do - if [ "$counter" -ge 5 ]; then - echo "Waited for 5s, but Wakapi failed to come up ..." + if [ "$counter" -ge 30 ]; then + echo "Waited for 30s, but Wakapi failed to come up ..." exit 1 fi