mirror of
https://github.com/Yuyi-Oak/BlueArchiveToolkit.git
synced 2026-09-18 08:14:55 +08:00
fix(repo):统一发布健康与只读质量门禁
This commit is contained in:
@@ -38,7 +38,7 @@ func newTestClient(t *testing.T, handler func(t *testing.T, req testRequest) tes
|
||||
client.DialContext = func(ctx context.Context, network string, address string) (net.Conn, error) {
|
||||
clientConn, serverConn := net.Pipe()
|
||||
go func(conn net.Conn) {
|
||||
defer conn.Close()
|
||||
defer func() { _ = conn.Close() }()
|
||||
line, err := bufio.NewReader(conn).ReadBytes('\n')
|
||||
if err != nil {
|
||||
return
|
||||
@@ -137,6 +137,45 @@ func TestReleaseDistributionUsesTypedRPCContract(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestReleaseStatusUsesWholeReleaseHealthFact(t *testing.T) {
|
||||
client := newTestClient(t, func(t *testing.T, req testRequest) testResponse {
|
||||
if req.Method != "release.status" {
|
||||
t.Fatalf("method = %s", req.Method)
|
||||
}
|
||||
return testResponse{
|
||||
Result: testEnvelope{
|
||||
OK: true,
|
||||
Status: "ok",
|
||||
Data: map[string]any{
|
||||
"status": "blocked",
|
||||
"status_code": "distribution.blocked",
|
||||
"default_distribution_channel": "official",
|
||||
"official_current_release_id": "official-1",
|
||||
"official_distribution_ready": false,
|
||||
"releases": []any{map[string]any{
|
||||
"channel": "official",
|
||||
"id": "official-1",
|
||||
"current": true,
|
||||
"distribution_integrity_status": "invalid",
|
||||
}},
|
||||
},
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
report, err := client.ReleaseStatus(context.Background())
|
||||
if err != nil {
|
||||
t.Fatalf("ReleaseStatus error: %v", err)
|
||||
}
|
||||
if report.StatusCode != "distribution.blocked" ||
|
||||
report.OfficialDistributionReady ||
|
||||
report.OfficialCurrentReleaseID != "official-1" ||
|
||||
len(report.Releases) != 1 ||
|
||||
report.Releases[0].DistributionIntegrityStatus != "invalid" {
|
||||
t.Fatalf("report = %#v", report)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDaemonRestartSendsControlMethod(t *testing.T) {
|
||||
client := newTestClient(t, func(t *testing.T, req testRequest) testResponse {
|
||||
if req.Method != "daemon.restart" {
|
||||
|
||||
Reference in New Issue
Block a user