Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Partition change quest #63

Closed
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
259 changes: 247 additions & 12 deletions quest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func TestLoadStreamBatchWithK6_StaticSchema(t *testing.T) {
"-e", fmt.Sprintf("P_PASSWORD=%s", NewGlob.QueryPassword),
"-e", fmt.Sprintf("P_STREAM=%s", staticSchemaStream),
"-e", fmt.Sprintf("P_SCHEMA_COUNT=%s", schema_count),
"-e", fmt.Sprintf("P_EVENTS_COUNT=%s", schema_count),
"-e", fmt.Sprintf("P_EVENTS_COUNT=%s", events_count),
"./scripts/load_batch_events.js",
"--vus=", vus,
"--duration=", duration)
Expand All @@ -156,7 +156,7 @@ func TestLoadStreamBatchWithK6_StaticSchema(t *testing.T) {
"-e", fmt.Sprintf("P_PASSWORD=%s", NewGlob.IngestorPassword),
"-e", fmt.Sprintf("P_STREAM=%s", staticSchemaStream),
"-e", fmt.Sprintf("P_SCHEMA_COUNT=%s", schema_count),
"-e", fmt.Sprintf("P_EVENTS_COUNT=%s", schema_count),
"-e", fmt.Sprintf("P_EVENTS_COUNT=%s", events_count),
"./scripts/load_batch_events.js",
"--vus=", vus,
"--duration=", duration)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -289,13 +289,13 @@ func TestSmokeLoad_TimePartition_WithK6Stream(t *testing.T) {
cmd.Output()
}
time.Sleep(60 * time.Second)
QueryLogStreamCount_WithTimePartition(t, NewGlob.QueryClient, time_partition_stream, 60000)
QueryLogStreamCount(t, NewGlob.QueryClient, time_partition_stream, 60000)
DeleteStream(t, NewGlob.QueryClient, time_partition_stream)
}

func TestSmokeLoad_CustomPartition_WithK6Stream(t *testing.T) {
custom_partition_stream := 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, custom_partition_stream, customHeader)
if NewGlob.IngestorUrl.String() == "" {
cmd := exec.Command("k6",
Expand All @@ -320,14 +320,14 @@ 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)
}

