From 7cc0eed2db5b30ca42dc3265acd91ec3aabbee0f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 7 Nov 2023 14:08:04 +0200 Subject: [PATCH 1/3] Update RHCOS to OCP version map (#1591) Co-authored-by: sebrandon1 --- .../platform/operatingsystem/files/rhcos_version_map | 1 + 1 file changed, 1 insertion(+) diff --git a/cnf-certification-test/platform/operatingsystem/files/rhcos_version_map b/cnf-certification-test/platform/operatingsystem/files/rhcos_version_map index 47df6aff8..386a8c385 100644 --- a/cnf-certification-test/platform/operatingsystem/files/rhcos_version_map +++ b/cnf-certification-test/platform/operatingsystem/files/rhcos_version_map @@ -218,6 +218,7 @@ 4.13.18 / 413.92.202310170351-0 4.13.19 / 413.92.202310210500-0 4.13.2 / 413.92.202305302312-0 +4.13.21 / 413.92.202310210500-0 4.13.3 / 413.92.202306070210-0 4.13.4 / 413.92.202306141213-0 4.13.5 / 413.92.202307140015-0 From ac209bcca17df29c12be3e9c1fd0c5e977227608 Mon Sep 17 00:00:00 2001 From: David Elie-Dit-Cosaque <86730676+edcdavid@users.noreply.github.com> Date: Tue, 7 Nov 2023 08:49:28 -0600 Subject: [PATCH 2/3] Updating the HTML parser to the latest version (v0.1.3) (#1587) --- version.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.json b/version.json index e8bd2e579..28ae5575f 100644 --- a/version.json +++ b/version.json @@ -1,5 +1,5 @@ { "partner_tag": "v4.5.4", "claimFormat": "v0.1.0", - "parserTag": "v0.1.2" + "parserTag": "v0.1.3" } From 551d84b4e7a67f6cb027ff0818995b142c63bade Mon Sep 17 00:00:00 2001 From: David Elie-Dit-Cosaque <86730676+edcdavid@users.noreply.github.com> Date: Tue, 7 Nov 2023 13:30:34 -0600 Subject: [PATCH 3/3] Do not consider the exec probes in performance-rt-apps-no-exec-probes (#1590) * Do not consider the exec probes in the performance-rt-apps-no-exec-probes test. Reverts commit d7dc6cd1d4d482b1b8e39e4c3789429c5785fd9a and adds logic to whitelist processes belonging to the exec probes. * addressing comments from David R. --- cnf-certification-test/performance/suite.go | 53 ++++++++++++++++++++- internal/crclient/crclient.go | 15 ++++-- 2 files changed, 62 insertions(+), 6 deletions(-) diff --git a/cnf-certification-test/performance/suite.go b/cnf-certification-test/performance/suite.go index f5659754f..fad47e3d1 100644 --- a/cnf-certification-test/performance/suite.go +++ b/cnf-certification-test/performance/suite.go @@ -233,6 +233,30 @@ func testSchedulingPolicyInCPUPool(env *provider.TestEnvironment, testhelper.AddTestResultReason(compliantContainersPids, nonCompliantContainersPids, tnf.ClaimFilePrintf, ginkgo.Fail) } +func getExecProbesCmds(c *provider.Container) map[string]bool { + cmds := map[string]bool{} + + if c.LivenessProbe != nil && c.LivenessProbe.Exec != nil { + cmd := strings.Join(c.LivenessProbe.Exec.Command, "") + cmd = strings.Join(strings.Fields(cmd), "") + cmds[cmd] = true + } + + if c.ReadinessProbe != nil && c.ReadinessProbe.Exec != nil { + cmd := strings.Join(c.ReadinessProbe.Exec.Command, "") + cmd = strings.Join(strings.Fields(cmd), "") + cmds[cmd] = true + } + + if c.StartupProbe != nil && c.StartupProbe.Exec != nil { + cmd := strings.Join(c.StartupProbe.Exec.Command, "") + cmd = strings.Join(strings.Fields(cmd), "") + cmds[cmd] = true + } + + return cmds +} + const noProcessFoundErrMsg = "No such process" func testRtAppsNoExecProbes(env *provider.TestEnvironment, cuts []*provider.Container) { @@ -251,8 +275,10 @@ func testRtAppsNoExecProbes(env *provider.TestEnvironment, cuts []*provider.Cont break } + notExecProbeProcesses, compliantObjectsProbes := filterProbeProcesses(processes, cut) + compliantObjects = append(compliantObjects, compliantObjectsProbes...) allProcessesCompliant := true - for _, p := range processes { + for _, p := range notExecProbeProcesses { schedPolicy, _, err := scheduling.GetProcessCPUScheduling(p.Pid, cut) if err != nil { // If the process does not exist anymore it means that it has finished since the time the process list @@ -284,3 +310,28 @@ func testRtAppsNoExecProbes(env *provider.TestEnvironment, cuts []*provider.Cont } testhelper.AddTestResultReason(compliantObjects, nonCompliantObjects, tnf.ClaimFilePrintf, ginkgo.Fail) } + +func filterProbeProcesses(allProcesses []*crclient.Process, cut *provider.Container) (notExecProbeProcesses []*crclient.Process, compliantObjects []*testhelper.ReportObject) { + execProbeProcesses := []int{} + execProbesCmds := getExecProbesCmds(cut) + // find all exec probes by matching command line + for _, p := range allProcesses { + 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)) + execProbeProcesses = append(execProbeProcesses, p.Pid) + } + } + // remove all exec probes and their children from the process list + for _, p := range allProcesses { + for _, parentProbePid := range execProbeProcesses { + if p.Pid == parentProbePid || p.PPid == parentProbePid { + // skip exec probe processes (child or parent) + continue + } + notExecProbeProcesses = append(notExecProbeProcesses, p) + } + } + return notExecProbeProcesses, compliantObjects +} diff --git a/internal/crclient/crclient.go b/internal/crclient/crclient.go index 030e6efd1..a8691adab 100644 --- a/internal/crclient/crclient.go +++ b/internal/crclient/crclient.go @@ -27,11 +27,11 @@ import ( "github.com/test-network-function/cnf-certification-test/pkg/provider" ) -const PsRegex = `(?m)^(\d+?)\s+?(\d+?)\s+?(.*?)$` +const PsRegex = `(?m)^(\d+?)\s+?(\d+?)\s+?(\d+?)\s+?(.*?)$` type Process struct { - PidNs, Pid int - Args string + PidNs, Pid, PPid int + Args string } const ( @@ -140,7 +140,7 @@ func ExecCommandContainerNSEnter(command string, } func GetPidsFromPidNamespace(pidNamespace string, container *provider.Container) (p []*Process, err error) { - const command = "trap \"\" SIGURG ; ps -e -o pidns,pid,args" + const command = "trap \"\" SIGURG ; ps -e -o pidns,pid,ppid,args" env := provider.GetTestEnvironment() ctx, err := GetNodeDebugPodContext(container.NodeName, &env) if err != nil { @@ -170,7 +170,12 @@ func GetPidsFromPidNamespace(pidNamespace string, container *provider.Container) logrus.Errorf("could not convert string %s to integer, err=%s", v[2], err) continue } - p = append(p, &Process{PidNs: aPidNs, Pid: aPid, Args: v[3]}) + aPPid, err := strconv.Atoi(v[3]) + if err != nil { + logrus.Errorf("could not convert string %s to integer, err=%s", v[3], err) + continue + } + p = append(p, &Process{PidNs: aPidNs, Pid: aPid, Args: v[4], PPid: aPPid}) } return p, nil }