[wip] prototype for adding user modes #119
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test flux-restful-api | |
on: | |
pull_request: [] | |
jobs: | |
prepare-container: | |
runs-on: ubuntu-latest | |
outputs: | |
branch: ${{ steps.extract_branch.outputs.branch }} | |
steps: | |
- name: Extract branch name | |
run: echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT | |
id: extract_branch | |
test: | |
runs-on: ubuntu-latest | |
needs: [prepare-container] | |
container: | |
image: ghcr.io/flux-framework/flux-restful-api:latest | |
ports: | |
- 5000 | |
env: | |
INSTALL_BRANCH: ${{ needs.prepare-container.outputs.branch }} | |
INSTALL_REPO: ${{ github.repository }} | |
FLUX_SECRET_KEY: notsosecrethoo | |
FLUX_USER: fluxuser | |
FLUX_TOKEN: "12345" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Dependencies (in case changes) | |
run: pip install -r requirements.txt | |
- name: Run tests | |
run: | | |
pip freeze | |
# Tests for the API with auth disabled | |
flux start pytest -xs tests/test_api.py | |
# Create main user in database | |
export FLUX_USER=fluxuser | |
export FLUX_TOKEN=12345 | |
alembic revision --autogenerate -m "Create intital tables" | |
alembic upgrade head | |
python3 app/db/init_db.py init | |
# Require auth and shared secret key | |
export FLUX_SECRET_KEY=notsosecrethoo | |
export FLUX_REQUIRE_AUTH=true | |
export TEST_AUTH=true | |
# This needs to be run as the flux instance owner | |
# E.g., if it's flux | |
# sudo -u flux flux start pytest -xs tests/test_api.py | |
whoami | |
sudo -u fluxuser flux start pytest -xs tests/test_api.py |