You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
returnerrorutils.CheckErrorf("Subject '%s' is invalid or not found. Please ensure the subject exists and follows the correct format: <repo>/<path>/<name> or <repo>/<name>", repoPath)
uploadError: errors.New("server response: 404 Not Found"),
49
+
repoPath: "test-repo/path/file.txt",
50
+
expectedError: "Subject 'test-repo/path/file.txt' is invalid or not found. Please ensure the subject exists and follows the correct format: <repo>/<path>/<name> or <repo>/<name>",
51
+
debugLogCheck: true,
52
+
},
53
+
{
54
+
name: "400 Bad Request Error",
55
+
uploadError: errors.New("server response: 400 Bad Request"),
56
+
repoPath: "invalid-subject",
57
+
expectedError: "Subject 'invalid-subject' is invalid or not found. Please ensure the subject exists and follows the correct format: <repo>/<path>/<name> or <repo>/<name>",
58
+
debugLogCheck: true,
59
+
},
60
+
{
61
+
name: "404 Error with Repository not found message",
62
+
uploadError: errors.New(`server response: 404 Not Found {"errors": [{"message": "Repository https: not found"}]}`),
expectedError: "Subject '@ https://evidencetrial.jfrog.io/evidence/api/v1/subject/https:/evidencetrial.jfrog.io/artifactory/cli-sigstore-test/commons-1.0.0.txt' is invalid or not found. Please ensure the subject exists and follows the correct format: <repo>/<path>/<name> or <repo>/<name>",
65
+
debugLogCheck: true,
66
+
},
67
+
{
68
+
name: "Other Error - Not 400 or 404",
69
+
uploadError: errors.New("server response: 500 Internal Server Error"),
70
+
repoPath: "test-repo/path/file.txt",
71
+
expectedError: "server response: 500 Internal Server Error",
72
+
debugLogCheck: false,
73
+
},
74
+
}
75
+
76
+
for_, tt:=rangetests {
77
+
t.Run(tt.name, func(t*testing.T) {
78
+
// Create a createEvidenceBase instance
79
+
c:=&createEvidenceBase{
80
+
serverDetails: &config.ServerDetails{},
81
+
providerId: "test-provider",
82
+
}
83
+
84
+
// Since we can't easily mock utils.CreateEvidenceServiceManager,
85
+
// we'll need to test the error handling logic directly.
86
+
// For a full integration test, you would need to use dependency injection
87
+
// or refactor the code to accept the evidence manager as a parameter.
88
+
89
+
// For now, let's test the error message formatting by simulating the error
returnerrorutils.CheckErrorf("Subject '%s' is invalid or not found. Please ensure the subject exists and follows the correct format: <repo>/<path>/<name> or <repo>/<name>", repoPath)
0 commit comments