Skip to content

Commit

Permalink
pids_limit: Add test.
Browse files Browse the repository at this point in the history
Signed-off-by: Shishir Mahajan <smahajan@roblox.com>
  • Loading branch information
shishir-a412ed committed Nov 17, 2021
1 parent 124765c commit 51da191
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions drivers/docker/driver_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,27 @@ func TestDockerDriver_authFromHelper(t *testing.T) {
require.Equal(t, "registry.local:5000", string(content))
}

func TestDockerDriver_PluginConfig_PidsLimit(t *testing.T) {
t.Parallel()

dh := dockerDriverHarness(t, nil)
driver := dh.Impl().(*Driver)
driver.config.PidsLimit = 5

task, cfg, ports := dockerTask(t)
defer freeport.Return(ports)
require.NoError(t, task.EncodeConcreteDriverConfig(cfg))

c, err := driver.createContainerConfig(task, cfg, "org/repo:0.1")
require.NoError(t, err)
require.Equal(t, 5, c.HostConfig.PidsLimit)

cfg.PidsLimit = 7
_, err = driver.createContainerConfig(task, cfg, "org/repo:0.1")
require.Error(t, err)
require.Contains(t, err.Error(), `pids_limit cannot be greater than nomad plugin config pids_limit`)
}

func TestDockerDriver_PidsLimit(t *testing.T) {
if !tu.IsCI() {
t.Parallel()
Expand Down

0 comments on commit 51da191

Please sign in to comment.