Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/get-test-runner.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
on:
workflow_call:
inputs:
runner_type:
description: 'The type of test runners'
required: true
type: string
outputs:
matrix:
description: "The list of runners"
value: ${{ jobs.get_runners.outputs.matrix }}
jobs:
get_runners:
name: "get_platforms type=${{inputs.runner_type}}"
runs-on: ubuntu-24.04
permissions:
contents: read
steps:
- name: SCM Checkout
uses: actions/checkout@v6

- name: Setup Python & Poetry Environment
uses: exasol/python-toolbox/.github/actions/python-environment@v5
with:
python-version: "3.10"
poetry-version: "2.3.0"


- id: set-matrix
run: |
RUNNERS=`poetry run -- nox --non-interactive -s 'get-test-runners' -- --type=$RUNNER_TYPE`
echo "$RUNNERS"
echo "matrix=$RUNNERS" >> "$GITHUB_OUTPUT"
env:
RUNNER_TYPE: ${{ inputs.runner_type }}

- name: Print matrix
run: echo ${{ steps.set-matrix.outputs.matrix }}

outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
7 changes: 7 additions & 0 deletions .github/workflows/slow-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,10 @@ jobs:
permissions:
contents: read
uses: ./.github/workflows/test-db-versions-gpu.yml

# TODO: https://github.com/exasol/integration-tasks/issues/815
# additional-platforms-tests:
# name: Run on additional platforms
# permissions:
# contents: read
# uses: ./.github/workflows/test-db-versions-additional-platforms.yml
48 changes: 48 additions & 0 deletions .github/workflows/test-db-versions-additional-platforms.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Test DB Versions with all tests

# python-version: default as specified
# database-version: Default
# tests: all
# platform: all except default platform
#
# Use the specified default version of python and call nox task run_all_tests for
# all versions of Exasol database currently supported by the ITDE.

on:
workflow_call:

jobs:
get_test_runners:
name: Read all additional test runners
permissions:
contents: read
uses: ./.github/workflows/get-test-runner.yml
with:
runner_type: all_except_default

test-add-platforms-all-tests:
needs: get_test_runners
strategy:
fail-fast: false
matrix:
runner: ${{fromJson(needs.get_test_runners.outputs.matrix)}}
runs-on: ${{matrix.runner}}
permissions:
contents: read
name: Run all tests on ${{matrix.runner}}

steps:
- name: SCM Checkout
uses: actions/checkout@v6

- name: Setup Python & Poetry Environment
uses: exasol/python-toolbox/.github/actions/python-environment@v5
with:
python-version: "3.10"
poetry-version: "2.3.0"

- name: Allow unprivileged user namespaces
run: sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0

- name: Run all tests
run: poetry run -- nox -s run-all-tests -- --test-set=default
19 changes: 16 additions & 3 deletions .github/workflows/test-db-versions-all-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Test DB Versions with all tests
# python-version: default as specified
# database-version: all supported by ITDE
# tests: all
# platform: default
#
# Use the specified default version of python and call nox task run_all_tests for
# all versions of Exasol database currently supported by the ITDE.
Expand All @@ -11,22 +12,34 @@ on:
workflow_call:

jobs:

get_test_runners:
name: Read all additional test runners
permissions:
contents: read
uses: ./.github/workflows/get-test-runner.yml
with:
runner_type: only_default

get_exasol_versions:
name: Read all supported Exasol DB versions
permissions:
contents: read
uses: ./.github/workflows/get-exasol-versions.yml

test-db-versions-all-tests:
needs: get_exasol_versions
needs:
- get_exasol_versions
- get_test_runners
strategy:
fail-fast: false
matrix:
exasol_version: ${{fromJson(needs.get_exasol_versions.outputs.matrix)}}
runs-on: ubuntu-24.04
runner: ${{fromJson(needs.get_test_runners.outputs.matrix)}}
runs-on: ${{matrix.runner}}
permissions:
contents: read
name: Run all tests for Exasol ${{ matrix.exasol_version }}
name: Run all tests for Exasol ${{ matrix.exasol_version }} on ${{matrix.runner}}

steps:
- name: SCM Checkout
Expand Down
18 changes: 15 additions & 3 deletions .github/workflows/test-db-versions-minimal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Test DB Versions with minimal tests
# python-version: default as specified
# database-version: all supported by ITDE
# tests: minimal (subset of all tests)
# platform: all
#
# Use the specified default version of python and call nox task
# run_minimal_tests to execute a few selected tests for all versions of Exasol
Expand All @@ -12,19 +13,30 @@ on:
workflow_call:

jobs:
get_test_runners:
name: Read all additional test runners
permissions:
contents: read
uses: ./.github/workflows/get-test-runner.yml
with:
runner_type: all

get_exasol_versions:
permissions:
contents: read
uses: ./.github/workflows/get-exasol-versions.yml

test-db-versions-minimal:
name: Run Minimal Tests for Exasol ${{ matrix.exasol_version }}
needs: get_exasol_versions
name: Run Minimal Tests for Exasol ${{ matrix.exasol_version }} on ${{matrix.runner}}
needs:
- get_exasol_versions
- get_test_runners
strategy:
fail-fast: false
matrix:
exasol_version: ${{fromJson(needs.get_exasol_versions.outputs.matrix)}}
runs-on: ubuntu-24.04
runner: ${{fromJson(needs.get_test_runners.outputs.matrix)}}
runs-on: ${{matrix.runner}}
permissions:
contents: read
steps:
Expand Down
16 changes: 13 additions & 3 deletions .github/workflows/test-python-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Test Python Versions with all tests
# python-version: All supported Python version
# database-version: Default
# tests: all
# platform: default
#
# Call nox task run_tests for all version of Python as defined in the
# python-toolbox (PTB) using the default version of the Exasol database.
Expand All @@ -11,6 +12,13 @@ on:
workflow_call:

