Skip to content

A per-tenant subscription cache, and cache sync between broker instances over mongo change streams #2300

A per-tenant subscription cache, and cache sync between broker instances over mongo change streams

A per-tenant subscription cache, and cache sync between broker instances over mongo change streams #2300

# Renamed from test-latest to mintaka-compatibility
name: Mintaka compatibility
on:
pull_request:
paths:
- src/**
- docker/Dockerfile-ubi
- docker/Dockerfile-ubi-base
- docker/build-ubi/**
workflow_dispatch:
jobs:
mintaka-compatibility:
runs-on: ubuntu-latest
services:
registry:
image: registry:2
ports:
- 5000:5000
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: network=host
- name: Build and push to local registry
uses: docker/build-push-action@v5
with:
push: true
file: docker/Dockerfile-ubi
tags: localhost:5000/orion-ld:latest
- uses: actions/checkout@v4
with:
repository: fiware/mintaka
- name: Patch dead context URL in Mintaka tests
run: |
# Replace dead schema.lab.fiware.org URL with raw GitHub URL from Orion-LD repo
find . -name "*.java" -exec sed -i 's|https://schema.lab.fiware.org/ld/context|https://raw.githubusercontent.com/FIWARE/context.Orion-LD/develop/test/functionalTest/contexts/schema_lab_fiware_org_ld_context.jsonld|g' {} +
# Verify the replacement
grep -r "schema_lab_fiware_org" --include="*.java" || echo "URL replaced successfully"
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Upgrade Testcontainers for Docker 29+ compatibility
run: |
# Mintaka uses Testcontainers 1.15.1 (Docker API v1.30) which is too old
# for the runner's Docker engine (Docker 29+ requires API v1.44+)
sed -i 's|<version.org.testcontainers>[^<]*</version.org.testcontainers>|<version.org.testcontainers>1.21.3</version.org.testcontainers>|' pom.xml
grep testcontainers pom.xml | head -2
- name: Patch Mintaka startup timeout
run: |
# DockerComposeContainer.start() has a default 60s startup timeout which is
# too short for Orion-LD + MongoDB + TimescaleDB on GitHub Actions runners.
# Add withStartupTimeout to give containers 5 minutes to start.
# Add required imports for Duration and ChronoUnit
sed -i '1,/^import/{s/^import/import java.time.Duration;\nimport java.time.temporal.ChronoUnit;\nimport/}' src/test/java/org/fiware/mintaka/ComposeTest.java
# Add withStartupTimeout call
sed -i 's|.withExposedService("timescale", TIMESCALE_PORT);|.withExposedService("timescale", TIMESCALE_PORT)\n\t\t\t.withStartupTimeout(Duration.of(5, ChronoUnit.MINUTES));|' src/test/java/org/fiware/mintaka/ComposeTest.java
echo "=== Patched ComposeTest.java ==="
grep -A2 "withStartupTimeout\|withExposedService\|import java.time" src/test/java/org/fiware/mintaka/ComposeTest.java
- name: Patch Mintaka docker-compose
run: |
# Use our local image (avoids testcontainers variable substitution bugs)
find . -name "docker-compose*.yml" -exec sed -i 's|\${ORION_IMAGE:-[^}]*}|localhost:5000/orion-ld:latest|g' {} +
# Upgrade MongoDB from 4.0 to 4.4 (Orion-LD requires MongoDB 4.2+)
find . -name "docker-compose*.yml" -exec sed -i 's|mongo:4\.0|mongo:4.4|g' {} +
echo "=== Patched docker-compose ==="
find . -name "docker-compose*.yml" -exec cat {} \;
- name: Pre-pull images
run: |
# Pre-pull the orion-ld image so testcontainers doesn't timeout pulling it
docker pull localhost:5000/orion-ld:latest
docker images | grep orion
docker compose version
- name: Verify orion-ld image
run: |
docker run --rm localhost:5000/orion-ld:latest -u
- name: Set Docker API version for Testcontainers
run: |
# Docker 29+ requires API v1.44+, tell docker-java to use it
mkdir -p src/test/resources
echo "api.version=1.44" > src/test/resources/docker-java.properties
cat src/test/resources/docker-java.properties
- name: Run tests
run: mvn clean test -B -ntp
env:
ORION_IMAGE: localhost:5000/orion-ld:latest
TESTCONTAINERS_RYUK_DISABLED: true
- name: Show container logs on failure
if: failure()
run: |
echo "=== Docker containers (all) ==="
docker ps -a
echo "=== Recent container logs ==="
for c in $(docker ps -aq | head -10); do
echo "--- Container $c ($(docker inspect --format '{{.Name}} {{.Config.Image}}' $c)) ---"
docker logs $c 2>&1 | tail -100 || true
done
echo "=== Docker events (last 2 minutes) ==="
docker events --since 2m --until 0s 2>&1 | head -50 || true