The hourly release of ADR 0229's brake still ended in the mesh acting alone on a mistake. A consumer now stays active until the same unasked set holds for five passes, waits for a person past three or half of those held, is disabled and marked rather than withdrawn, comes back as it was when asked again, and is deleted only through the provider's delete tool. The backend keeps the mark, so a restart forgets nothing and finds what was withdrawn before.
35 lines
1.1 KiB
Go
35 lines
1.1 KiB
Go
package main
|
|
|
|
// The provisioner loop is carried, identical, by every Go provider until the Go SDK has it
|
|
// (harness.go, retirement.go, and retirement_test.go which tests it). Two copies drift the moment one
|
|
// is fixed and the other is not — and the one left behind is the provider that fails a consumer
|
|
// without saying so (novox/hq ADR 0224), or retires one it should not (ADR 0230). This holds them to
|
|
// one text. Skipped where keycloak is not beside this module, as in a build of this one alone.
|
|
|
|
import (
|
|
"bytes"
|
|
"errors"
|
|
"io/fs"
|
|
"os"
|
|
"testing"
|
|
)
|
|
|
|
func TestTheHarnessIsTheSameAsKeycloaks(t *testing.T) {
|
|
for _, file := range []string{"harness.go", "retirement.go", "retirement_test.go"} {
|
|
theirs, err := os.ReadFile("../../../keycloak/cmd/keycloak-provider/" + file)
|
|
if errors.Is(err, fs.ErrNotExist) {
|
|
t.Skip("keycloak is not beside this module")
|
|
}
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
ours, err := os.ReadFile(file)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if !bytes.Equal(ours, theirs) {
|
|
t.Fatalf("%s differs from keycloak/cmd/keycloak-provider/%s: change both, identically", file, file)
|
|
}
|
|
}
|
|
}
|