Skip to content

Commit

Permalink
Add two more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
haikuoliu committed Mar 30, 2018
1 parent c341705 commit 3fc6520
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions agent/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,16 @@ func TestInvalidFormatDockerStopTimeout(t *testing.T) {
assert.Equal(t, conf.DockerStopTimeout, defaultDockerStopTimeout, "Wrong value for DockerStopTimeout")
}

func TestZeroValueDockerStopTimeout(t *testing.T) {
defer setTestRegion()()
defer setTestEnv("ECS_CONTAINER_STOP_TIMEOUT", "0s")()
ctrl := gomock.NewController(t)
mockEc2Metadata := mock_ec2.NewMockEC2MetadataClient(ctrl)
conf, err := NewConfig(mockEc2Metadata)
assert.NoError(t, err)
assert.Equal(t, conf.DockerStopTimeout, defaultDockerStopTimeout, "Wrong value for DockerStopTimeout")
}

func TestInvalidValueDockerStopTimeout(t *testing.T) {
defer setTestRegion()()
defer setTestEnv("ECS_CONTAINER_STOP_TIMEOUT", "-10s")()
Expand All @@ -225,6 +235,16 @@ func TestInvalidFormatContainerStartTimeout(t *testing.T) {
assert.Equal(t, conf.ContainerStartTimeout, defaultContainerStartTimeout, "Wrong value for ContainerStartTimeout")
}

func TestZeroValueContainerStartTimeout(t *testing.T) {
defer setTestRegion()()
defer setTestEnv("ECS_CONTAINER_START_TIMEOUT", "0s")()
ctrl := gomock.NewController(t)
mockEc2Metadata := mock_ec2.NewMockEC2MetadataClient(ctrl)
conf, err := NewConfig(mockEc2Metadata)
assert.NoError(t, err)
assert.Equal(t, conf.ContainerStartTimeout, defaultContainerStartTimeout, "Wrong value for ContainerStartTimeout")
}

func TestInvalidValueContainerStartTimeout(t *testing.T) {
defer setTestRegion()()
defer setTestEnv("ECS_CONTAINER_START_TIMEOUT", "-10s")()
Expand Down

0 comments on commit 3fc6520

Please sign in to comment.