Skip to content

Commit

Permalink
endpoint test #1
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalkrishnads committed Aug 13, 2024
1 parent d8de52f commit c73ed15
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
19 changes: 19 additions & 0 deletions quest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)

Expand All @@ -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
Expand Down
10 changes: 8 additions & 2 deletions test_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit c73ed15

Please sign in to comment.