Check effective release target membership
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
`3c405f0524ec6c098d00d4e371abbace7648d446`.
|
`3c405f0524ec6c098d00d4e371abbace7648d446`.
|
||||||
**Scope:** ReleaseKit adoption commits after `721365e`, including CLI version
|
**Scope:** ReleaseKit adoption commits after `721365e`, including CLI version
|
||||||
reporting, local release wiring, CI delivery, tests, and documentation.
|
reporting, local release wiring, CI delivery, tests, and documentation.
|
||||||
**Status:** R1 addressed; R2–R3 pending. The findings below describe the reviewed
|
**Status:** R1–R2 addressed; R3 pending. The findings below describe the reviewed
|
||||||
baseline; completed work is recorded under Resolution Record.
|
baseline; completed work is recorded under Resolution Record.
|
||||||
|
|
||||||
## Architecture Assessment
|
## Architecture Assessment
|
||||||
@@ -136,3 +136,8 @@ matrix.
|
|||||||
trailing arguments. Non-help usage errors retain status `2`. Regression tests
|
trailing arguments. Non-help usage errors retain status `2`. Regression tests
|
||||||
reproduced both defects before the fix; `go test ./internal/cli ./cmd/audita`
|
reproduced both defects before the fix; `go test ./internal/cli ./cmd/audita`
|
||||||
passed afterward. The CLI contract reflects ordinary help behavior.
|
passed afterward. The CLI contract reflects ordinary help behavior.
|
||||||
|
- **R2:** Delivery targets are compared as sets using the standard library.
|
||||||
|
Regression cases reject either missing Linux target concealed by duplicates
|
||||||
|
and an unintended target, while accepting equivalent reordered/repeated lists.
|
||||||
|
The cases reproduced the faulty membership behavior before the fix;
|
||||||
|
`go test ./scripts` passed afterward.
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package scripts
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"maps"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@@ -147,6 +148,27 @@ func TestReleaseKitProfileDeclaresProductAndDeliverySettings(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestReleaseKitTargetMembership(t *testing.T) {
|
||||||
|
want := []string{"linux/amd64", "linux/arm64"}
|
||||||
|
for _, test := range []struct {
|
||||||
|
name string
|
||||||
|
targets []string
|
||||||
|
match bool
|
||||||
|
}{
|
||||||
|
{"missing amd64", []string{"linux/arm64", "linux/arm64"}, false},
|
||||||
|
{"missing arm64", []string{"linux/amd64", "linux/amd64"}, false},
|
||||||
|
{"additional target", []string{"linux/amd64", "linux/arm64", "darwin/arm64"}, false},
|
||||||
|
{"reordered", []string{"linux/arm64", "linux/amd64"}, true},
|
||||||
|
{"repeated", []string{"linux/amd64", "linux/arm64", "linux/amd64"}, true},
|
||||||
|
} {
|
||||||
|
t.Run(test.name, func(t *testing.T) {
|
||||||
|
if got := sameMembers(test.targets, want); got != test.match {
|
||||||
|
t.Fatalf("target membership for %q = %t, want %t", test.targets, got, test.match)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
type releaseTestLayout struct {
|
type releaseTestLayout struct {
|
||||||
repo string
|
repo string
|
||||||
caller string
|
caller string
|
||||||
@@ -257,15 +279,15 @@ func hasAdjacentArguments(args []string, first, second string) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func sameMembers(got, want []string) bool {
|
func sameMembers(got, want []string) bool {
|
||||||
if len(got) != len(want) {
|
gotSet := make(map[string]struct{}, len(got))
|
||||||
return false
|
|
||||||
}
|
|
||||||
for _, value := range got {
|
for _, value := range got {
|
||||||
if !containsArgument(want, value) {
|
gotSet[value] = struct{}{}
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true
|
wantSet := make(map[string]struct{}, len(want))
|
||||||
|
for _, value := range want {
|
||||||
|
wantSet[value] = struct{}{}
|
||||||
|
}
|
||||||
|
return maps.Equal(gotSet, wantSet)
|
||||||
}
|
}
|
||||||
|
|
||||||
func hasKey(values map[string]string, key string) bool {
|
func hasKey(values map[string]string, key string) bool {
|
||||||
|
|||||||
Reference in New Issue
Block a user