mirror of
https://github.com/osixia/container-openldap.git
synced 2026-11-12 15:23:49 -04:00
Create an optional administrator for user/group CRUD and password resets while protecting service accounts, password hashes/history and cn=config. Document the distinct data root, config root, admin and management roles. Keep conditional history ACLs in their account directories as optional templates, activated by feature scripts after rendering in a temporary copy. Cover read-only sources, admin permissions, readonly history privacy and custom overrides.
65 lines
1.9 KiB
Go
65 lines
1.9 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},
|
|
{"standard data tree and management account", DataManagement},
|
|
{"scoped directory administrator", DataAdmin},
|
|
{"global request limits", GlobalLimits},
|
|
{"read-only bootstrap templates", ReadOnlyTemplates},
|
|
{"alternative schemas", AlternativeSchemas},
|
|
{"TLS certificate reload", TLSReload},
|
|
{"automatic module loading", AutomaticModules},
|
|
{"audit logging", AuditLog},
|
|
{"last successful binds", LastBind},
|
|
{"password history privacy", PasswordPolicyHistory},
|
|
{"password policy inactivity", PasswordPolicyIdle},
|
|
{"progressive password policy lockouts", PasswordPolicyDelay},
|
|
{"password helpers", PasswordHelpers},
|
|
{"LDIF validation", ValidateLDIF},
|
|
{"refint empty-group placeholders", RefintNothing},
|
|
{"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
|
|
}
|