2020-05-19 20:48:10 +02:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
|
2021-12-21 17:08:14 +01:00
|
|
|
|
2022-01-03 15:26:54 +01:00
|
|
|
export DEBUG=1
|
|
|
|
export NO_RESTART_LOOP=1
|
|
|
|
export CYPRESS_BASE_URL=http://localhost:8080
|
|
|
|
export OPT_OUT_CAPTURE=1
|
|
|
|
export SECURE_COOKIES=0
|
|
|
|
export PRIMARY_DB=clickhouse
|
|
|
|
export SKIP_SERVICE_VERSION_REQUIREMENTS=1
|
|
|
|
export KAFKA_URL=kafka://kafka:9092
|
|
|
|
export CLICKHOUSE_DATABASE=posthog_test
|
|
|
|
export TEST=1 # Plugin server and kafka revert to 'default' Clickhouse database if TEST is not set
|
|
|
|
export CLICKHOUSE_SECURE=0
|
|
|
|
export E2E_TESTING=1
|
|
|
|
export SECRET_KEY=e2e_test
|
|
|
|
export EMAIL_HOST=email.test.posthog.net
|
|
|
|
export SITE_URL=test.posthog.net
|
|
|
|
export REDIS_URL=redis://localhost/
|
|
|
|
DATABASE="posthog_e2e_test"
|
2021-12-21 17:08:14 +01:00
|
|
|
export PGHOST="${PGHOST:=localhost}"
|
|
|
|
export PGUSER="${PGUSER:=posthog}"
|
|
|
|
export PGPASSWORD="${PGPASSWORD:=posthog}"
|
|
|
|
export PGPORT="${PGPORT:=5432}"
|
|
|
|
export DATABASE_URL="postgres://${PGUSER}:${PGPASSWORD}@${PGHOST}:${PGPORT}/${DATABASE}"
|
|
|
|
|
2022-01-03 15:26:54 +01:00
|
|
|
nc -z localhost 9092 || ( echo -e "\033[0;31mKafka isn't running. Please run\n\tdocker compose -f ee/docker-compose.ch.arm64.yml up zookeeper kafka clickhouse db redis\nI'll wait while you do that.\033[0m" ; bin/check_kafka_clickhouse_up )
|
|
|
|
wget -nv -t1 --spider 'http://localhost:8123/' || ( echo -e "\033[0;31mClickhouse isn't running. Please run\n\tdocker compose -f ee/docker-compose.ch.arm64.yml up zookeeper kafka clickhouse db redis.\nI'll wait while you do that.\033[0m" ; bin/check_kafka_clickhouse_up )
|
|
|
|
|
|
|
|
|
|
|
|
trap "trap - SIGTERM && yarn remove cypress cypress-terminal-report @cypress/react @cypress/webpack-preprocessor && kill -- -$$" SIGINT SIGTERM EXIT
|
|
|
|
|
2021-12-21 17:08:14 +01:00
|
|
|
dropdb --if-exists $DATABASE
|
|
|
|
createdb $DATABASE
|
2021-02-26 15:50:21 +01:00
|
|
|
|
2022-01-03 15:26:54 +01:00
|
|
|
# Delete and recreate clickhouse database
|
|
|
|
python manage.py shell --command="from ee.clickhouse.client import sync_execute;sync_execute('drop database if exists posthog_test');sync_execute('create database posthog_test')"
|
|
|
|
|
|
|
|
python manage.py migrate
|
|
|
|
python manage.py migrate_clickhouse
|
|
|
|
|
|
|
|
## parallel block
|
|
|
|
python manage.py setup_dev &
|
|
|
|
yarn add cypress@6.7.0 cypress-terminal-report@2.1.0 @cypress/react@4.16.4 @cypress/webpack-preprocessor@5.7.0 & wait
|
|
|
|
|
|
|
|
## parallel block
|
|
|
|
./bin/plugin-server &
|
2021-02-26 15:50:21 +01:00
|
|
|
# Only start webpack if not already running
|
|
|
|
nc -vz 127.0.0.1 8234 2> /dev/null || ./bin/start-frontend &
|
2022-01-03 15:26:54 +01:00
|
|
|
npx cypress open --config-file cypress.e2e.json &
|
|
|
|
python manage.py runserver 8080
|
2021-02-26 15:50:21 +01:00
|
|
|
|
2022-01-03 15:26:54 +01:00
|
|
|
## Will be called once killed
|
2021-04-08 19:14:06 +02:00
|
|
|
yarn remove cypress cypress-terminal-report @cypress/react @cypress/webpack-preprocessor
|