Skip to content

Commit

Permalink
test: update tests for SYS_PTRACE toggle
Browse files Browse the repository at this point in the history
Signed-off-by: Dylan Spagnuolo <[email protected]>
  • Loading branch information
dylanspag-lmco committed Sep 17, 2024
1 parent e9868c8 commit 7a9915a
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions flyteplugins/go/tasks/pluginmachinery/flytek8s/copilot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ func TestFlyteCoPilotContainer(t *testing.T) {
StartTimeout: config2.Duration{
Duration: time.Second * 1,
},
CPU: "1024m",
Memory: "1024Mi",
CPU: "1024m",
Memory: "1024Mi",
AddSysPTraceCapability: false,
}

t.Run("happy", func(t *testing.T) {
Expand All @@ -55,6 +56,7 @@ func TestFlyteCoPilotContainer(t *testing.T) {
assert.Equal(t, "/", c.WorkingDir)
assert.Equal(t, 2, len(c.Resources.Limits))
assert.Equal(t, 2, len(c.Resources.Requests))
assert.NotContains(t, c.SecurityContext.Capabilities.Add, pTraceCapability)
})

t.Run("happy stow backend", func(t *testing.T) {
Expand All @@ -72,6 +74,7 @@ func TestFlyteCoPilotContainer(t *testing.T) {
assert.Equal(t, "/", c.WorkingDir)
assert.Equal(t, 2, len(c.Resources.Limits))
assert.Equal(t, 2, len(c.Resources.Requests))
assert.NotContains(t, c.SecurityContext.Capabilities.Add, pTraceCapability)
})

t.Run("happy-vols", func(t *testing.T) {
Expand Down Expand Up @@ -107,6 +110,15 @@ func TestFlyteCoPilotContainer(t *testing.T) {
assert.Error(t, err)
cfg.Memory = old
})

t.Run("sys-ptrace-add", func(t *testing.T) {
old := cfg.AddSysPTraceCapability
cfg.AddSysPTraceCapability = true
c, err := FlyteCoPilotContainer("x", cfg, []string{"hello"})
assert.NoError(t, err)
assert.Contains(t, c.SecurityContext.Capabilities.Add, pTraceCapability)
cfg.AddSysPTraceCapability = old
})
}

func TestDownloadCommandArgs(t *testing.T) {
Expand Down

0 comments on commit 7a9915a

Please sign in to comment.