func TestSmokeLoad_TimeAndCustomPartition_WithK6Stream(t *testing.T) {
custom_partition_stream := NewGlob.Stream + "timecustompartition"
customHeader := map[string]string{"X-P-Custom-Partition": "level,os", "X-P-Time-Partition": "source_time", "X-P-Time-Partition-Limit": "365d"}
customHeader := map[string]string{"X-P-Custom-Partition": "level", "X-P-Time-Partition": "source_time", "X-P-Time-Partition-Limit": "365d"}
CreateStreamWithHeader(t, NewGlob.QueryClient, custom_partition_stream, customHeader)
if NewGlob.IngestorUrl.String() == "" {
cmd := exec.Command("k6",
Expand All @@ -352,8 +352,8 @@ func TestSmokeLoad_TimeAndCustomPartition_WithK6Stream(t *testing.T) {
cmd.Run()
cmd.Output()
}
time.Sleep(60 * time.Second)
QueryLogStreamCount_WithTimePartition(t, NewGlob.QueryClient, custom_partition_stream, 60000)
time.Sleep(120 * time.Second)
QueryLogStreamCount(t, NewGlob.QueryClient, custom_partition_stream, 60000)
DeleteStream(t, NewGlob.QueryClient, custom_partition_stream)
}

Expand Down Expand Up @@ -510,7 +510,7 @@ func TestLoadStreamBatchWithK6(t *testing.T) {
"-e", fmt.Sprintf("P_PASSWORD=%s", NewGlob.QueryPassword),
"-e", fmt.Sprintf("P_STREAM=%s", NewGlob.Stream),
"-e", fmt.Sprintf("P_SCHEMA_COUNT=%s", schema_count),
"-e", fmt.Sprintf("P_EVENTS_COUNT=%s", schema_count),
"-e", fmt.Sprintf("P_EVENTS_COUNT=%s", events_count),
"./scripts/load_batch_events.js",
"--vus=", vus,
"--duration=", duration)
Expand Down Expand Up @@ -559,7 +559,7 @@ func TestLoadHistoricalStreamBatchWithK6(t *testing.T) {
"-e", fmt.Sprintf("P_PASSWORD=%s", NewGlob.QueryPassword),
"-e", fmt.Sprintf("P_STREAM=%s", historicalStream),
"-e", fmt.Sprintf("P_SCHEMA_COUNT=%s", schema_count),
"-e", fmt.Sprintf("P_EVENTS_COUNT=%s", schema_count),
"-e", fmt.Sprintf("P_EVENTS_COUNT=%s", events_count),
"./scripts/load_historical_batch_events.js",
"--vus=", vus,
"--duration=", duration)
Expand All @@ -578,7 +578,7 @@ func TestLoadHistoricalStreamBatchWithK6(t *testing.T) {
"-e", fmt.Sprintf("P_PASSWORD=%s", NewGlob.IngestorPassword),
"-e", fmt.Sprintf("P_STREAM=%s", historicalStream),
"-e", fmt.Sprintf("P_SCHEMA_COUNT=%s", schema_count),
"-e", fmt.Sprintf("P_EVENTS_COUNT=%s", schema_count),
"-e", fmt.Sprintf("P_EVENTS_COUNT=%s", events_count),
"./scripts/load_historical_batch_events.js",
"--vus=", vus,
"--duration=", duration)
Expand All @@ -595,6 +595,102 @@ func TestLoadHistoricalStreamBatchWithK6(t *testing.T) {
}
}

func TestLoadStreamBatchWithCustomPartitionWithK6(t *testing.T) {
customPartitionStream := NewGlob.Stream + "custompartition"
customHeader := map[string]string{"X-P-Custom-Partition": "level,os"}
CreateStreamWithHeader(t, NewGlob.QueryClient, customPartitionStream, customHeader)
if NewGlob.IngestorUrl.String() == "" {
cmd := exec.Command("k6",
"run",
"-e", fmt.Sprintf("P_URL=%s", NewGlob.QueryUrl.String()),
"-e", fmt.Sprintf("P_USERNAME=%s", NewGlob.QueryUsername),
"-e", fmt.Sprintf("P_PASSWORD=%s", NewGlob.QueryPassword),
"-e", fmt.Sprintf("P_STREAM=%s", customPartitionStream),
"-e", fmt.Sprintf("P_SCHEMA_COUNT=%s", schema_count),
"-e", fmt.Sprintf("P_EVENTS_COUNT=%s", events_count),
"./scripts/load_batch_events.js",
"--vus=", vus,
"--duration=", duration)

cmd.Run()
op, err := cmd.Output()
if err != nil {
t.Log(err)
}
t.Log(string(op))
} else {
cmd := exec.Command("k6",
"run",
"-e", fmt.Sprintf("P_URL=%s", NewGlob.IngestorUrl.String()),
"-e", fmt.Sprintf("P_USERNAME=%s", NewGlob.IngestorUsername),
"-e", fmt.Sprintf("P_PASSWORD=%s", NewGlob.IngestorPassword),
"-e", fmt.Sprintf("P_STREAM=%s", customPartitionStream),
"-e", fmt.Sprintf("P_SCHEMA_COUNT=%s", schema_count),
"-e", fmt.Sprintf("P_EVENTS_COUNT=%s", events_count),
"./scripts/load_batch_events.js",
"--vus=", vus,
"--duration=", duration)

cmd.Run()
op, err := cmd.Output()
if err != nil {
t.Log(err)
}
t.Log(string(op))
}

DeleteStream(t, NewGlob.QueryClient, customPartitionStream)
}

func TestLoadStreamBatchWithTimeAndCustomPartitionWithK6(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"}
CreateStreamWithHeader(t, NewGlob.QueryClient, customPartitionStream, customHeader)
if NewGlob.IngestorUrl.String() == "" {
cmd := exec.Command("k6",
"run",
"-e", fmt.Sprintf("P_URL=%s", NewGlob.QueryUrl.String()),
"-e", fmt.Sprintf("P_USERNAME=%s", NewGlob.QueryUsername),
"-e", fmt.Sprintf("P_PASSWORD=%s", NewGlob.QueryPassword),
"-e", fmt.Sprintf("P_STREAM=%s", customPartitionStream),
"-e", fmt.Sprintf("P_SCHEMA_COUNT=%s", schema_count),
"-e", fmt.Sprintf("P_EVENTS_COUNT=%s", events_count),
"./scripts/load_historical_batch_events.js",
"--vus=", vus,
"--duration=", duration)

cmd.Run()
op, err := cmd.Output()
if err != nil {
t.Log(err)
}
t.Log(string(op))
} else {
cmd := exec.Command("k6",
"run",
"-e", fmt.Sprintf("P_URL=%s", NewGlob.IngestorUrl.String()),
"-e", fmt.Sprintf("P_USERNAME=%s", NewGlob.IngestorUsername),
"-e", fmt.Sprintf("P_PASSWORD=%s", NewGlob.IngestorPassword),
"-e", fmt.Sprintf("P_STREAM=%s", customPartitionStream),
"-e", fmt.Sprintf("P_SCHEMA_COUNT=%s", schema_count),
"-e", fmt.Sprintf("P_EVENTS_COUNT=%s", events_count),
"./scripts/load_historical_batch_events.js",
"--vus=", vus,
"--duration=", duration)

cmd.Run()
op, err := cmd.Output()
if err != nil {
t.Log(err)
}
t.Log(string(op))
}

DeleteStream(t, NewGlob.QueryClient, customPartitionStream)
}
}

