MCPcopy
hub / github.com/cortexlabs/cortex / TestBatchMessageHandler_Handle

Function TestBatchMessageHandler_Handle

pkg/dequeuer/batch_handler_test.go:30–59  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

28)
29
30func TestBatchMessageHandler_Handle(t *testing.T) {
31 t.Parallel()
32 awsClient := testAWSClient(t)
33
34 var callCount int
35 server := httptest.NewServer(
36 http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
37 callCount++
38 w.WriteHeader(http.StatusOK)
39 }),
40 )
41
42 logger := newLogger(t)
43 defer func() { _ = logger.Sync() }()
44
45 batchHandler := NewBatchMessageHandler(BatchMessageHandlerConfig{
46 APIName: "test",
47 JobID: "12345",
48 Region: _localStackDefaultRegion,
49 TargetURL: server.URL,
50 }, awsClient, &statsd.NoOpClient{}, logger)
51
52 err := batchHandler.Handle(&sqs.Message{
53 Body: aws.String(""),
54 MessageId: aws.String("1"),
55 })
56
57 require.Equal(t, callCount, 1)
58 require.NoError(t, err)
59}
60
61func TestBatchMessageHandler_Handle_OnJobComplete(t *testing.T) {
62 t.Parallel()

Callers

nothing calls this directly

Calls 6

HandleMethod · 0.95
testAWSClientFunction · 0.85
NewBatchMessageHandlerFunction · 0.85
EqualMethod · 0.80
newLoggerFunction · 0.70
StringMethod · 0.45

Tested by

no test coverage detected