Skip to content

Add profile for new pulp-ui #579

Add profile for new pulp-ui

Add profile for new pulp-ui #579

Workflow file for this run

---
name: Integration tests
on:
pull_request:
branches:
- '**'
push:
branches:
- '**'
workflow_dispatch:
jobs:
docs:
uses: "./.github/workflows/docs-ci.yml"
integration:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
TEST: docker
# - os: ubuntu-latest
# TEST: podman
# - os: macos-12
# TEST: docker
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
path: "oci_env"
- uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Set environment variables
run: |
echo "TEST=${{ matrix.TEST }}" >> $GITHUB_ENV
echo "COMPOSE_INTERACTIVE_NO_CLI=1" >> $GITHUB_ENV
#echo "OCI_ENV_PATH=${GITHUB_WORKSPACE}/oci_env/" >> $GITHUB_ENV
- name: clone pulpcore, pulp-openapi-generator
run: |
git clone --depth 1 https://github.com/pulp/pulpcore.git
git clone --depth 1 https://github.com/pulp/pulp-openapi-generator.git
- name: Install podman compose
if: matrix.TEST == 'podman' && matrix.os == 'ubuntu-latest'
run: |
sudo apt update
sudo apt install -y httpie podman
sudo pip install podman-compose
podman --version
- name: (Mac) Install docker compose
if: matrix.TEST == 'docker' && matrix.os == 'macos-12'
uses: docker-practice/[email protected]
- name: setup .compose.env files
run: |
cp oci_env/.github/assets/${TEST}_compose.env oci_env/compose.env
cp oci_env/.github/assets/${TEST}_compose.env ${PWD}/custom.env
echo "API_PORT=7210" >> ${PWD}/custom.env
echo "DOCS_PORT=12346" >> ${PWD}/custom.env
echo "COMPOSE_PROJECT_NAME=my_2nd_project" >> ${PWD}/custom.env
echo "SECOND_SERVICE_PORT=7002" >> ${PWD}/custom.env
- name: setup test profiles
run: |
cp -r oci_env/.github/assets/profiles/* oci_env/profiles/
- name: install oci-env cli
run: |
pip install -e oci_env/client/
- name: Build and run the environment
run: |
oci-env compose build
oci-env compose up -d
oci-env -e custom.env compose up -d
- name: Wait for the stack to spin up
run: |
oci-env poll --wait 15 --attempts 30
oci-env -e custom.env poll --wait 5 --attempts 5
- name: Create some dummy data with the pulp CLI (retry up to 5 times because it's sometimes not actually ready)
run: for i in $(seq 1 5); do oci-env pulp file repository create --name test1 && s=0 && break || s=$? && sleep 5; done; (exit $s)
- name: Snapshot the DB
run: oci-env db snapshot
- name: Create some dummy data with the pulp CLI
run: oci-env -v pulp file repository create --name test2
- name: Test DB restore. Test that test1 exists and test2 doesn't
run: |
oci-env db restore
oci-env pulp file repository show --name test1
if oci-env pulp file repository show --name test2; then false; fi
- name: Test DB Reset. Test that test1 and test2 are gone
run: |
oci-env db reset
if oci-env pulp file repository show --name test1; then false; fi
if oci-env pulp file repository show --name test2; then false; fi
- name: Test that the correct plugins are installed and that the API_ROOT was successfully changed.
run: |
curl localhost:5001/my/custom/api/api/v3/status/ | jq -r '.versions[]|select (.component=="core").component=="core"'
curl localhost:5001/my/custom/api/api/v3/status/ | jq -r '.versions[]|select (.component=="file").component=="file"'
- name: Test that the second instance of oci-env is running correctly.
run: |
curl localhost:7210/my/custom/api/api/v3/status/ | jq -r '.versions[]|select (.component=="core").component=="core"'
curl localhost:7210/my/custom/api/api/v3/status/ | jq -r '.versions[]|select (.component=="file").component=="file"'
- name: Test functional tests
run: |
oci-env -v generate-client -i
oci-env -v generate-client -i pulp_file
oci-env -v test -i -p pulpcore functional -k test_labels
- name: Test lint
run: oci-env -v test -i -p pulpcore lint
- name: Test unit
run: oci-env test -i -p pulpcore unit
- name: Test profile init scripts
run: |
oci-env exec cat /tmp/test_file1
oci-env exec cat /tmp/test_file2
- name: Test profile env vars
run: oci-env exec printenv | grep hello2
- name: Test default variables
run: |
oci-env exec printenv | grep hi_default
oci-env exec printenv | grep howdy_default
- name: Test profile custom compose definitions
run: |
curl localhost:8002 | grep test
curl localhost:7002 | grep test
- name: Print settings
run: oci-env exec dynaconf list
- name: Pass service name to exec
run: oci-env exec -s pulp ls
- name: Pass service name + number to exec
run: |
if [[ -f "/Applications/Docker.app/Contents/Resources/bin/docker" ]]; then
oci-env exec -s pulp-1 ls
else
oci-env exec -s pulp_1 ls
fi
- name: Test profile generation
run: |
oci-env profile init _test_profile
# Test that files were created correctly
ls oci_env/profiles/_test_profile/ | grep README.md
ls oci_env/profiles/_test_profile/ | grep init.sh
ls oci_env/profiles/_test_profile/ | grep pulp_config.env
ls oci_env/profiles/_test_profile/ | grep compose.yaml
ls oci_env/profiles/_test_profile/ | grep profile_requirements.txt
ls oci_env/profiles/_test_profile/ | grep profile_default_config.env
- name: Test profile ls
run: oci-env profile ls | grep _test_profile
- name: Test profile docs
run: oci-env profile docs _test_profile | grep Usage
- name: Print server logs (1st instance)
if: always()
run: oci-env compose logs
- name: Print server logs (2nd instance)
if: always()
run: oci-env -e custom.env compose logs