func TestLoadStreamNoBatchWithK6(t *testing.T) {
if NewGlob.Mode == "load" {
CreateStream(t, NewGlob.QueryClient, NewGlob.Stream)
Expand Down Expand Up @@ -639,6 +735,145 @@ func TestLoadStreamNoBatchWithK6(t *testing.T) {
}
}

func TestLoadHistoricalStreamNoBatchWithK6(t *testing.T) {
if NewGlob.Mode == "load" {
historicalStream := NewGlob.Stream + "historical"
timeHeader := map[string]string{"X-P-Time-Partition": "source_time"}
CreateStreamWithHeader(t, NewGlob.QueryClient, historicalStream, timeHeader)
if NewGlob.IngestorUrl.String() == "" {
cmd := exec.Command("k6",
"run",
"-e", fmt.Sprintf("P_URL=%s", NewGlob.QueryUrl.String()),
"-e", fmt.Sprintf("P_USERNAME=%s", NewGlob.QueryUsername),
"-e", fmt.Sprintf("P_PASSWORD=%s", NewGlob.QueryPassword),
"-e", fmt.Sprintf("P_STREAM=%s", historicalStream),
"-e", fmt.Sprintf("P_SCHEMA_COUNT=%s", schema_count),
"./scripts/load_single_events.js",
"--vus=", vus,
"--duration=", duration)

cmd.Run()
op, err := cmd.Output()
if err != nil {
t.Log(err)
}
t.Log(string(op))
} else {
cmd := exec.Command("k6",
"run",
"-e", fmt.Sprintf("P_URL=%s", NewGlob.IngestorUrl.String()),
"-e", fmt.Sprintf("P_USERNAME=%s", NewGlob.IngestorUsername),
"-e", fmt.Sprintf("P_PASSWORD=%s", NewGlob.IngestorPassword),
"-e", fmt.Sprintf("P_STREAM=%s", historicalStream),
"-e", fmt.Sprintf("P_SCHEMA_COUNT=%s", schema_count),
"./scripts/load_single_events.js",
"--vus=", vus,
"--duration=", duration)

cmd.Run()
op, err := cmd.Output()
if err != nil {
t.Log(err)
}
t.Log(string(op))
}

DeleteStream(t, NewGlob.QueryClient, historicalStream)
}
}

func TestLoadStreamNoBatchWithCustomPartitionWithK6(t *testing.T) {
customPartitionStream := NewGlob.Stream + "custompartition"
customHeader := map[string]string{"X-P-Custom-Partition": "level,os"}
CreateStreamWithHeader(t, NewGlob.QueryClient, customPartitionStream, customHeader)
if NewGlob.IngestorUrl.String() == "" {
cmd := exec.Command("k6",
"run",
"-e", fmt.Sprintf("P_URL=%s", NewGlob.QueryUrl.String()),
"-e", fmt.Sprintf("P_USERNAME=%s", NewGlob.QueryUsername),
"-e", fmt.Sprintf("P_PASSWORD=%s", NewGlob.QueryPassword),
"-e", fmt.Sprintf("P_STREAM=%s", customPartitionStream),
"-e", fmt.Sprintf("P_SCHEMA_COUNT=%s", schema_count),
"./scripts/load_single_events.js",
"--vus=", vus,
"--duration=", duration)

cmd.Run()
op, err := cmd.Output()
if err != nil {
t.Log(err)
}
t.Log(string(op))
} else {
cmd := exec.Command("k6",
"run",
"-e", fmt.Sprintf("P_URL=%s", NewGlob.IngestorUrl.String()),
"-e", fmt.Sprintf("P_USERNAME=%s", NewGlob.IngestorUsername),
"-e", fmt.Sprintf("P_PASSWORD=%s", NewGlob.IngestorPassword),
"-e", fmt.Sprintf("P_STREAM=%s", customPartitionStream),
"-e", fmt.Sprintf("P_SCHEMA_COUNT=%s", schema_count),
"./scripts/load_single_events.js",
"--vus=", vus,
"--duration=", duration)

cmd.Run()
op, err := cmd.Output()
if err != nil {
t.Log(err)
}
t.Log(string(op))
}

DeleteStream(t, NewGlob.QueryClient, customPartitionStream)
}

func TestLoadStreamNoBatchWithTimeAndCustomPartitionWithK6(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"}
CreateStreamWithHeader(t, NewGlob.QueryClient, customPartitionStream, customHeader)
if NewGlob.IngestorUrl.String() == "" {
cmd := exec.Command("k6",
"run",
"-e", fmt.Sprintf("P_URL=%s", NewGlob.QueryUrl.String()),
"-e", fmt.Sprintf("P_USERNAME=%s", NewGlob.QueryUsername),
"-e", fmt.Sprintf("P_PASSWORD=%s", NewGlob.QueryPassword),
"-e", fmt.Sprintf("P_STREAM=%s", customPartitionStream),
"-e", fmt.Sprintf("P_SCHEMA_COUNT=%s", schema_count),
"./scripts/load_single_events.js",
"--vus=", vus,
"--duration=", duration)

cmd.Run()
op, err := cmd.Output()
if err != nil {
t.Log(err)
}
t.Log(string(op))
} else {
cmd := exec.Command("k6",
"run",
"-e", fmt.Sprintf("P_URL=%s", NewGlob.IngestorUrl.String()),
"-e", fmt.Sprintf("P_USERNAME=%s", NewGlob.IngestorUsername),
"-e", fmt.Sprintf("P_PASSWORD=%s", NewGlob.IngestorPassword),
"-e", fmt.Sprintf("P_STREAM=%s", customPartitionStream),
"-e", fmt.Sprintf("P_SCHEMA_COUNT=%s", schema_count),
"./scripts/load_single_events.js",
"--vus=", vus,
"--duration=", duration)

cmd.Run()
op, err := cmd.Output()
if err != nil {
t.Log(err)
}
t.Log(string(op))
}

DeleteStream(t, NewGlob.QueryClient, customPartitionStream)
}
}

func TestDeleteStream(t *testing.T) {
DeleteStream(t, NewGlob.QueryClient, NewGlob.Stream)
}
8 changes: 2 additions & 6 deletions scripts/smoke.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,8 @@ export const options = {
};

function current_time() {
const startDate = new Date('2024-05-17T15:00:00');
const endDate = new Date('2024-05-17T15:03:59');
const timeDiff = endDate.getTime() - startDate.getTime();
const randomTime = Math.random() * timeDiff;
const randomDate = new Date(startDate.getTime() + randomTime);
return(randomDate.toISOString());
let event = new Date();
return event.toISOString();
}

function schemas() {
Expand Down
Loading
Loading