Skip to content

Commit

Permalink
Fix the command arguments reconstruction
Browse files Browse the repository at this point in the history
  • Loading branch information
jmontesi committed Oct 30, 2023
1 parent bc374b8 commit 4b25c67
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions cnf-certification-test/performance/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,21 +237,21 @@ func getExecProbesCmds(c *provider.Container) map[string]bool {
cmds := map[string]bool{}

if c.LivenessProbe != nil && c.LivenessProbe.Exec != nil {
for _, cmd := range c.LivenessProbe.Exec.Command {
cmds[cmd] = true
}
cmd := strings.Join(c.LivenessProbe.Exec.Command, "")
cmd = strings.Join(strings.Fields(cmd), "")
cmds[cmd] = true
}

if c.ReadinessProbe != nil && c.ReadinessProbe.Exec != nil {
for _, cmd := range c.ReadinessProbe.Exec.Command {
cmds[cmd] = true
}
cmd := strings.Join(c.ReadinessProbe.Exec.Command, "")
cmd = strings.Join(strings.Fields(cmd), "")
cmds[cmd] = true
}

if c.StartupProbe != nil && c.StartupProbe.Exec.Command != nil {
for _, cmd := range c.StartupProbe.Exec.Command {
cmds[cmd] = true
}
cmd := strings.Join(c.StartupProbe.Exec.Command, "")
cmd = strings.Join(strings.Fields(cmd), "")
cmds[cmd] = true
}

return cmds
Expand All @@ -278,7 +278,7 @@ func testRtAppsNoExecProbes(env *provider.TestEnvironment, cuts []*provider.Cont
execProbesCmds := getExecProbesCmds(cut)
allProcessesCompliant := true
for _, p := range processes {
if execProbesCmds[p.Args] {
if execProbesCmds[strings.Join(strings.Fields(p.Args), "")] {
compliantObjects = append(compliantObjects, testhelper.NewContainerReportObject(cut.Namespace, cut.Podname, cut.Name, "Container process belongs to an exec probe (skipping verification)", true).
AddField(testhelper.ProcessID, strconv.Itoa(p.Pid)).
AddField(testhelper.ProcessCommandLine, p.Args))
Expand Down

0 comments on commit 4b25c67

Please sign in to comment.