diff --git a/quest_test.go b/quest_test.go index e83f7f8..36fab54 100644 --- a/quest_test.go +++ b/quest_test.go @@ -255,7 +255,7 @@ func TestSmokeLoadWithK6Stream(t *testing.T) { cmd.Run() cmd.Output() } - time.Sleep(60 * time.Second) + time.Sleep(120 * time.Second) QueryLogStreamCount(t, NewGlob.QueryClient, NewGlob.Stream, 60000) AssertStreamSchema(t, NewGlob.QueryClient, NewGlob.Stream, SchemaBody) DeleteStream(t, NewGlob.QueryClient, NewGlob.Stream) @@ -320,7 +320,7 @@ func TestSmokeLoad_CustomPartition_WithK6Stream(t *testing.T) { cmd.Run() cmd.Output() } - time.Sleep(60 * time.Second) + time.Sleep(120 * time.Second) QueryLogStreamCount(t, NewGlob.QueryClient, custom_partition_stream, 60000) DeleteStream(t, NewGlob.QueryClient, custom_partition_stream) } @@ -352,7 +352,7 @@ func TestSmokeLoad_TimeAndCustomPartition_WithK6Stream(t *testing.T) { cmd.Run() cmd.Output() } - time.Sleep(60 * time.Second) + time.Sleep(120 * time.Second) QueryLogStreamCount(t, NewGlob.QueryClient, custom_partition_stream, 60000) DeleteStream(t, NewGlob.QueryClient, custom_partition_stream) } diff --git a/test_utils.go b/test_utils.go index 666ff68..c83856b 100644 --- a/test_utils.go +++ b/test_utils.go @@ -246,29 +246,9 @@ func IngestOneEventForStaticSchemaStream_SameFieldsInLog(t *testing.T, client HT } func QueryLogStreamCount(t *testing.T, client HTTPClient, stream string, count uint64) { - // Query last 10 minutes of data only + // Query last 30 minutes of data only endTime := time.Now().Add(time.Second).Format(time.RFC3339Nano) - startTime := time.Now().Add(-10 * time.Minute).Format(time.RFC3339Nano) - - query := map[string]interface{}{ - "query": "select count(*) as count from " + stream, - "startTime": startTime, - "endTime": endTime, - } - queryJSON, _ := json.Marshal(query) - req, _ := client.NewRequest("POST", "query", bytes.NewBuffer(queryJSON)) - response, err := client.Do(req) - require.NoErrorf(t, err, "Request failed: %s", err) - body := readAsString(response.Body) - 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) -} - -func QueryLogStreamCount_WithTimePartition(t *testing.T, client HTTPClient, stream string, count uint64) { - // Query last 10 minutes of data only - endTime := "2024-05-17T10:00:00.000Z" - startTime := "2024-05-17T08:00:00.000Z" + startTime := time.Now().Add(-30 * time.Minute).Format(time.RFC3339Nano) query := map[string]interface{}{ "query": "select count(*) as count from " + stream, @@ -286,9 +266,9 @@ func QueryLogStreamCount_WithTimePartition(t *testing.T, client HTTPClient, stre } func QueryTwoLogStreamCount(t *testing.T, client HTTPClient, stream1 string, stream2 string, count uint64) { - // Query last 10 minutes of data only + // Query last 30 minutes of data only endTime := time.Now().Add(time.Second).Format(time.RFC3339Nano) - startTime := time.Now().Add(-10 * time.Minute).Format(time.RFC3339Nano) + startTime := time.Now().Add(-30 * time.Minute).Format(time.RFC3339Nano) query := map[string]interface{}{ "query": fmt.Sprintf("select sum(c) as count from (select count(*) as c from %s union all select count(*) as c from %s)", stream1, stream2), @@ -306,9 +286,9 @@ func QueryTwoLogStreamCount(t *testing.T, client HTTPClient, stream1 string, str } func AssertQueryOK(t *testing.T, client HTTPClient, query string, args ...any) { - // Query last 10 minutes of data only + // Query last 30 minutes of data only endTime := time.Now().Add(time.Second).Format(time.RFC3339Nano) - startTime := time.Now().Add(-10 * time.Minute).Format(time.RFC3339Nano) + startTime := time.Now().Add(-30 * time.Minute).Format(time.RFC3339Nano) var finalQuery string if len(args) == 0 {