Skip to content

Commit

Permalink
[CONTINT-258] E2e tests: assert tags on logs (#21082)
Browse files Browse the repository at this point in the history
  • Loading branch information
L3n41c authored Nov 24, 2023
1 parent d64f748 commit 8805c7a
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 1 deletion.
34 changes: 34 additions & 0 deletions test/new-e2e/tests/containers/ecs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,24 @@ func (suite *ecsSuite) TestNginx() {
Service: "apps-nginx-server",
},
Expect: testLogExpectArgs{
Tags: &[]string{
`^cluster_name:` + regexp.QuoteMeta(suite.ecsClusterName) + `$`,
`^container_id:`,
`^container_name:ecs-.*-nginx-ec2-`,
`^docker_image:ghcr.io/datadog/apps-nginx-server:main$`,
`^ecs_cluster_name:` + regexp.QuoteMeta(suite.ecsClusterName) + `$`,
`^ecs_container_name:nginx$`,
`^git.commit.sha:`, // org.opencontainers.image.revision docker image label
`^git.repository_url:https://github.com/DataDog/test-infra-definitions$`, // org.opencontainers.image.source docker image label
`^image_id:sha256:`,
`^image_name:ghcr.io/datadog/apps-nginx-server$`,
`^image_tag:main$`,
`^short_image:apps-nginx-server$`,
`^task_arn:arn:`,
`^task_family:.*-nginx-ec2$`,
`^task_name:.*-nginx-ec2$`,
`^task_version:[[:digit:]]+$`,
},
Message: `GET / HTTP/1\.1`,
},
})
Expand Down Expand Up @@ -242,6 +260,22 @@ func (suite *ecsSuite) TestRedis() {
Service: "redis",
},
Expect: testLogExpectArgs{
Tags: &[]string{
`^cluster_name:` + regexp.QuoteMeta(suite.ecsClusterName) + `$`,
`^container_id:`,
`^container_name:ecs-.*-redis-ec2-`,
`^docker_image:redis:latest$`,
`^ecs_cluster_name:` + regexp.QuoteMeta(suite.ecsClusterName) + `$`,
`^ecs_container_name:redis$`,
`^image_id:sha256:`,
`^image_name:redis$`,
`^image_tag:latest$`,
`^short_image:redis$`,
`^task_arn:arn:`,
`^task_family:.*-redis-ec2$`,
`^task_name:.*-redis-ec2$`,
`^task_version:[[:digit:]]+$`,
},
Message: `oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo`,
},
})
Expand Down
46 changes: 45 additions & 1 deletion test/new-e2e/tests/containers/k8s_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ func (suite *k8sSuite) TestNginx() {
`^container_name:nginx$`,
`^display_container_name:nginx`,
`^git\.commit\.sha:`, // org.opencontainers.image.revision docker image label
`^git\.repository_url:https://github\.com/DataDog/test-infra-definitions$`, // org.opencontainers.image.source docker image label
`^git\.repository_url:https://github\.com/DataDog/test-infra-definitions$`, // org.opencontainers.image.source docker image label
`^image_id:ghcr\.io/datadog/apps-nginx-server@sha256:`,
`^image_name:ghcr\.io/datadog/apps-nginx-server$`,
`^image_tag:main$`,
Expand Down Expand Up @@ -288,6 +288,29 @@ func (suite *k8sSuite) TestNginx() {
Service: "apps-nginx-server",
},
Expect: testLogExpectArgs{
Tags: &[]string{
`^container_id:`,
`^container_name:nginx$`,
`^dirname:/var/log/pods/workload-nginx_nginx-`,
`^display_container_name:nginx`,
`^filename:[[:digit:]]+.log$`,
`^git\.commit\.sha:`, // org.opencontainers.image.revision docker image label
`^git\.repository_url:https://github\.com/DataDog/test-infra-definitions$`, // org.opencontainers.image.source docker image label
`^image_id:ghcr.io/datadog/apps-nginx-server@sha256:`,
`^image_name:ghcr.io/datadog/apps-nginx-server$`,
`^image_tag:main$`,
`^kube_container_name:nginx$`,
`^kube_deployment:nginx$`,
`^kube_namespace:workload-nginx$`,
`^kube_ownerref_kind:replicaset$`,
`^kube_ownerref_name:nginx-[[:alnum:]]+$`,
`^kube_qos:Burstable$`,
`^kube_replica_set:nginx-[[:alnum:]]+$`,
`^kube_service:nginx$`,
`^pod_name:nginx-[[:alnum:]]+-[[:alnum:]]+$`,
`^pod_phase:running$`,
`^short_image:apps-nginx-server$`,
},
Message: `GET / HTTP/1\.1`,
},
})
Expand Down Expand Up @@ -358,6 +381,27 @@ func (suite *k8sSuite) TestRedis() {
Service: "redis",
},
Expect: testLogExpectArgs{
Tags: &[]string{
`^container_id:`,
`^container_name:redis$`,
`^dirname:/var/log/pods/workload-redis_redis-`,
`^display_container_name:redis`,
`^filename:[[:digit:]]+.log$`,
`^image_id:docker.io/library/redis@sha256:`,
`^image_name:redis$`,
`^image_tag:latest$`,
`^kube_container_name:redis$`,
`^kube_deployment:redis$`,
`^kube_namespace:workload-redis$`,
`^kube_ownerref_kind:replicaset$`,
`^kube_ownerref_name:redis-[[:alnum:]]+$`,
`^kube_qos:Burstable$`,
`^kube_replica_set:redis-[[:alnum:]]+$`,
`^kube_service:redis$`,
`^pod_name:redis-[[:alnum:]]+-[[:alnum:]]+$`,
`^pod_phase:running$`,
`^short_image:redis$`,
},
Message: `oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo`,
},
})
Expand Down

0 comments on commit 8805c7a

Please sign in to comment.