mirror of
https://github.com/floci-io/floci.git
synced 2026-11-22 21:50:46 -05:00
The Quarkus container build of the native binary failed on Apple Silicon with GraalVM's BranchTargetOutOfBoundsException in a generated AwsQueryController invoker (Quarkus 3.39 turns on -H:+AOTSingleCallsiteInline for Mandrel 25.0.4+), and the packaged image died at startup because the builder links zlib dynamically while ubi9-micro ships no libz.so.1. `make native` passes the same flags CI does (-Ob,-H:-AOTSingleCallsiteInline), stages native/<arch>/ like the workflow, and copies libz.so.1 from the builder image next to the binary, which Dockerfile.native-package now puts on LD_LIBRARY_PATH. The Makefile becomes the entry point for development: help (default), dev, build, test T=, native (container build), native-host (host GraalVM/Mandrel, adding the Mandrel-only flag when native-image reports Mandrel), run-native, native-install (PREFIX, default ~/.local), native-image, native-up/native-down/ native-logs against a new docker/compose.native.yml overlay that carries the five CI compat env vars, clean-sidecars, clean-volumes (a leftover ECR registry volume is re-adopted on start and breaks the CDK bootstrap), compat SUITES= and docker-tests. docker/run-docker-tests.sh gains FLOCI_START=0 and COMPAT_SUITES, validated against the suite list, and its shell test covers both. Docs: installation (native section rewritten), docker-images, CONTRIBUTING, AGENTS.
118 lines
3.6 KiB
Bash
Executable File
118 lines
3.6 KiB
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
# Environment:
|
|
# FLOCI_START=0 skip starting Floci; use the container already running under compose
|
|
# (for example one started by `make native-up`)
|
|
# COMPAT_SUITES="..." space-separated subset of the suite directories below to run
|
|
# (default: all of them), for example "sdk-test-java compat-cdk"
|
|
|
|
# 1. Start Floci
|
|
if [ "${FLOCI_START:-1}" != "0" ]; then
|
|
echo "=== Starting Floci with docker-compose ==="
|
|
docker compose up -d --build
|
|
|
|
# Wait for healthy
|
|
echo "Waiting for Floci to be healthy..."
|
|
# Portable wait without 'timeout' command
|
|
MAX_RETRIES=60
|
|
COUNT=0
|
|
until curl -sf http://localhost:4566/_floci/health >/dev/null 2>&1; do
|
|
if [ $COUNT -ge $MAX_RETRIES ]; then
|
|
echo "Floci failed to become healthy in time"
|
|
exit 1
|
|
fi
|
|
sleep 1
|
|
COUNT=$((COUNT + 1))
|
|
echo -n "."
|
|
done
|
|
echo " Floci is up!"
|
|
else
|
|
echo "=== Using the Floci already running under compose (FLOCI_START=0) ==="
|
|
fi
|
|
|
|
# 2. Network setup (Floci uses floci_default from compose)
|
|
NETWORK="floci_default"
|
|
DOCKER_GID=$(stat -c '%g' /var/run/docker.sock 2>/dev/null || stat -f '%g' /var/run/docker.sock)
|
|
|
|
# Floci's embedded DNS server resolves *.floci → Floci's IP.
|
|
# Passing --dns <floci-ip> to test containers lets the S3 virtual-host client
|
|
# send to <bucket>.floci:4566 which Floci DNS resolves correctly. Without this,
|
|
# Docker's built-in DNS only resolves the exact service name "floci", not
|
|
# wildcard subdomains like my-bucket.floci.
|
|
FLOCI_CONTAINER=$(docker compose ps -q floci 2>/dev/null | head -1)
|
|
FLOCI_IP=$(docker inspect -f "{{.NetworkSettings.Networks.${NETWORK}.IPAddress}}" "$FLOCI_CONTAINER" 2>/dev/null || true)
|
|
|
|
# 3. Test suites
|
|
ALL_SUITES=(
|
|
"sdk-test-python"
|
|
"sdk-test-node"
|
|
"sdk-test-java"
|
|
"sdk-test-go"
|
|
"sdk-test-awscli"
|
|
"compat-cdk"
|
|
"compat-terraform"
|
|
"compat-opentofu"
|
|
)
|
|
if [ -n "${COMPAT_SUITES:-}" ]; then
|
|
read -r -a SUITES <<< "$COMPAT_SUITES"
|
|
for suite in "${SUITES[@]}"; do
|
|
case " ${ALL_SUITES[*]} " in
|
|
*" $suite "*) ;;
|
|
*) echo "unknown suite: $suite (expected one of: ${ALL_SUITES[*]})"; exit 2 ;;
|
|
esac
|
|
done
|
|
else
|
|
SUITES=("${ALL_SUITES[@]}")
|
|
fi
|
|
|
|
# results dir
|
|
mkdir -p test-results
|
|
FAILED=0
|
|
|
|
for suite in "${SUITES[@]}"; do
|
|
echo "=== Running $suite in Docker ==="
|
|
|
|
IMAGE_NAME="compat-$suite"
|
|
|
|
# Build
|
|
if ! docker build -q -t "$IMAGE_NAME" "compatibility-tests/$suite"; then
|
|
echo "Test suite $suite failed to build"
|
|
FAILED=1
|
|
continue
|
|
fi
|
|
|
|
# Build DNS args: if we resolved Floci's IP, inject it as the DNS server so
|
|
# wildcard subdomains like <bucket>.floci resolve inside test containers.
|
|
DNS_ARGS=()
|
|
if [ -n "$FLOCI_IP" ]; then
|
|
DNS_ARGS=(--dns "$FLOCI_IP")
|
|
fi
|
|
|
|
# Per-suite extra args, mirroring .github/workflows/compatibility.yml.
|
|
# sdk-test-java's Lambda hot-reload test needs a host directory that the Docker
|
|
# daemon can bind-mount into the hot-reload Lambda container.
|
|
EXTRA_ARGS=()
|
|
if [ "$suite" = "sdk-test-java" ]; then
|
|
mkdir -p /tmp/floci-hot-reload
|
|
EXTRA_ARGS=(-v /tmp/floci-hot-reload:/tmp/floci-hot-reload -e HOT_RELOAD_BASE_DIR=/tmp/floci-hot-reload)
|
|
fi
|
|
|
|
# Run
|
|
if ! docker run --rm --network "$NETWORK" \
|
|
"${DNS_ARGS[@]}" \
|
|
-e FLOCI_ENDPOINT=http://floci:4566 \
|
|
-e FLOCI_S3_VHOST_ENDPOINT=http://floci:4566 \
|
|
-v "$(pwd)/test-results:/results" \
|
|
-v /var/run/docker.sock:/var/run/docker.sock \
|
|
--group-add "$DOCKER_GID" \
|
|
"${EXTRA_ARGS[@]}" \
|
|
"$IMAGE_NAME"; then
|
|
echo "Test suite $suite failed"
|
|
FAILED=1
|
|
fi
|
|
done
|
|
|
|
echo "=== All Docker tests completed ==="
|
|
exit "$FAILED"
|