(t *testing.T)
| 443 | } |
| 444 | |
| 445 | func TestShutdown(t *testing.T) { |
| 446 | t.Parallel() |
| 447 | for _, protoMsg := range []remoteapi.WriteMessageType{remoteapi.WriteV1MessageType, remoteapi.WriteV2MessageType} { |
| 448 | t.Run(fmt.Sprint(protoMsg), func(t *testing.T) { |
| 449 | synctest.Test(t, func(t *testing.T) { |
| 450 | deadline := 15 * time.Second |
| 451 | c := NewTestBlockedWriteClient() |
| 452 | |
| 453 | cfg := config.DefaultQueueConfig |
| 454 | mcfg := config.DefaultMetadataConfig |
| 455 | |
| 456 | m := newTestQueueManager(t, cfg, mcfg, deadline, c, protoMsg) |
| 457 | // Send 2x batch size, so we know it will need at least two sends. |
| 458 | n := 2 * config.DefaultQueueConfig.MaxSamplesPerSend |
| 459 | recs := testwal.GenerateRecords(recCase{ |
| 460 | NoST: protoMsg == remoteapi.WriteV1MessageType, // RW1 does not support ST. |
| 461 | Series: n / 1000, SamplesPerSeries: 1000, |
| 462 | }) |
| 463 | m.StoreSeries(recs.Series, 0) |
| 464 | m.Start() |
| 465 | |
| 466 | // Append blocks to guarantee delivery, so we do it in the background. |
| 467 | go func() { |
| 468 | m.Append(recs.Samples) |
| 469 | }() |
| 470 | synctest.Wait() |
| 471 | |
| 472 | // Test to ensure that Stop doesn't block. |
| 473 | start := time.Now() |
| 474 | m.Stop() |
| 475 | // The samples will never be delivered, so duration should |
| 476 | // be at least equal to deadline, otherwise the flush deadline |
| 477 | // was not respected. |
| 478 | require.Equal(t, time.Since(start), deadline) |
| 479 | }) |
| 480 | }) |
| 481 | } |
| 482 | } |
| 483 | |
| 484 | func TestSeriesReset(t *testing.T) { |
| 485 | for _, protoMsg := range []remoteapi.WriteMessageType{remoteapi.WriteV1MessageType, remoteapi.WriteV2MessageType} { |
nothing calls this directly
no test coverage detected
searching dependent graphs…