Skip to content

Commit

Permalink
added log count test
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalkrishnads committed Aug 13, 2024
1 parent a58901a commit d8de52f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
10 changes: 9 additions & 1 deletion quest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -441,8 +441,16 @@ func TestHotTierGetsLogsAfter(t *testing.T) {
DeleteStream(t, NewGlob.QueryClient, NewGlob.Stream)
}

// 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) {
// create stream, ingest data, query get count, set hot tier, wait for 2-3 mins, query again get count, both counts should match
createAndIngest(t)
countBefore := QueryLogStreamCount(t, NewGlob.QueryClient, NewGlob.Stream, 50)

activateHotTier(t)
time.Sleep(60 * 2 * time.Second) // wait for 2 minutes to allow hot tier to sync

countAfter := QueryLogStreamCount(t, NewGlob.QueryClient, NewGlob.Stream, 50)
require.Equalf(t, countBefore, countAfter, "Ingested %s, but hot tier contains only %s", countBefore, countAfter)
}

func TestOldestHotTierEntry(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion test_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ func IngestOneEventForStaticSchemaStream_SameFieldsInLog(t *testing.T, client HT
require.Equalf(t, 200, response.StatusCode, "Server returned http code: %s resp %s", response.Status, readAsString(response.Body))
}

func QueryLogStreamCount(t *testing.T, client HTTPClient, stream string, count uint64) {
func QueryLogStreamCount(t *testing.T, client HTTPClient, stream string, count uint64) string {
// Query last 30 minutes of data only
endTime := time.Now().Add(time.Second).Format(time.RFC3339Nano)
startTime := time.Now().Add(-30 * time.Minute).Format(time.RFC3339Nano)
Expand All @@ -263,6 +263,7 @@ func QueryLogStreamCount(t *testing.T, client HTTPClient, stream string, count u
require.Equalf(t, 200, response.StatusCode, "Server returned http code: %s and response: %s", response.Status, body)
expected := fmt.Sprintf(`[{"count":%d}]`, count)
require.Equalf(t, expected, body, "Query count incorrect; Expected %s, Actual %s", expected, body)
return body
}

func QueryLogStreamCount_Historical(t *testing.T, client HTTPClient, stream string, count uint64) {
Expand Down

0 comments on commit d8de52f

Please sign in to comment.