(t *testing.T, authFn func(*http.Request), suite Suite)
| 131 | } |
| 132 | |
| 133 | func testFullStack(t *testing.T, authFn func(*http.Request), suite Suite) { |
| 134 | buf := setLogBuffer() |
| 135 | ds := prepareBolt(t) |
| 136 | |
| 137 | tasks := make(chan task.Request) |
| 138 | ctx, cancel := context.WithCancel(context.Background()) |
| 139 | defer cancel() |
| 140 | |
| 141 | rnr, rnrcancel := testRunner(t) |
| 142 | defer rnrcancel() |
| 143 | |
| 144 | go runner.StartWorkers(ctx, rnr, tasks) |
| 145 | |
| 146 | srv := testServer(ds, &mqs.Mock{}, rnr, tasks) |
| 147 | srv.hotroutes = routecache.New(2) |
| 148 | |
| 149 | for _, test := range suite { |
| 150 | _, rec := routerRequestWithAuth(t, srv.Router, test.method, test.path, bytes.NewBuffer([]byte(test.body)), authFn) |
| 151 | |
| 152 | if rec.Code != test.expectedCode { |
| 153 | t.Log(buf.String()) |
| 154 | t.Errorf("Test \"%s\": Expected status code to be %d but was %d", |
| 155 | test.name, test.expectedCode, rec.Code) |
| 156 | } |
| 157 | if srv.hotroutes.Len() != test.expectedCacheSize { |
| 158 | t.Log(buf.String()) |
| 159 | t.Errorf("Test \"%s\": Expected cache size to be %d but was %d", |
| 160 | test.name, test.expectedCacheSize, srv.hotroutes.Len()) |
| 161 | } |
| 162 | } |
| 163 | } |
no test coverage detected
searching dependent graphs…