Files
container-openldap/build/tests/test.go
T
Bertrand GounyandClaude Opus 5.5 5df4f23a40 ci: build each arch natively and publish them together
Build and test each arch on its own runner (ubuntu-latest and
ubuntu-24.04-arm) instead of under QEMU, with osixia/dagger-build OCI
archives: on tags, build jobs export them as artifacts, and the publish
job deploys them as a single multi-arch image per tag.

Integration scenarios now run on every built image, so on arm64 too:
each runner builds its own arch, so the engine platform filter never
skipped anything.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 23:47:50 +02:00

51 lines
1.2 KiB
Go

package tests
import (
"context"
"fmt"
"log"
"time"
"dagger.io/dagger"
"github.com/osixia/dagger-build/job"
)
// scenario is an integration test run against a built image.
type scenario struct {
name string
run func(ctx context.Context, client *dagger.Client, image *dagger.Container) error
}
var scenarios = []scenario{
{"default bootstrap", Default},
{"alternative schemas", AlternativeSchemas},
{"all features with 3 replicated nodes", AllFeatures},
{"backup and restore", BackupRestore},
{"upgrade", Upgrade},
{"upgrade from previous releases", UpgradeFromPreviousReleases},
}
// Run checks OpenLDAP behavior after the reusable job's version check. CI builds each arch
// on a native runner: run locally with --arches matching the host to avoid emulation.
func Run(ctx context.Context, client *dagger.Client, builds []*job.BuildResult) error {
for _, build := range builds {
for _, image := range build.Containers {
for _, s := range scenarios {
log.Printf("scenario: %s ...", s.name)
sctx, cancel := context.WithTimeout(ctx, 10*time.Minute)
err := s.run(sctx, client, image)
cancel()
if err != nil {
return fmt.Errorf("%s: %w", s.name, err)
}
log.Printf("scenario: %s passed", s.name)
}
}
}
return nil
}