Skip to content

Commit

Permalink
Add context to benchmark commands
Browse files Browse the repository at this point in the history
Closes: submariner-io#1311

Signed-off-by: Janki Chhatbar <[email protected]>
  • Loading branch information
Jaanki authored and tpantelis committed May 11, 2021
1 parent 3a7407d commit 29f5556
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 18 deletions.
22 changes: 13 additions & 9 deletions pkg/subctl/benchmark/latency.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,13 @@ func StartLatencyTests(intraCluster bool) {

f = initFramework("latency")

clusterAName := framework.TestContext.ClusterIDs[framework.ClusterA]

if !intraCluster {
clusterBName := framework.TestContext.ClusterIDs[framework.ClusterB]

if framework.TestContext.GlobalnetEnabled {
By("Latency test is not supported with Globalnet enabled, skipping the test...")
fmt.Println("Latency test is not supported with Globalnet enabled, skipping the test...")
cleanupFramework(f)
return
}
Expand All @@ -62,12 +66,14 @@ func StartLatencyTests(intraCluster bool) {
ClientPodScheduling: framework.GatewayNode,
}

framework.By("Performing latency tests from Gateway pod to Gateway pod")
fmt.Printf("Performing latency tests from Gateway pod on cluster %q to Gateway pod on cluster %q\n",
clusterAName, clusterBName)
runLatencyTest(f, latencyTestParams)

latencyTestParams.ServerPodScheduling = framework.NonGatewayNode
latencyTestParams.ClientPodScheduling = framework.NonGatewayNode
framework.By("Performing latency tests from Non-Gateway pod to Non-Gateway pod")
fmt.Printf("Performing latency tests from Non-Gateway pod on cluster %q to Non-Gateway pod on cluster %q\n",
clusterAName, clusterBName)
runLatencyTest(f, latencyTestParams)
} else {
latencyTestIntraClusterParams := benchmarkTestParams{
Expand All @@ -76,9 +82,7 @@ func StartLatencyTests(intraCluster bool) {
ServerPodScheduling: framework.GatewayNode,
ClientPodScheduling: framework.NonGatewayNode,
}

clusterAName := framework.TestContext.ClusterIDs[framework.ClusterA]
framework.By(fmt.Sprintf("Performing latency tests from Non-Gateway pod to Gateway pod on cluster %q", clusterAName))
fmt.Printf("Performing latency tests from Non-Gateway pod to Gateway pod on cluster %q\n", clusterAName)
runLatencyTest(f, latencyTestIntraClusterParams)
}

Expand All @@ -91,7 +95,7 @@ func runLatencyTest(f *framework.Framework, testParams benchmarkTestParams) {
var connectionTimeout uint = 5
var connectionAttempts uint = 1

framework.By(fmt.Sprintf("Creating a Nettest Server Pod on %q", clusterBName))
By(fmt.Sprintf("Creating a Nettest Server Pod on %q", clusterBName))
nettestServerPod := f.NewNetworkPod(&framework.NetworkPodConfig{
Type: framework.LatencyServerPod,
Cluster: testParams.ServerCluster,
Expand All @@ -115,10 +119,10 @@ func runLatencyTest(f *framework.Framework, testParams benchmarkTestParams) {
ConnectionAttempts: connectionAttempts,
})

framework.By(fmt.Sprintf("Nettest Client Pod %q was created on cluster %q, node %q; connect to server pod ip %q",
By(fmt.Sprintf("Nettest Client Pod %q was created on cluster %q, node %q; connect to server pod ip %q",
nettestClientPod.Pod.Name, clusterAName, nettestClientPod.Pod.Spec.NodeName, remoteIP))

framework.By(fmt.Sprintf("Waiting for the client pod %q to exit, returning what client sent", nettestClientPod.Pod.Name))
By(fmt.Sprintf("Waiting for the client pod %q to exit, returning what client sent", nettestClientPod.Pod.Name))
nettestClientPod.AwaitFinishVerbose(Verbose)
nettestClientPod.CheckSuccessfulFinish()
latencyHeaders := strings.Split(nettestClientPod.TerminationMessage, "\n")[1]
Expand Down
18 changes: 9 additions & 9 deletions pkg/subctl/benchmark/throughput.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ func StartThroughputTests(intraCluster bool) {
}

clusterBName := framework.TestContext.ClusterIDs[framework.ClusterB]
framework.By(fmt.Sprintf("Performing throughput tests from Gateway pod on cluster %q to Gateway pod on cluster %q",
clusterAName, clusterBName))
fmt.Printf("Performing throughput tests from Gateway pod on cluster %q to Gateway pod on cluster %q\n",
clusterAName, clusterBName)
runThroughputTest(f, testParams)

testParams.ServerPodScheduling = framework.NonGatewayNode
testParams.ClientPodScheduling = framework.NonGatewayNode

framework.By(fmt.Sprintf("Performing throughput tests from Non-Gateway pod on cluster %q to Non-Gateway pod on cluster %q",
clusterAName, clusterBName))
fmt.Printf("Performing throughput tests from Non-Gateway pod on cluster %q to Non-Gateway pod on cluster %q\n",
clusterAName, clusterBName)
runThroughputTest(f, testParams)
} else {
testIntraClusterParams := benchmarkTestParams{
Expand All @@ -71,7 +71,7 @@ func StartThroughputTests(intraCluster bool) {
ClientPodScheduling: framework.NonGatewayNode,
}

framework.By(fmt.Sprintf("Performing throughput tests from Non-Gateway pod to Gateway pod on cluster %q", clusterAName))
fmt.Printf("Performing throughput tests from Non-Gateway pod to Gateway pod on cluster %q\n", clusterAName)
runThroughputTest(f, testIntraClusterParams)
}

Expand Down Expand Up @@ -106,7 +106,7 @@ func runThroughputTest(f *framework.Framework, testParams benchmarkTestParams) {
var connectionAttempts uint = 2
var iperf3Port = 5201

framework.By(fmt.Sprintf("Creating a Nettest Server Pod on %q", serverClusterName))
By(fmt.Sprintf("Creating a Nettest Server Pod on %q", serverClusterName))
nettestServerPod := f.NewNetworkPod(&framework.NetworkPodConfig{
Type: framework.ThroughputServerPod,
Cluster: testParams.ServerCluster,
Expand All @@ -118,7 +118,7 @@ func runThroughputTest(f *framework.Framework, testParams benchmarkTestParams) {

podsClusterB := framework.KubeClients[testParams.ServerCluster].CoreV1().Pods(f.Namespace)
p1, _ := podsClusterB.Get(context.TODO(), nettestServerPod.Pod.Name, metav1.GetOptions{})
framework.By(fmt.Sprintf("Nettest Server Pod %q was created on node %q", nettestServerPod.Pod.Name, nettestServerPod.Pod.Spec.NodeName))
By(fmt.Sprintf("Nettest Server Pod %q was created on node %q", nettestServerPod.Pod.Name, nettestServerPod.Pod.Spec.NodeName))

remoteIP := p1.Status.PodIP

Expand All @@ -144,10 +144,10 @@ func runThroughputTest(f *framework.Framework, testParams benchmarkTestParams) {
Port: iperf3Port,
})

framework.By(fmt.Sprintf("Nettest Client Pod %q was created on cluster %q, node %q; connect to server pod ip %q",
By(fmt.Sprintf("Nettest Client Pod %q was created on cluster %q, node %q; connect to server pod ip %q",
nettestClientPod.Pod.Name, clientClusterName, nettestClientPod.Pod.Spec.NodeName, remoteIP))

framework.By(fmt.Sprintf("Waiting for the client pod %q to exit, returning what client sent", nettestClientPod.Pod.Name))
By(fmt.Sprintf("Waiting for the client pod %q to exit, returning what client sent", nettestClientPod.Pod.Name))
nettestClientPod.AwaitFinishVerbose(Verbose)
nettestClientPod.CheckSuccessfulFinish()
fmt.Println(nettestClientPod.TerminationMessage)
Expand Down

0 comments on commit 29f5556

Please sign in to comment.