chore: establish local platform baseline
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
package diagnostics
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestValidAcceptanceSnapshotInputLimitsAuditReason(t *testing.T) {
|
||||
input := AcceptanceSnapshotInput{
|
||||
CandidateVersion: "0.55.0-rc.1",
|
||||
BuildDigest: "sha256:" + strings.Repeat("a", 64),
|
||||
Environment: "LAB",
|
||||
RunType: "PILOT",
|
||||
Scope: "本地试点技术预检",
|
||||
RequiredDependencies: []string{"oidc_jwks"},
|
||||
Reason: strings.Repeat("理", 255),
|
||||
}
|
||||
if !validAcceptanceSnapshotInput(input) {
|
||||
t.Fatal("255-character audit reason should be accepted")
|
||||
}
|
||||
input.Reason += "由"
|
||||
if validAcceptanceSnapshotInput(input) {
|
||||
t.Fatal("reason exceeding audit_event.purpose capacity should be rejected")
|
||||
}
|
||||
}
|
||||
|
||||
func TestAcceptanceSnapshotAllowsAllProductionExternalDependencies(t *testing.T) {
|
||||
input := AcceptanceSnapshotInput{
|
||||
CandidateVersion: "0.64.0-rc.1", BuildDigest: "sha256:" + strings.Repeat("b", 64),
|
||||
Environment: "PRODUCTION", RunType: "PRODUCTION_RELEASE", Scope: "生产候选外部依赖预检", Reason: "归档发布技术门禁",
|
||||
RequiredDependencies: []string{"oidc_jwks", "ark_tls", "volc_rtc_tls", "content_safety_tls"},
|
||||
}
|
||||
if !validAcceptanceSnapshotInput(input) {
|
||||
t.Fatal("all four supported production dependencies should be accepted")
|
||||
}
|
||||
input.RequiredDependencies = append(input.RequiredDependencies, "content_safety_tls")
|
||||
if validAcceptanceSnapshotInput(input) {
|
||||
t.Fatal("duplicated content safety dependency should be rejected")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user