MCPcopy
hub / github.com/iron-io/functions / testFullStack

Function testFullStack

api/server/server_test.go:133–163  ·  view source on GitHub ↗
(t *testing.T, authFn func(*http.Request), suite Suite)

Source from the content-addressed store, hash-verified

131}
132
133func 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}

Callers 3

TestFullStackWithNoAuthFunction · 0.85
TestFullStackWithAuthFunction · 0.85

Calls 7

prepareBoltFunction · 0.85
testServerFunction · 0.85
routerRequestWithAuthFunction · 0.85
LenMethod · 0.80
setLogBufferFunction · 0.70
testRunnerFunction · 0.70
LogMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…