@@ -33,40 +33,47 @@ func BuildDisallowedByAPIHandlers(t *testing.T) []testserver.TestRequestHandler
3333
3434// BuildAllowedWithGitalyHandlers returns test request handlers for allowed API calls with Gitaly.
3535func BuildAllowedWithGitalyHandlers (t * testing.T , gitalyAddress string ) []testserver.TestRequestHandler {
36- requests := []testserver.TestRequestHandler {
36+ return BuildAllowedWithGitalyHandlersAndRetryConfig (t , gitalyAddress , nil )
37+ }
38+
39+ // BuildAllowedWithGitalyHandlersAndRetryConfig returns test request handlers for allowed API calls with Gitaly and retry config.
40+ func BuildAllowedWithGitalyHandlersAndRetryConfig (t * testing.T , gitalyAddress string , retryConfig map [string ]interface {}) []testserver.TestRequestHandler {
41+ body := map [string ]interface {}{
42+ "status" : true ,
43+ "gl_id" : "1" ,
44+ "gl_key_type" : "key" ,
45+ "gl_key_id" : 123 ,
46+ "gl_username" : "alex-doe" ,
47+ "gitaly" : map [string ]interface {}{
48+ "repository" : map [string ]interface {}{
49+ "storage_name" : "storage_name" ,
50+ "relative_path" : "relative_path" ,
51+ "git_object_directory" : "path/to/git_object_directory" ,
52+ "git_alternate_object_directories" : []string {"path/to/git_alternate_object_directory" },
53+ "gl_repository" : "group/repo" ,
54+ "gl_project_path" : "group/project-path" ,
55+ },
56+ "address" : gitalyAddress ,
57+ "token" : "token" ,
58+ "features" : map [string ]string {
59+ "gitaly-feature-cache_invalidator" : "true" ,
60+ "gitaly-feature-inforef_uploadpack_cache" : "false" ,
61+ },
62+ },
63+ }
64+
65+ if retryConfig != nil {
66+ body ["retry_config" ] = retryConfig
67+ }
68+
69+ return []testserver.TestRequestHandler {
3770 {
3871 Path : "/api/v4/internal/allowed" ,
3972 Handler : func (w http.ResponseWriter , _ * http.Request ) {
40- body := map [string ]interface {}{
41- "status" : true ,
42- "gl_id" : "1" ,
43- "gl_key_type" : "key" ,
44- "gl_key_id" : 123 ,
45- "gl_username" : "alex-doe" ,
46- "gitaly" : map [string ]interface {}{
47- "repository" : map [string ]interface {}{
48- "storage_name" : "storage_name" ,
49- "relative_path" : "relative_path" ,
50- "git_object_directory" : "path/to/git_object_directory" ,
51- "git_alternate_object_directories" : []string {"path/to/git_alternate_object_directory" },
52- "gl_repository" : "group/repo" ,
53- "gl_project_path" : "group/project-path" ,
54- },
55- "address" : gitalyAddress ,
56- "token" : "token" ,
57- "features" : map [string ]string {
58- "gitaly-feature-cache_invalidator" : "true" ,
59- "gitaly-feature-inforef_uploadpack_cache" : "false" ,
60- "some-other-ff" : "true" ,
61- },
62- },
63- }
6473 assert .NoError (t , json .NewEncoder (w ).Encode (body ))
6574 },
6675 },
6776 }
68-
69- return requests
7077}
7178
7279// BuildAllowedWithCustomActionsHandlers returns test request handlers for allowed API calls with custom actions.
0 commit comments