feat: 固定 Database 凭据位置与确认版本
Verify / test (pull_request) Successful in 13m42s
Verify / lint (pull_request) Successful in 14m26s
Verify / database-integration (pull_request) Successful in 16m16s

This commit is contained in:
2026-09-27 18:08:09 +00:00
parent 6b2808ce91
commit 371248659b
13 changed files with 323 additions and 20 deletions
@@ -36,6 +36,7 @@ const (
fixturePassword = "AYATORI-TEST-ONLY-application-password"
fixtureToken = "AYATORI-TEST-ONLY-bao-token"
kvDataKey = "data"
kvVersionKey = "version"
)
func fixtureCredential(t *testing.T) application.ApplicationCredential {
@@ -66,7 +67,7 @@ func TestCredentialReadbackMustConfirmTheWrite(t *testing.T) {
if json.NewDecoder(r.Body).Decode(&request) != nil || request.Options.CAS == nil || *request.Options.CAS != 0 {
t.Error("create request must explicitly require CAS=0")
}
if err := json.NewEncoder(w).Encode(map[string]any{kvDataKey: map[string]any{"version": 1}}); err != nil {
if err := json.NewEncoder(w).Encode(map[string]any{kvDataKey: map[string]any{kvVersionKey: 1}}); err != nil {
t.Error("cannot encode fixture write response")
}
return
@@ -85,7 +86,7 @@ func TestCredentialReadbackMustConfirmTheWrite(t *testing.T) {
}
response := map[string]any{kvDataKey: data}
if scenario != "missing metadata" {
response["metadata"] = map[string]any{"version": version}
response["metadata"] = map[string]any{kvVersionKey: version}
}
if err := json.NewEncoder(w).Encode(map[string]any{kvDataKey: response}); err != nil {
t.Error("cannot encode fixture read response")