Skip to content

Testing locally

lefreud edited this page May 1, 2021 · 4 revisions

Requirements:

  • terraform installed and available in PATH
  • clouds.yaml and OS_CLOUD configured
  • cloudflare API environment variables configured

If you want to run tests and the server locally without Docker:

  1. git clone the repo : git clone https://www.github.com/ComputeCanada/mc-hub.git
  2. Create a virtual environment : python3 -m venv venv
  3. Source the environment: source venv/bin/activate
  4. Install the Python dependencies: pip install -r mc-hub/app/requirements.txt
  5. Create a configuration.json that fits the requirements details in MC-Hub documentation
  6. Create the folder hierarchy: mkdir -p clusters database
  7. Configure the following environment variables:
export MCH_CONFIGURATION_FILE_PATH=$PWD
export MCH_APP_PATH=$PWD/mc-hub/app
export MCH_CLUSTERS_PATH=$PWD/clusters
export MCH_DATABASE_PATH=$PWD/database
  1. Build the frontend:
cd mc-hub/frontend
npm install
npm run build
cd -
  1. Create a link to frontend build:
cd mc-hub
ln -s frontend/dist dist
cd -
  1. Run the backend tests
python -m pytest 
python -m pytest --build-live-cluster
  1. Run the frontend tests
cd mc-hub/frontend
npm run test:unit