(tc sqsIntegrationTestCase)
| 353 | } |
| 354 | |
| 355 | func testIntegrationSQS(tc sqsIntegrationTestCase) func(t *testing.T) { |
| 356 | return func(t *testing.T) { |
| 357 | toml := ` |
| 358 | [fields] |
| 359 | Names=["bucket", "path", "filename"] |
| 360 | |
| 361 | [csv] |
| 362 | field_separator="," |
| 363 | |
| 364 | [input] |
| 365 | Name="sqs" |
| 366 | [input.config] |
| 367 | Bucket=%q |
| 368 | MessageFormat="plain" |
| 369 | QueuePrefixes=[%v] |
| 370 | QueueNames=[%v] |
| 371 | FilePathFilter=".*" |
| 372 | |
| 373 | [output] |
| 374 | Name="RawRecorder" |
| 375 | Procs=1 |
| 376 | fields=["bucket", "path", "filename"] |
| 377 | ` |
| 378 | |
| 379 | /* Configure the pipeline */ |
| 380 | comp := baker.Components{ |
| 381 | Inputs: []baker.InputDesc{SQSDesc}, |
| 382 | Outputs: []baker.OutputDesc{outputtest.RawRecorderDesc}, |
| 383 | } |
| 384 | |
| 385 | prefixes := []string{} |
| 386 | for _, pref := range tc.queuePrefixes { |
| 387 | prefixes = append(prefixes, `"`+pref+`"`) |
| 388 | } |
| 389 | queues := []string{} |
| 390 | for _, name := range tc.queueNames { |
| 391 | queues = append(queues, `"`+name+`"`) |
| 392 | } |
| 393 | |
| 394 | r := strings.NewReader(fmt.Sprintf(toml, tc.bucket, strings.Join(prefixes, ","), strings.Join(queues, ","))) |
| 395 | cfg, err := baker.NewConfigFromToml(r, comp) |
| 396 | if err != nil { |
| 397 | t.Fatal(err) |
| 398 | } |
| 399 | |
| 400 | topo, err := baker.NewTopologyFromConfig(cfg) |
| 401 | if err != nil { |
| 402 | t.Fatal(err) |
| 403 | } |
| 404 | |
| 405 | // Replace aws services interfaces with mocks. |
| 406 | topo.Input.(*SQS).svc = &mockSQSClient{ |
| 407 | queues: tc.messages, |
| 408 | } |
| 409 | topo.Input.(*SQS).s3Input.SetS3API(newMockedS3FromFS(os.DirFS("testdata/sqstest"))) |
| 410 | |
| 411 | /* Run the pipeline */ |
| 412 | topo.Start() |
no test coverage detected