Skip to content

Commit cfd4de5

Browse files
[receiver/awscloudwatch] Clarify arbitrary start time in listMetrics tests
Add a comment noting that the collection start time is arbitrary and does not affect the outcome in the listMetrics tests that do not exercise the RecentlyActive threshold, and fix a typo in the existing note.
1 parent 1165d21 commit cfd4de5

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

receiver/awscloudwatchreceiver/metrics_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,8 @@ func TestListMetrics_SinglePage(t *testing.T) {
411411
scr := testScraper(cfg)
412412
scr.client = mc
413413

414+
// collectionStartTime is always some time in the past.
415+
// the value used in this test is arbitrary (it does not affect the outcome of the test).
414416
out, err := scr.listMetrics(t.Context(), time.Now().UTC().Add(-time.Hour))
415417
require.NoError(t, err)
416418
require.Len(t, out, 1)
@@ -550,6 +552,8 @@ func TestListMetrics_Paginated(t *testing.T) {
550552
scr := testScraper(cfg)
551553
scr.client = mc
552554

555+
// collectionStartTime is always some time in the past.
556+
// the value used in this test is arbitrary (it does not affect the outcome of the test).
553557
out, err := scr.listMetrics(t.Context(), time.Now().UTC().Add(-time.Hour))
554558
require.NoError(t, err)
555559
require.Len(t, out, 2)
@@ -575,6 +579,8 @@ func TestListMetrics_LimitRespected(t *testing.T) {
575579
scr := testScraper(cfg)
576580
scr.client = mc
577581

582+
// collectionStartTime is always some time in the past.
583+
// the value used in this test is arbitrary (it does not affect the outcome of the test).
578584
out, err := scr.listMetrics(t.Context(), time.Now().UTC().Add(-time.Hour))
579585
require.NoError(t, err)
580586
require.Len(t, out, 2)
@@ -592,6 +598,8 @@ func TestListMetrics_Error(t *testing.T) {
592598
scr := testScraper(cfg)
593599
scr.client = mc
594600

601+
// collectionStartTime is always some time in the past.
602+
// the value used in this test is arbitrary (it does not affect the outcome of the test).
595603
_, err := scr.listMetrics(t.Context(), time.Now().UTC().Add(-time.Hour))
596604
require.Error(t, err)
597605
}

0 commit comments

Comments
 (0)