MCPcopy Create free account
hub / github.com/Shopify/ghostferry / TestPostsCallbacks

Method TestPostsCallbacks

sharding/test/callbacks_test.go:158–179  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

156}
157
158func (t *CallbacksTestSuite) TestPostsCallbacks() {
159 lockReceived := false
160 t.CutoverLock = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
161 lockReceived = true
162 resp := t.requestMap(r)
163 t.Require().Equal("test_lock", resp["Payload"])
164 })
165
166 unlockReceived := false
167 t.CutoverUnlock = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
168 unlockReceived = true
169 resp := t.requestMap(r)
170 t.Require().Equal("test_unlock", resp["Payload"])
171 })
172
173 t.Ferry.Run()
174
175 t.Require().True(lockReceived)
176 t.Require().True(unlockReceived)
177
178 t.AssertTenantCopied()
179}
180
181func (t *CallbacksTestSuite) requestMap(r *http.Request) map[string]string {
182 defer r.Body.Close()

Callers

nothing calls this directly

Calls 3

requestMapMethod · 0.95
AssertTenantCopiedMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected