Skip to content

Commit

Permalink
Restore instance tags in integration tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
remeh committed Jan 14, 2019
1 parent 1bd099a commit 17c2a76
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions test/integration/corechecks/docker/basemetrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ func init() {

func TestContainerMetricsTagging(t *testing.T) {
expectedTags := []string{
instanceTag, // Instance tags
"container_name:basemetrics_redis_1", // Container name
"docker_image:datadog/docker-library:redis_3_2_11-alpine",
"image_name:datadog/docker-library",
Expand Down Expand Up @@ -49,6 +50,7 @@ func TestContainerMetricsTagging(t *testing.T) {
},
}
pauseTags := []string{
"instanceTag:MustBeHere",
"docker_image:kubernetes/pause:latest",
"image_name:kubernetes/pause",
"image_tag:latest",
Expand Down
1 change: 1 addition & 0 deletions test/integration/corechecks/docker/events_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ func init() {
func TestEvents(t *testing.T) {
nowTimestamp := time.Now().Unix()
expectedTags := []string{
instanceTag,
"highcardlabeltag:eventhigh",
"lowcardlabeltag:eventlow",
"highcardenvtag:eventhighenv",
Expand Down
1 change: 1 addition & 0 deletions test/integration/corechecks/docker/exitcode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ func init() {

func TestContainerExit(t *testing.T) {
expectedTags := []string{
instanceTag,
"docker_image:datadog/docker-library:busybox_1_28_0",
"image_name:datadog/docker-library",
"short_image:docker-library",
Expand Down
2 changes: 1 addition & 1 deletion test/integration/corechecks/docker/globalmetrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func init() {
}

func TestGlobalMetrics(t *testing.T) {
expectedTags := []string{}
expectedTags := []string{instanceTag}

sender.AssertCalled(t, "Gauge", "docker.images.available", mocksender.IsGreaterOrEqual(2), "", mocksender.MatchTagsContains(expectedTags))
sender.AssertCalled(t, "Gauge", "docker.images.intermediate", mocksender.IsGreaterOrEqual(0), "", mocksender.MatchTagsContains(expectedTags))
Expand Down
3 changes: 3 additions & 0 deletions test/integration/corechecks/docker/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ var retryDelay = flag.Int("retry-delay", 1, "time to wait between retries (defau
var retryTimeout = flag.Int("retry-timeout", 30, "maximum time before failure (default 30 seconds)")
var skipCleanup = flag.Bool("skip-cleanup", false, "skip cleanup of the docker containers (for debugging)")

// Must be repeated in the following dockerCfgString
const instanceTag = "instanceTag:MustBeHere"

var dockerCfgString = `
collect_events: true
collect_container_size: true
Expand Down
4 changes: 3 additions & 1 deletion test/integration/corechecks/docker/serviceup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ import (
)

func TestServiceUp(t *testing.T) {
expectedTags := []string{}
expectedTags := []string{
instanceTag,
}

sender.AssertServiceCheck(t, "docker.service_up", metrics.ServiceCheckOK, "", expectedTags, "")
}

0 comments on commit 17c2a76

Please sign in to comment.