jobs:
get_test_runners:
name: Read all additional test runners
permissions:
contents: read
uses: ./.github/workflows/get-test-runner.yml
with:
runner_type: only_default

build-matrix:
name: Generate Build Matrix
Expand All @@ -19,14 +27,16 @@ jobs:
uses: ./.github/workflows/matrix-python.yml

test-python-version-all-tests:
name: "Run Tests with Python ${{ matrix.python-version }} and Default Exasol Version"
name: "Run Tests with Python ${{ matrix.python-version }} and Default Exasol Version on ${{matrix.runner}}"
permissions:
contents: read
needs: [ build-matrix ]
needs:
- get_test_runners
- build-matrix
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.build-matrix.outputs.matrix) }}
runs-on: ubuntu-24.04
runs-on: ${{ fromJson(needs.get_test_runners.outputs.matrix) }}
steps:
- name: SCM Checkout
uses: actions/checkout@v6
Expand Down
1 change: 1 addition & 0 deletions doc/changes/unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Features

- #558: Added docker-db 2025.1.8
- #583: Added platform support for managed docker images

## Bugs

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
ImageDescription,
ImageInfo,
ImageState,
current_platform,
)
from exasol_integration_test_docker_environment.lib.models.config.build_config import (
build_config,
Expand Down Expand Up @@ -185,6 +186,7 @@ def run_task(self) -> None:
depends_on_images=image_info_of_dependencies,
image_state=None,
image_description=self.image_description,
platform=current_platform(),
)
target_image_target = DockerImageTarget(
self._target_repository_name, image_info.get_target_complete_tag()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,23 @@
from exasol_integration_test_docker_environment.lib.base.info import Info


class Platform(Enum):
X64 = "x64"
ARM_64 = "arm64"


def current_platform() -> Platform:
import platform

supported_platforms = {
"x86_64": Platform.X64,
"amd64": Platform.X64,
"aarch64": Platform.ARM_64,
"arm64": Platform.ARM_64,
}
return supported_platforms[platform.machine()]


class ImageState(Enum):
NOT_EXISTING = auto()
# After analyze phase or if build phase did touch the image
Expand Down Expand Up @@ -62,6 +79,7 @@ def __init__(
build_date_time: datetime = datetime.utcnow(),
image_state: ImageState | None = ImageState.NOT_EXISTING,
depends_on_images: dict[str, "ImageInfo"] | None = None,
platform: Platform | None = None,
) -> None:
self.build_name = build_name
self.date_time = str(build_date_time)
Expand All @@ -80,6 +98,7 @@ def __init__(
self.source_tag = source_tag
self.target_tag = target_tag
self.hash = hash_value
self.platform = platform
self.check_complete_tag_length(self.source_tag)
self.check_complete_tag_length(self.target_tag)

Expand Down Expand Up @@ -111,7 +130,9 @@ def _create_truncated_complete_tag(self, tag: str) -> str:
return truncated_tag

def _create_complete_tag(self, tag):
if self.hash == "":
return f"{tag}"
else:
return f"{tag}_{self.hash}"
tag_elements = [tag]
if self.platform:
tag_elements.append(self.platform.value)
if self.hash:
tag_elements.append(self.hash)
return "_".join(tag_elements)
18 changes: 17 additions & 1 deletion noxconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@
from pathlib import Path

from exasol.toolbox.config import BaseConfig
from pydantic import computed_field
from pydantic import (
BaseModel,
computed_field,
)


class TestRunnersConfig(BaseModel):
default_runner: str
test_runners: list[str]


class Config(BaseConfig):
Expand All @@ -19,10 +27,18 @@ def source_code_path(self) -> Path:
"""
return self.root_path / self.project_name

test_runners_config: TestRunnersConfig


PROJECT_CONFIG = Config(
root_path=Path(__file__).parent,
project_name="exasol_integration_test_docker_environment",
python_versions=("3.10", "3.11", "3.12", "3.13"),
add_to_excluded_python_paths=("resources",),
test_runners_config=TestRunnersConfig(
default_runner="ubuntu-24.04",
test_runners=[
"ubuntu-24.04"
], # TODO https://github.com/exasol/integration-tasks/issues/815
),
)
36 changes: 35 additions & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from exasol.toolbox.nox.tasks import * # type: ignore

# default actions to be run if nothing is explicitly specified with the -s option
nox.options.sessions = ["project:fix"]
nox.options.sessions = ["format:fix"]


class TestSet(Enum):
Expand Down Expand Up @@ -305,3 +305,37 @@ def execute_itde(session: nox.Session):
session.run(
f"{exe_name}", "spawn-test-environment", "--environment-name", "test_01"
)


class TestRunnerType(Enum):
ONLY_DEFAULT = "only_default"
ALL = "all"
ALL_EXCEPT_DEFAULT = "all_except_default"


@nox.session(name="get-test-runners", python=False)
def get_test_runners(session: nox.Session):

p = ArgumentParser(
usage="nox -s get-test-runners -- --type=only_default|all|all_except_default",
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
)
p.add_argument("--type", choices=[str(t.value) for t in TestRunnerType])
args = p.parse_args(session.posargs)

test_runner_config = PROJECT_CONFIG.test_runners_config

if args.type == "only_default":
print(json.dumps(test_runner_config.default_runner))
elif args.type == "all_except_default":
result = [
runner
for runner in test_runner_config.test_runners
if runner != test_runner_config.default_runner
]
print(json.dumps(result))

elif args.type == "all":
print(json.dumps(test_runner_config.test_runners))
else:
raise ValueError(f"Invalid test runner type '{args.type}'")
Loading