mirror of
https://github.com/apache/superset.git
synced 2026-04-19 16:14:52 +00:00
feat: Added setup for running Cypress tests in docker locally (#11207)
* Working configuration * Fixes * Set database volume directory. Added info in CONTRIBUTING how to avoid malformed database in tests.
This commit is contained in:
committed by
GitHub
parent
1afe91579e
commit
6311a9ec8c
@@ -42,3 +42,4 @@ REDIS_PORT=6379
|
||||
FLASK_ENV=development
|
||||
SUPERSET_ENV=development
|
||||
SUPERSET_LOAD_EXAMPLES=yes
|
||||
CYPRESS_CONFIG=false
|
||||
|
||||
@@ -19,7 +19,13 @@
|
||||
set -eo pipefail
|
||||
|
||||
REQUIREMENTS_LOCAL="/app/docker/requirements-local.txt"
|
||||
|
||||
# If Cypress run – overwrite the password for admin and export env variables
|
||||
if [ "$CYPRESS_CONFIG" == "true" ]; then
|
||||
export SUPERSET_CONFIG=tests.superset_test_config
|
||||
export SUPERSET_TESTENV=true
|
||||
export ENABLE_REACT_CRUD_VIEWS=true
|
||||
export SUPERSET__SQLALCHEMY_DATABASE_URI=postgresql+psycopg2://superset:superset@db:5432/superset
|
||||
fi
|
||||
#
|
||||
# Make sure we have dev requirements installed
|
||||
#
|
||||
|
||||
@@ -37,22 +37,29 @@ Init Step ${1}/${STEP_CNT} [${2}] -- ${3}
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
ADMIN_PASSWORD="admin"
|
||||
# If Cypress run – overwrite the password for admin and export env variables
|
||||
if [ "$CYPRESS_CONFIG" == "true" ]; then
|
||||
ADMIN_PASSWORD="general"
|
||||
export SUPERSET_CONFIG=tests.superset_test_config
|
||||
export SUPERSET_TESTENV=true
|
||||
export ENABLE_REACT_CRUD_VIEWS=true
|
||||
export SUPERSET__SQLALCHEMY_DATABASE_URI=postgresql+psycopg2://superset:superset@db:5432/superset
|
||||
fi
|
||||
# Initialize the database
|
||||
echo_step "1" "Starting" "Applying DB migrations"
|
||||
superset db upgrade
|
||||
echo_step "1" "Complete" "Applying DB migrations"
|
||||
|
||||
# Create an admin user
|
||||
echo_step "2" "Starting" "Setting up admin user ( admin / admin )"
|
||||
echo_step "2" "Starting" "Setting up admin user ( admin / $ADMIN_PASSWORD )"
|
||||
superset fab create-admin \
|
||||
--username admin \
|
||||
--firstname Superset \
|
||||
--lastname Admin \
|
||||
--email admin@superset.com \
|
||||
--password admin
|
||||
--password $ADMIN_PASSWORD
|
||||
echo_step "2" "Complete" "Setting up admin user"
|
||||
|
||||
# Create default roles and permissions
|
||||
echo_step "3" "Starting" "Setting up roles and perms"
|
||||
superset init
|
||||
@@ -61,6 +68,12 @@ echo_step "3" "Complete" "Setting up roles and perms"
|
||||
if [ "$SUPERSET_LOAD_EXAMPLES" = "yes" ]; then
|
||||
# Load some data to play with
|
||||
echo_step "4" "Starting" "Loading examples"
|
||||
superset load_examples
|
||||
# If Cypress run which consumes superset_test_config – load required data for tests
|
||||
if [ "$CYPRESS_CONFIG" == "true" ]; then
|
||||
superset load_test_users
|
||||
superset load_examples --load-test-data
|
||||
else
|
||||
superset load_examples
|
||||
fi
|
||||
echo_step "4" "Complete" "Loading examples"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user