Skip to content

Commit b8cc80f

Browse files
committed
Add 'category' for classifying tests in datadog (unit, integration, e2e)
1 parent 08dc699 commit b8cc80f

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

.github/workflows/coder.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ jobs:
164164
env:
165165
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }}
166166
DD_DATABASE: fake
167+
DD_CATEGORY: unit
167168
GIT_COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
168169
run: go run scripts/datadog-cireport/main.go gotests.xml
169170

@@ -279,7 +280,7 @@ jobs:
279280
if: (success() || failure()) && github.actor != 'dependabot[bot]'
280281
env:
281282
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }}
282-
DD_DATABASE: postgresql
283+
DD_CATEGORY: unit
283284
GIT_COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
284285
run: go run scripts/datadog-cireport/main.go site/test-results/junit.xml
285286

@@ -339,6 +340,6 @@ jobs:
339340
if: (success() || failure()) && github.actor != 'dependabot[bot]' && runner.os == 'Linux'
340341
env:
341342
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }}
342-
DD_DATABASE: e2e
343+
DD_CATEGORY: e2e
343344
GIT_COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
344345
run: go run scripts/datadog-cireport/main.go site/test-results/junit.xml

scripts/datadog-cireport/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ func main() {
7575
"service": "coder",
7676
"_dd.cireport_version": "2",
7777

78-
"test.traits": fmt.Sprintf(`{"database":["%s"]}`, os.Getenv("DD_DATABASE")),
78+
"test.traits": fmt.Sprintf(`{"database":["%s"], "category":["%s"]}`,
79+
os.Getenv("DD_DATABASE"), os.Getenv("DD_CATEGORY")),
7980

8081
// Additional tags found in DataDog docs. See:
8182
// https://docs.datadoghq.com/continuous_integration/setup_tests/junit_upload/#collecting-environment-configuration-metadata

0 commit comments

Comments
 (0)