This repository allows managing Gencovery Web Services packages. It is used to create docker images to easily deploy GLab.
-
Shell script
init_lab.shis run by the dockerfile entrypoint -
Python script
init_lab.pyis called by theinit_lab.shand allows pulling and intalling from Pip and Git any library described in an environment fileconfig.jsonas given in foldertests/fixtures/config.json
-
Install dependencies:
pip install -r requirements.txt
-
Create a
.envfile at project root with the following variables (optional for git pull tests):COMMUNITY_API_URL=<your_api_url>
The project uses pytest for testing. Tests are organized in a standard structure:
tests/
├── unit/ # Unit tests
├── integration/ # Integration tests
├── fixtures/ # Test data and configuration
└── conftest.py # Shared fixtures
Run all tests:
pytestRun specific test categories:
# Run only unit tests
pytest -m unit
# Run only integration tests
pytest -m integration
# Run tests in a specific file
pytest tests/unit/test_gpm.py
# Run tests with verbose output
pytest -v
# Run tests with coverage report (requires pytest-cov)
pytest --cov=init --cov-report=htmlRun tests in VS Code:
- Use the Testing sidebar (flask icon)
- Tests are automatically discovered based on the
pytest.iniconfiguration - Click individual tests or test classes to run them
Tests are automatically marked based on their location and can also use custom markers:
@pytest.mark.unit- Unit tests (auto-applied to tests/unit/*)@pytest.mark.integration- Integration tests (auto-applied to tests/integration/*)@pytest.mark.slow- Slow-running tests@pytest.mark.requires_network- Tests requiring network access@pytest.mark.requires_git- Tests requiring git operations
Filter tests by markers:
# Skip slow tests
pytest -m "not slow"
# Run only network tests
pytest -m requires_networkTesting the glab image locally : docker build -t glab:latest -f ./dockerfile/glab/Dockerfile .
Testing the codelab image locally : docker build -t codelab:codelab -f ./dockerfile/codelab/Dockerfile .
Coding using the dev-env image : docker build -t lab-dev-env -f ./dockerfile/lab-dev-env/Dockerfile .
To run and tests the images, see lab-configurer repository.
Testing the glab image locally : docker build --build-arg IMAGE="nvidia/cuda:12.4.1-runtime-ubuntu22.04" -t glab:gpu -f ./dockerfile/glab/Dockerfile .
Testing the codelab image locally : docker build --build-arg IMAGE="glab:gpu" -t local-codelab -f ./dockerfile/codelab/Dockerfile .
Create a new docker context for builder instance to use
docker context create builder-context
Create a builder instance named "builderx"
docker buildx create --name builderx --driver docker-container --use builder-context
docker buildx build -t glab:latest -f ./dockerfile/glab/Dockerfile --platform linux/amd64,linux/arm64 .