Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions quest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,19 @@ func TestLoadStream_StaticSchema_EventWithNewField(t *testing.T) {
DeleteStream(t, NewGlob.QueryClient, staticSchemaStream)
}

func TestCreateStream_WithCustomPartition_Success(t *testing.T) {
customPartitionStream := NewGlob.Stream + "custompartition"
customHeader := map[string]string{"X-P-Custom-Partition": "level"}
CreateStreamWithHeader(t, NewGlob.QueryClient, customPartitionStream, customHeader)
DeleteStream(t, NewGlob.QueryClient, customPartitionStream)
}

func TestCreateStream_WithCustomPartition_Error(t *testing.T) {
customPartitionStream := NewGlob.Stream + "custompartition"
customHeader := map[string]string{"X-P-Custom-Partition": "level,os"}
CreateStreamWithCustompartitionError(t, NewGlob.QueryClient, customPartitionStream, customHeader)
}

func TestSmokeQueryTwoStreams(t *testing.T) {
stream1 := NewGlob.Stream + "1"
stream2 := NewGlob.Stream + "2"
Expand Down Expand Up @@ -600,7 +613,7 @@ func TestLoadHistoricalStreamBatchWithK6(t *testing.T) {

func TestLoadStreamBatchWithCustomPartitionWithK6(t *testing.T) {
customPartitionStream := NewGlob.Stream + "custompartition"
customHeader := map[string]string{"X-P-Custom-Partition": "level,os"}
customHeader := map[string]string{"X-P-Custom-Partition": "level"}
CreateStreamWithHeader(t, NewGlob.QueryClient, customPartitionStream, customHeader)
if NewGlob.IngestorUrl.String() == "" {
cmd := exec.Command("k6",
Expand Down Expand Up @@ -645,10 +658,10 @@ func TestLoadStreamBatchWithCustomPartitionWithK6(t *testing.T) {
DeleteStream(t, NewGlob.QueryClient, customPartitionStream)
}

func TestLoadStreamBatchWithTimeAndCustomPartitionWithK6(t *testing.T) {
func TestLoadStreamBatchWithTimePartitionWithK6(t *testing.T) {
if NewGlob.Mode == "load" {
customPartitionStream := NewGlob.Stream + "timeandcustompartition"
customHeader := map[string]string{"X-P-Custom-Partition": "level,os", "X-P-Time-Partition": "source_time"}
customPartitionStream := NewGlob.Stream + "timepartition"
customHeader := map[string]string{"X-P-Time-Partition": "source_time"}
CreateStreamWithHeader(t, NewGlob.QueryClient, customPartitionStream, customHeader)
if NewGlob.IngestorUrl.String() == "" {
cmd := exec.Command("k6",
Expand Down
9 changes: 9 additions & 0 deletions test_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,15 @@ func CreateStreamWithHeader(t *testing.T, client HTTPClient, stream string, head
require.Equalf(t, 200, response.StatusCode, "Server returned http code: %s", response.Status)
}

func CreateStreamWithCustompartitionError(t *testing.T, client HTTPClient, stream string, header map[string]string) {
req, _ := client.NewRequest("PUT", "logstream/"+stream, nil)
for k, v := range header {
req.Header.Add(k, v)
}
response, _ := client.Do(req)
require.Equalf(t, 500, response.StatusCode, "Server returned http code: %s", response.Status)
}

func CreateStreamWithSchemaBody(t *testing.T, client HTTPClient, stream string, header map[string]string, schema_payload string) {

req, _ := client.NewRequest("PUT", "logstream/"+stream, bytes.NewBufferString(schema_payload))
Expand Down