forked from pixie-io/pixie
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PP-3222 - Create client for HTTP sequence tests
Summary: This is the first pass at the client for HTTP requests only. I'll do some reorganization of the directories after this lands for more consistency. Test Plan: Run manually ```./client seq http --addr http://xyz:8080/seq_test -n 100000 -c 50 -s 2000000 -r 1024` Reviewers: vihang, michelle, nserrino Reviewed By: nserrino JIRA Issues: PP-3222 Signed-off-by: Zain Asgar <zasgar@pixielabs.ai> Differential Revision: https://phab.corp.pixielabs.ai/D10796 GitOrigin-RevId: 14f490a
- Loading branch information
1 parent
dc168b6
commit 1e43e0d
Showing
11 changed files
with
426 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Copyright 2018- The Pixie Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
load("@io_bazel_rules_go//go:def.bzl", "go_library") | ||
|
||
go_library( | ||
name = "client", | ||
srcs = ["client.go"], | ||
importpath = "px.dev/pixie/src/e2e_test/vizier/seq_tests/client", | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
"//src/e2e_test/vizier/seq_tests/client/cmd", | ||
"@com_github_sirupsen_logrus//:logrus", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright 2018- The Pixie Authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package main | ||
|
||
import ( | ||
log "github.com/sirupsen/logrus" | ||
|
||
"px.dev/pixie/src/e2e_test/vizier/seq_tests/client/cmd" | ||
) | ||
|
||
func main() { | ||
if err := cmd.RootCmd.Execute(); err != nil { | ||
log.WithError(err). | ||
Error("Failed to execute load test client") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Copyright 2018- The Pixie Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
load("@io_bazel_rules_go//go:def.bzl", "go_library") | ||
|
||
go_library( | ||
name = "cmd", | ||
srcs = [ | ||
"root.go", | ||
"seq.go", | ||
"seq_http.go", | ||
], | ||
importpath = "px.dev/pixie/src/e2e_test/vizier/seq_tests/client/cmd", | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
"//src/e2e_test/vizier/seq_tests/client/pkg/httpclient", | ||
"@com_github_sirupsen_logrus//:logrus", | ||
"@com_github_spf13_cobra//:cobra", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright 2018- The Pixie Authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package cmd | ||
|
||
import ( | ||
"crypto/tls" | ||
"net/http" | ||
"time" | ||
|
||
log "github.com/sirupsen/logrus" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func init() { | ||
RootCmd.PersistentFlags().StringP("addr", "a", "https://localhost:5001", "The address of the server with protocol") | ||
RootCmd.PersistentFlags().BoolP("skip_verify", "k", false, "Skip SSL verification (if SSL is used)") | ||
|
||
RootCmd.AddCommand(SeqCmd) | ||
} | ||
|
||
// RootCmd is the base command for this CLI. | ||
var RootCmd = &cobra.Command{ | ||
Use: "ltc", | ||
Short: "Load Test Client", | ||
Long: "This is the load test client to test Pixie under various conditions", | ||
PersistentPreRun: func(cmd *cobra.Command, args []string) { | ||
log.WithField("time", time.Now()). | ||
Info("Starting Load Test Client") | ||
if skip, _ := cmd.Flags().GetBool("skip_verify"); skip { | ||
http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true} | ||
} | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright 2018- The Pixie Authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package cmd | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func init() { | ||
SeqCmd.AddCommand(HTTPSeqCmd) | ||
} | ||
|
||
// SeqCmd is the base of all sequence tests. | ||
var SeqCmd = &cobra.Command{ | ||
Use: "seq", | ||
Short: "Run sequence related tests", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* Copyright 2018- The Pixie Authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package cmd | ||
|
||
import ( | ||
log "github.com/sirupsen/logrus" | ||
"github.com/spf13/cobra" | ||
|
||
"px.dev/pixie/src/e2e_test/vizier/seq_tests/client/pkg/httpclient" | ||
) | ||
|
||
func init() { | ||
HTTPSeqCmd.PersistentFlags().IntP("start_sequence", "s", 0, "The start sequence number of the messages") | ||
HTTPSeqCmd.PersistentFlags().IntP("num_messages", "n", 10, "Number of messages to send") | ||
HTTPSeqCmd.PersistentFlags().IntP("num_conns", "c", 10, "Number of concurrent connections") | ||
HTTPSeqCmd.PersistentFlags().IntP("req_size", "r", 16, "The size of the request body") | ||
HTTPSeqCmd.PersistentFlags().IntP("resp_size", "z", 16, "The size of the response body") | ||
} | ||
|
||
// HTTPSeqCmd is the generates HTTP sequence messages. | ||
var HTTPSeqCmd = &cobra.Command{ | ||
Use: "http", | ||
Short: "HTTP Sequence Load Test", | ||
Long: "Run the HTTP/1.1 sequence load test", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
addr, _ := cmd.Flags().GetString("addr") | ||
startSequence, _ := cmd.Flags().GetInt("start_sequence") | ||
numMessages, _ := cmd.Flags().GetInt("num_messages") | ||
numConns, _ := cmd.Flags().GetInt("num_conns") | ||
reqSize, _ := cmd.Flags().GetInt("req_size") | ||
respSize, _ := cmd.Flags().GetInt("resp_size") | ||
log. | ||
WithField("addr", addr). | ||
WithField("start_sequence", startSequence). | ||
WithField("num_messages", numMessages). | ||
WithField("num_conns", numConns). | ||
WithField("req_size", reqSize). | ||
WithField("resp_size", respSize). | ||
Info("Running HTTP sequence tests") | ||
|
||
c := httpclient.New(addr, startSequence, numMessages, numConns, reqSize, respSize) | ||
_ = c.Run() | ||
_ = c.PrintStats() | ||
}, | ||
} |
28 changes: 28 additions & 0 deletions
28
src/e2e_test/vizier/seq_tests/client/pkg/httpclient/BUILD.bazel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Copyright 2018- The Pixie Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
load("@io_bazel_rules_go//go:def.bzl", "go_library") | ||
|
||
go_library( | ||
name = "httpclient", | ||
srcs = ["client.go"], | ||
importpath = "px.dev/pixie/src/e2e_test/vizier/seq_tests/client/pkg/httpclient", | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
"//src/e2e_test/util", | ||
"@com_github_sirupsen_logrus//:logrus", | ||
], | ||
) |
Oops, something went wrong.