Skip to content

About

No description or website provided.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

222 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Qubership Testing Platform Common Scripts

ATP3 submodule for ATP3-runners that contains base Bash scripts.

Modular Test Execution Scripts

This directory contains modular scripts for test execution in containerized environments.

Architecture Overview

The test execution process is divided into modular components that can be easily maintained and reused across different runtime environments.

Core Modules

  • init.sh - Environment initialization and secure AWS/S3 configuration
  • git-clone.sh - Shallow git clone --depth 1 with optional submodule init (clears Git token)
  • render-environment-configuration.sh - Renders environment-configuration/environment-configuration-template.json under PROJECT_DIR.
  • runtime-setup.sh - Runtime-specific environment setup
  • test-runner.sh - Test execution and results collection (clears sensitive vars)
  • upload-monitor.sh - Event-based upload monitoring and finalization
  • native-report.sh - Save native runner report to attachments folder

Runtime-Specific Modules

Located in runtimes/ directory for different technology stacks:

  • Python: runtimes/python-setup.sh
  • Playwright: runtimes/playwright-setup.sh

Usage

Main Entrypoint

The main entrypoint.sh in the root directory coordinates all modules:

#!/bin/bash
set -e

# Import modular components
source /scripts/init.sh
source /scripts/git-clone.sh
source /scripts/runtime-setup.sh
source /scripts/test-runner.sh
source /scripts/upload-results.sh

# Execute main workflow
init_environment
clone_repository
setup_runtime_environment
run_tests
upload_results

Benefits of root-level entrypoint:

  • Easy customization per image without conflicts
  • Can add image-specific logic before/after main workflow
  • Clear separation between image-specific and shared logic

Customizing Entrypoint for Specific Images

You can create image-specific entrypoints by copying and modifying the base entrypoint:

Example: Custom Python Entrypoint

#!/bin/bash
set -e

# Image-specific setup
echo "🐍 Python-specific initialization..."
export PYTHONUNBUFFERED=1

# Import and execute shared modules
source /scripts/init.sh
source /scripts/git-clone.sh
source /scripts/runtime-setup.sh
source /scripts/test-runner.sh
source /scripts/upload-results.sh

# Execute main workflow
init_environment
clone_repository
setup_runtime_environment
run_tests
upload_results

# Image-specific cleanup
echo "🐍 Python-specific cleanup completed"

Example: Custom Playwright Entrypoint

#!/bin/bash
set -e

# Image-specific setup
echo "🎭 Playwright-specific initialization..."
export DISPLAY=:99

# Import and execute shared modules
source /scripts/init.sh
source /scripts/git-clone.sh
source /scripts/runtime-setup.sh
source /scripts/test-runner.sh
source /scripts/upload-results.sh

# Execute main workflow
init_environment
clone_repository
setup_runtime_environment
run_tests
upload_results

# Image-specific cleanup
echo "🎭 Playwright-specific cleanup completed"

Creating Runtime-Specific Images

Python Image

FROM python:3.9
COPY scripts/ /scripts/
COPY runtimes/python-setup.sh /scripts/runtime-setup.sh
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

Playwright Image

FROM mcr.microsoft.com/playwright:v1.40.0
COPY scripts/ /scripts/
COPY runtimes/playwright-setup.sh /scripts/runtime-setup.sh
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

Environment Variables

Required Variables

  • ATP_TESTS_GIT_REPO_URL - Git repository URL
  • ATP_TESTS_GIT_REPO_BRANCH - Branch to clone
  • ATP_TESTS_GIT_TOKEN - Git access token
  • ATP_STORAGE_BUCKET - S3 bucket name
  • ATP_STORAGE_USERNAME - S3 access key
  • ATP_STORAGE_PASSWORD - S3 secret key
  • ENVIRONMENT_NAME - Environment name
  • ATP_STORAGE_PROVIDER - Storage type (aws or minio or s3)

Optional Variables

  • ATP_TESTS_GIT_MODULES_IGNORE - Boolean; true skips recursive Git submodule initialization, while false (the default) initializes submodules. Only true and false are supported
  • CURRENT_DATE - Override current date
  • CURRENT_TIME - Override current time
  • ATP_STORAGE_SERVER_URL - MinIO API host
  • ATP_STORAGE_SERVER_UI_URL - S3 UI URL
  • PAUSE_BEFORE_END - Pause before container exit
  • UPLOAD_METHOD - Upload method: cp (file-based) or sync (directory-based, triggered by inotifywait)
  • DEBUG_HTTP_MODE - Set to true to keep HTTP attachments for passed Newman tests; by default, passed-test attachments are removed before upload

The Newman runner uses cp upload mode by default so Allure attachments can be pruned after the run and before the final S3 upload. Other runner images retain their own upload-mode defaults.

Benefits

  1. Modularity - Each component has a single responsibility
  2. Reusability - Common logic shared across different runtime images
  3. Maintainability - Easy to update specific functionality
  4. Flexibility - Easy to add new runtime support
  5. Testing - Individual modules can be tested separately
  6. Security - Sensitive credentials are cleared from environment during test execution
  7. Real-time upload - Results are uploaded as they are generated using inotifywait
  8. Flexible upload methods - Choose between file-based (cp) or directory-based (sync) upload, both triggered by inotifywait

Adding New Runtime Support

  1. Create runtime-specific setup script in runtimes/
  2. Create runtime-specific test runner if needed
  3. Update Dockerfile to copy appropriate modules
  4. Test with your specific runtime environment

Tests

The Bats tests under tests/ run in CI (.github/workflows/tests.yaml) and need no runner image:

  • tests/smoke/ checks that every shell script parses (bash -n), that every JavaScript tool parses (node --check), that no script defines a function twice, and that each script can be sourced in a clean shell and defines the functions listed in tests/smoke/manifest.txt. A script added to the repository must be added to the manifest too.
  • tests/unit/ holds unit tests for helpers that do not belong to a single runner, such as parse-extra-vars.sh. Tests for one runner's behavior live in that runner's repository.

To run them locally, install Bats and run bats --recursive tests from the repository root. jq and node are optional: the tests that need them are skipped when they are missing.

About

No description or website provided.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages