-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(executor): Move exit code capture to controller. See #5251
Signed-off-by: Alex Collins <alex_collins@intuit.com>
- Loading branch information
Showing
2 changed files
with
151 additions
and
24 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package pns | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestPNSExecutor_parseContainerIDFromCgroupLine(t *testing.T) { | ||
testCases := []struct { | ||
line string | ||
expected string | ||
}{ | ||
{ | ||
line: "", | ||
expected: "", | ||
}, | ||
{ | ||
line: "5:rdma:/", | ||
expected: "", | ||
}, | ||
{ | ||
line: "8:cpu,cpuacct:/kubepods/besteffort/pod2fad8aad-dcd0-4fef-b45a-151630b9a4b5/b844ef90162af07ad3fb2961ffb2f528f8bf7c9edb8c45465fd8651fab8a78c1", | ||
expected: "b844ef90162af07ad3fb2961ffb2f528f8bf7c9edb8c45465fd8651fab8a78c1", | ||
}, | ||
{ | ||
line: "2:cpu,cpuacct:/system.slice/containerd.service/kubepods-burstable-podf61fae9b_d7a7_11ea_bb0c_12a065621d2b.slice:cri-containerd:b6b894a028b7ec8e0f98c57a5f7b9735ad792276c3ce52bc795fcd367d829de9", | ||
expected: "b6b894a028b7ec8e0f98c57a5f7b9735ad792276c3ce52bc795fcd367d829de9", | ||
}, | ||
{ | ||
line: "8:cpu,cpuacct:/kubepods/besteffort/pod2fad8aad-dcd0-4fef-b45a-151630b9a4b5/crio-7a92a067289f6197148912be1c15f20f0330c7f3c541473d3b9c4043ca137b42.scope", | ||
expected: "7a92a067289f6197148912be1c15f20f0330c7f3c541473d3b9c4043ca137b42", | ||
}, | ||
{ | ||
line: "2:cpuacct,cpu:/kubepods.slice/kubepods-burstable.slice/kubepods-burstable-pod1cd87fe8_8ea0_11ea_8d51_566f300c000a.slice/docker-6b40fc7f75fe3210621a287412ac056e43554b1026a01625b48ba7d136d8a125.scope", | ||
expected: "6b40fc7f75fe3210621a287412ac056e43554b1026a01625b48ba7d136d8a125", | ||
}, | ||
} | ||
|
||
for _, testCase := range testCases { | ||
containerID := parseContainerIDFromCgroupLine(testCase.line) | ||
assert.Equal(t, testCase.expected, containerID) | ||
} | ||
} |