Skip to content

Commit 5d8e248

Browse files
test: fix expected container and volume mount count
1 parent d46c37e commit 5d8e248

File tree

5 files changed

+16
-11
lines changed

5 files changed

+16
-11
lines changed

tests/all_dd_disabled_test.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func (s *ECSFargateSuite) TestAllDDDisabled() {
2626

2727
err := json.Unmarshal([]byte(task["container_definitions"]), &containers)
2828
s.NoError(err, "Failed to parse container definitions")
29-
s.Equal(2, len(containers), "Expected 2 containers in the task definition")
29+
s.Equal(3, len(containers), "Expected 2 containers in the task definition")
3030

3131
// Test Agent Container
3232
agentContainer, found := GetContainer(containers, "datadog-agent")
@@ -59,8 +59,11 @@ func (s *ECSFargateSuite) TestAllDDDisabled() {
5959
s.Equal(int32(3), *agentContainer.HealthCheck.Retries, "Agent health check retries should be 3")
6060
s.Equal(int32(60), *agentContainer.HealthCheck.StartPeriod, "Agent health check start period should be 60")
6161

62-
// Verify no mount points (apm/dsd volumes should not be present)
63-
s.Equal(0, len(agentContainer.MountPoints), "Expected no mount points for datadog-agent when features are disabled")
62+
s.Equal(3, len(agentContainer.MountPoints), "Expected 3 mount points when features are disabled")
63+
// Verify none are apm/dsd volume mount points
64+
for _, mountPoint := range agentContainer.MountPoints {
65+
s.NotEqual("dd-socket", *mountPoint.SourceVolume, "Mount point should not be dd-socket")
66+
}
6467

6568
// Test dummy container
6669
dummyContainer, found := GetContainer(containers, "dummy-container")

tests/all_dd_inputs_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func (s *ECSFargateSuite) TestAllDDInputs() {
2525

2626
err := json.Unmarshal([]byte(task["container_definitions"]), &containers)
2727
s.NoError(err, "Failed to parse container definitions")
28-
s.Equal(6, len(containers), "Expected 6 containers in the task definition")
28+
s.Equal(7, len(containers), "Expected 6 containers in the task definition")
2929

3030
// Test Agent Container
3131
agentContainer, found := GetContainer(containers, "datadog-agent")

tests/apm_dsd_tcp_udp_test.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func (s *ECSFargateSuite) TestApmDsdTcpUdp() {
2626

2727
err := json.Unmarshal([]byte(task["container_definitions"]), &containers)
2828
s.NoError(err, "Failed to parse container definitions")
29-
s.Equal(3, len(containers), "Expected 3 containers in the task definition")
29+
s.Equal(4, len(containers), "Expected 3 containers in the task definition")
3030

3131
// Test Agent Container
3232
agentContainer, found := GetContainer(containers, "datadog-agent")
@@ -60,8 +60,11 @@ func (s *ECSFargateSuite) TestApmDsdTcpUdp() {
6060
}
6161
AssertNotEnvVars(s.T(), agentContainer, disabledSocketEnvVars)
6262

63-
// Verify no mount points (as sockets are not used)
64-
s.Equal(0, len(agentContainer.MountPoints), "Expected no mount points for datadog-agent when socket is disabled")
63+
s.Equal(3, len(agentContainer.MountPoints), "Expected 3 mount points when socket is disabled")
64+
// Verify none are apm/dsd volume mount points
65+
for _, mountPoint := range agentContainer.MountPoints {
66+
s.NotEqual("dd-socket", *mountPoint.SourceVolume, "Mount point should not be dd-socket")
67+
}
6568

6669
// Test DogStatsD App Container
6770
dogstatsdContainer, found := GetContainer(containers, "datadog-dogstatsd-app")

tests/logging_only_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func (s *ECSFargateSuite) TestLoggingOnly() {
2626

2727
err := json.Unmarshal([]byte(task["container_definitions"]), &containers)
2828
s.NoError(err, "Failed to parse container definitions")
29-
s.Equal(2, len(containers), "Expected 2 containers in the task definition")
29+
s.Equal(3, len(containers), "Expected 2 containers in the task definition")
3030

3131
// Test Agent Container
3232
agentContainer, found := GetContainer(containers, "datadog-agent")
@@ -73,8 +73,7 @@ func (s *ECSFargateSuite) TestLoggingOnly() {
7373
s.Equal("datadog-log-router", *agentContainer.DependsOn[0].ContainerName, "Agent should depend on datadog-log-router")
7474
s.Equal(types.ContainerConditionHealthy, agentContainer.DependsOn[0].Condition, "Agent should depend on log router being healthy")
7575

76-
// Verify no mount points
77-
s.Equal(0, len(agentContainer.MountPoints), "Expected no mount points for datadog-agent")
76+
s.Equal(3, len(agentContainer.MountPoints), "Expected 3 mount points for datadog-agent")
7877

7978
// Test Log Router Container
8079
logRouterContainer, found := GetContainer(containers, "datadog-log-router")

tests/ust_docker_labels_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func (s *ECSFargateSuite) TestUSTDockerLabels() {
2525

2626
err := json.Unmarshal([]byte(task["container_definitions"]), &containers)
2727
s.NoError(err, "Failed to parse container definitions")
28-
s.Equal(4, len(containers), "Expected 4 containers in the task definition (1 app container + 3 agent sidecar)")
28+
s.Equal(5, len(containers), "Expected 4 containers in the task definition (1 app container + 3 agent sidecar)")
2929

3030
// Expected UST docker labels that should be present on all application containers
3131
expectedUSTLabels := map[string]string{

0 commit comments

Comments
 (0)