feat: delete never-activated licenses and bundle deployment verification keys
Co-Authored-By: Craft Agent <agents-noreply@craft.do>
This commit is contained in:
@@ -57,10 +57,19 @@ func TestIntegrationInputs(t *testing.T) {
|
||||
}
|
||||
}
|
||||
func TestIntegrationArchiveAndSignatures(t *testing.T) {
|
||||
const public = "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAESr8/VFFwt70o7fwa8HiRNyxWtZEu\nUqzCBfYRG72DazEgeOaSVAdlTv49OujtggXSJzFLOluMENJzaRmp9+iJ0Q==\n-----END PUBLIC KEY-----\n"
|
||||
a := &BusinessAPI{keyring: &Keyring{Current: "prod-test", Keys: []VerificationKey{{KeyID: "prod-test", PublicKeyPEM: public}, {KeyID: "retired", PublicKeyPEM: public, Revoked: true}}}}
|
||||
md := httptest.NewRecorder()
|
||||
mc, _ := gin.CreateTestContext(md)
|
||||
mc.Request = httptest.NewRequest("GET", "/?language=java&mode=container", nil)
|
||||
a.downloadIntegrationKit(mc)
|
||||
if md.Code != 200 || !strings.Contains(md.Body.String(), public) || !strings.Contains(md.Body.String(), "22056bfacc8fe8a240dd2125b629e60ba9f4a5ea0041a1efe034f376a258d562") || strings.Contains(md.Body.String(), "retired") || md.Header().Get("Cache-Control") != "no-store" {
|
||||
t.Fatal("markdown lacks trusted deployment key")
|
||||
}
|
||||
w := httptest.NewRecorder()
|
||||
c, _ := gin.CreateTestContext(w)
|
||||
c.Request = httptest.NewRequest("GET", "/?language=java&mode=container", nil)
|
||||
(&BusinessAPI{}).downloadIntegrationArchive(c)
|
||||
a.downloadIntegrationArchive(c)
|
||||
if w.Code != 200 || w.Header().Get("Content-Type") != "application/zip" {
|
||||
t.Fatalf("%d %s", w.Code, w.Body)
|
||||
}
|
||||
@@ -68,7 +77,7 @@ func TestIntegrationArchiveAndSignatures(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(archive.File) != 6 {
|
||||
if len(archive.File) != 7 {
|
||||
t.Fatal("missing files")
|
||||
}
|
||||
for _, file := range archive.File {
|
||||
@@ -84,6 +93,9 @@ func TestIntegrationArchiveAndSignatures(t *testing.T) {
|
||||
if file.Name == "openapi.json" && !strings.Contains(string(content), defaultIntegrationBaseURL) {
|
||||
t.Fatal("OpenAPI does not use the default platform address")
|
||||
}
|
||||
if file.Name == "verification-keys.md" && (!strings.Contains(string(content), public) || strings.Contains(string(content), "retired")) {
|
||||
t.Fatal("incorrect deployment key in archive")
|
||||
}
|
||||
if file.Name == "upgrade.md" && !strings.Contains(string(content), "自动升级所需服务端契约") {
|
||||
t.Fatal("missing upgrade plan")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user