Skip to content

Commit

Permalink
functional_tests: fix cgroups task limit test
Browse files Browse the repository at this point in the history
  • Loading branch information
adnxn committed Jan 25, 2018
1 parent c19660e commit 4e7b2ad
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion agent/config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,6 @@ type Config struct {
// driver authentication over the task's execution role
OverrideAWSLogsExecutionRole bool

// The expected Cgroup root path in the agent
// The expected Cgroup path in the agent is /sys/fs/cgroup
CgroupPath string
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"family": "ecsftest-oom-task",
"memory": "256",
"memory": 512,
"containerDefinitions": [{
"essential": true,
"name": "error",
Expand Down
2 changes: 2 additions & 0 deletions agent/functional_tests/tests/functionaltests_unix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ func TestOOMTask(t *testing.T) {
agent := RunAgent(t, nil)
defer agent.Cleanup()

agent.RequireVersion(">=1.16.0")

testTask, err := agent.StartTask(t, "oom-task")
require.NoError(t, err, "Expected to start invalid-image task")
err = testTask.ExpectErrorType("error", "OutOfMemoryError", 1*time.Minute)
Expand Down
3 changes: 2 additions & 1 deletion agent/resources/resources_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ func (c *cgroupWrapper) ApplyConfigDependencies(cfg *config.Config) {
c.cgroupPath = cfg.CgroupPath
}

// cgroupInit is used to create the root '/ecs/ cgroup
// cgroupInit is used to create the root '/ecs/ cgroup and enable
// memory.use_hierarchy at the '/ecs/' level
func (c *cgroupWrapper) cgroupInit() error {
if c.control.Exists(config.DefaultTaskCgroupPrefix) {
seelog.Debugf("Cgroup at %s already exists, skipping creation", config.DefaultTaskCgroupPrefix)
Expand Down
3 changes: 1 addition & 2 deletions agent/resources/resources_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ package resources

import (
"errors"
"fmt"
"testing"

"github.com/aws/amazon-ecs-agent/agent/api"
Expand All @@ -43,7 +42,7 @@ func TestInitHappyPath(t *testing.T) {

mockControl := mock_cgroup.NewMockControl(ctrl)
mockIO := mock_ioutilwrapper.NewMockIOUtil(ctrl)
cgroupPath := fmt.Sprintf("/sys/fs/cgroup/memory/ecs/memory.use_hierarchy")
cgroupPath := "/sys/fs/cgroup/memory/ecs/memory.use_hierarchy"

gomock.InOrder(
mockControl.EXPECT().Exists(gomock.Any()).Return(false),
Expand Down

0 comments on commit 4e7b2ad

Please sign in to comment.