Skip to content

Commit

Permalink
Add additional check of netperf output (cloud-bulldozer#112)
Browse files Browse the repository at this point in the history
If the netperf output isn't a specific length, error out

Signed-off-by: Joe Talerico <rook@redhat.com>
Co-authored-by: Joe Talerico <rook@redhat.com>
  • Loading branch information
jtaleric and Joe Talerico committed Oct 12, 2023
1 parent 35f19c2 commit 4e93887
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/netperf/netperf.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ func ParseResults(stdout *bytes.Buffer) (sample.Sample, error) {
sample.Driver = workload
send := 0.0
recv := 0.0
if len(strings.Split(stdout.String(), "\n")) < 5 {
return sample, fmt.Errorf("Length of output from netperf was too short.")
}
for _, line := range strings.Split(stdout.String(), "\n") {
l := strings.Split(line, "=")
if len(l) < 2 {
Expand Down

0 comments on commit 4e93887

Please sign in to comment.