From c73ed1549e2f68f7c40c4ddb86b7a8d40b478fa6 Mon Sep 17 00:00:00 2001 From: vishalkrishnads <321vishalds@gmail.com> Date: Tue, 13 Aug 2024 11:40:52 +0530 Subject: [PATCH] endpoint test #1 --- quest_test.go | 19 +++++++++++++++++++ test_utils.go | 10 ++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/quest_test.go b/quest_test.go index 2f9278b..0a792e8 100644 --- a/quest_test.go +++ b/quest_test.go @@ -409,11 +409,23 @@ func TestSmokeGetRetention(t *testing.T) { DeleteStream(t, NewGlob.QueryClient, NewGlob.Stream) } +func TestActivateHotTier(t *testing.T) { + activateHotTier(t) +} + func TestHotTierGetsLogs(t *testing.T) { // create stream, put hot tier, ingest data for a duration, wait for 2-3 mins to see if all data is available in hot tier + if NewGlob.IngestorUrl.String() == "" { + t.Skip("Skipping in standalone mode") + } } +// create stream, ingest data for a duration, set hot tier, wait for 2-3 mins to see if all data is available in hot tier func TestHotTierGetsLogsAfter(t *testing.T) { + if NewGlob.IngestorUrl.String() == "" { + t.Skip("Skipping in standalone mode") + } + logs := createAndIngest(t) activateHotTier(t) @@ -443,6 +455,10 @@ func TestHotTierGetsLogsAfter(t *testing.T) { // create stream, ingest data, query get count, set hot tier, wait for 2-3 mins, query again get count, both counts should match func TestHotTierLogCount(t *testing.T) { + if NewGlob.IngestorUrl.String() == "" { + t.Skip("Skipping in standalone mode") + } + createAndIngest(t) countBefore := QueryLogStreamCount(t, NewGlob.QueryClient, NewGlob.Stream, 50) @@ -455,6 +471,9 @@ func TestHotTierLogCount(t *testing.T) { func TestOldestHotTierEntry(t *testing.T) { // create stream, ingest data for a duration, call GET /logstream/{logstream}/info - to get the first_event_at field then set hot tier, wait for 2-3 mins, call GET /hottier - to get oldest entry in hot tier then match both + if NewGlob.IngestorUrl.String() == "" { + t.Skip("Skipping in standalone mode") + } } // This test calls all the User API endpoints diff --git a/test_utils.go b/test_utils.go index 7c3ea52..911d887 100644 --- a/test_utils.go +++ b/test_utils.go @@ -567,8 +567,14 @@ func activateHotTier(t *testing.T) { req, _ := NewGlob.QueryClient.NewRequest("PUT", "logstream/"+NewGlob.Stream+"/hottier", nil) response, err := NewGlob.QueryClient.Do(req) body := readAsString(response.Body) - require.Equalf(t, 200, response.StatusCode, "Server returned http code: %s and response: %s", response.Status, body) - require.NoErrorf(t, err, "Activating hot tier failed: %s", err) + + if NewGlob.IngestorUrl.String() != "" { + require.Equalf(t, 200, response.StatusCode, "Server returned unexpected http code: %s and response: %s", response.Status, body) + require.NoErrorf(t, err, "Activating hot tier failed in distributed mode: %s", err) + } else { + // right now, hot tier is unavailable in standalone so anything other than 200 is fine + require.NotEqualf(t, 200, response.StatusCode, "Hot tier has been activated in standalone mode: %s and response: %s", response.Status, body) + } } func disableHotTier(t *testing.T) {