Files
git.stella-ops.org/ops/wine-csp/tests/docker-test.sh
StellaOps Bot 11597679ed
Some checks failed
AOC Guard CI / aoc-guard (push) Has been cancelled
AOC Guard CI / aoc-verify (push) Has been cancelled
Concelier Attestation Tests / attestation-tests (push) Has been cancelled
Docs CI / lint-and-preview (push) Has been cancelled
Policy Lint & Smoke / policy-lint (push) Has been cancelled
Scanner Analyzers / Discover Analyzers (push) Has been cancelled
Scanner Analyzers / Build Analyzers (push) Has been cancelled
Scanner Analyzers / Test Language Analyzers (push) Has been cancelled
Scanner Analyzers / Validate Test Fixtures (push) Has been cancelled
Scanner Analyzers / Verify Deterministic Output (push) Has been cancelled
console-runner-image / build-runner-image (push) Has been cancelled
wine-csp-build / Build Wine CSP Image (push) Has been cancelled
wine-csp-build / Integration Tests (push) Has been cancelled
wine-csp-build / Security Scan (push) Has been cancelled
wine-csp-build / Generate SBOM (push) Has been cancelled
wine-csp-build / Publish Image (push) Has been cancelled
wine-csp-build / Air-Gap Bundle (push) Has been cancelled
wine-csp-build / Test Summary (push) Has been cancelled
feat: Implement BerkeleyDB reader for RPM databases
- Added BerkeleyDbReader class to read and extract RPM header blobs from BerkeleyDB hash databases.
- Implemented methods to detect BerkeleyDB format and extract values, including handling of page sizes and magic numbers.
- Added tests for BerkeleyDbReader to ensure correct functionality and header extraction.

feat: Add Yarn PnP data tests

- Created YarnPnpDataTests to validate package resolution and data loading from Yarn PnP cache.
- Implemented tests for resolved keys, package presence, and loading from cache structure.

test: Add egg-info package fixtures for Python tests

- Created egg-info package fixtures for testing Python analyzers.
- Included PKG-INFO, entry_points.txt, and installed-files.txt for comprehensive coverage.

test: Enhance RPM database reader tests

- Added tests for RpmDatabaseReader to validate fallback to legacy packages when SQLite is missing.
- Implemented helper methods to create legacy package files and RPM headers for testing.

test: Implement dual signing tests

- Added DualSignTests to validate secondary signature addition when configured.
- Created stub implementations for crypto providers and key resolvers to facilitate testing.

chore: Update CI script for Playwright Chromium installation

- Modified ci-console-exports.sh to ensure deterministic Chromium binary installation for console exports tests.
- Added checks for Windows compatibility and environment variable setups for Playwright browsers.
2025-12-07 16:24:45 +02:00

115 lines
2.5 KiB
Bash

#!/bin/bash
# Wine CSP Docker Build and Test
#
# Builds the Wine CSP Docker image and runs the full test suite.
# This script is designed for local development and CI/CD pipelines.
#
# Usage:
# ./docker-test.sh # Build and test
# ./docker-test.sh --no-build # Test existing image
# ./docker-test.sh --push # Build, test, and push if tests pass
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "${SCRIPT_DIR}/../../.." && pwd)"
# Configuration
IMAGE_NAME="${WINE_CSP_IMAGE:-wine-csp}"
IMAGE_TAG="${WINE_CSP_TAG:-test}"
FULL_IMAGE="${IMAGE_NAME}:${IMAGE_TAG}"
DOCKERFILE="${PROJECT_ROOT}/ops/wine-csp/Dockerfile"
DO_BUILD=true
DO_PUSH=false
VERBOSE=false
# Parse arguments
while [[ $# -gt 0 ]]; do
case $1 in
--no-build)
DO_BUILD=false
shift
;;
--push)
DO_PUSH=true
shift
;;
--verbose|-v)
VERBOSE=true
shift
;;
--image)
IMAGE_NAME="$2"
FULL_IMAGE="${IMAGE_NAME}:${IMAGE_TAG}"
shift 2
;;
--tag)
IMAGE_TAG="$2"
FULL_IMAGE="${IMAGE_NAME}:${IMAGE_TAG}"
shift 2
;;
*)
echo "Unknown option: $1"
exit 1
;;
esac
done
log() {
echo "[$(date -u '+%Y-%m-%dT%H:%M:%SZ')] $*"
}
# Build image
if [[ "${DO_BUILD}" == "true" ]]; then
log "Building Wine CSP Docker image: ${FULL_IMAGE}"
log "Dockerfile: ${DOCKERFILE}"
log "Context: ${PROJECT_ROOT}"
build_args=""
if [[ "${VERBOSE}" == "true" ]]; then
build_args="--progress=plain"
fi
docker build \
${build_args} \
-f "${DOCKERFILE}" \
-t "${FULL_IMAGE}" \
"${PROJECT_ROOT}"
log "Build completed successfully"
fi
# Verify image exists
if ! docker image inspect "${FULL_IMAGE}" > /dev/null 2>&1; then
echo "Error: Image ${FULL_IMAGE} not found"
exit 1
fi
# Run tests
log "Running integration tests..."
test_args=""
if [[ "${VERBOSE}" == "true" ]]; then
test_args="--verbose"
fi
"${SCRIPT_DIR}/run-tests.sh" --image "${FULL_IMAGE}" ${test_args} --ci
# Check test results
if [[ $? -ne 0 ]]; then
log "Tests failed!"
exit 1
fi
log "All tests passed!"
# Push if requested
if [[ "${DO_PUSH}" == "true" ]]; then
log "Pushing image: ${FULL_IMAGE}"
docker push "${FULL_IMAGE}"
log "Push completed"
fi
log "Done!"