Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jcstorms1 committed Nov 5, 2024
1 parent a9f5928 commit 0d3a5a5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
12 changes: 10 additions & 2 deletions cmd/serverless-init/cloudservice/containerapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ const (
acaReplicaName = "aca.replica.name"
acaResourceID = "aca.resource.id"
acaResourceGroup = "aca.resource.group"
acaAppName = "aca.app.name"
acaRegion = "aca.app.region"
acaRevision = "aca.app.revision"
acaSubscriptionID = "aca.subscription.id"
)

Expand All @@ -61,9 +64,14 @@ func (c *ContainerApp) GetTags() map[string]string {
"region": region,
"revision": revision,
"replica_name": replica,
// new tags
acaAppName: appName,
acaRegion: region,
acaRevision: revision,
acaReplicaName: replica,
"origin": c.GetOrigin(),
"_dd.origin": c.GetOrigin(),

"origin": c.GetOrigin(),
"_dd.origin": c.GetOrigin(),
}

if c.SubscriptionId != "" {
Expand Down
6 changes: 6 additions & 0 deletions cmd/serverless-init/cloudservice/containerapp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ func TestGetContainerAppTags(t *testing.T) {
"replica_name": "test--6nyz8z7-b845f7667-m7hlv",
"_dd.origin": "containerapp",
"aca.replica.name": "test--6nyz8z7-b845f7667-m7hlv",
"aca.app.name": "test_app_name",
"aca.app.region": "eastus",
"aca.app.revision": "test_revision",
}, tags)
}

Expand Down Expand Up @@ -63,6 +66,9 @@ func TestGetContainerAppTagsWithOptionalEnvVars(t *testing.T) {
"subscription_id": "test_subscription_id",
"resource_id": "/subscriptions/test_subscription_id/resourcegroups/test_resource_group/providers/microsoft.app/containerapps/test_app_name",
"resource_group": "test_resource_group",
"aca.app.name": "test_app_name",
"aca.app.region": "eastus",
"aca.app.revision": "test_revision",
"aca.replica.name": "test--6nyz8z7-b845f7667-m7hlv",
"aca.resource.id": "/subscriptions/test_subscription_id/resourcegroups/test_resource_group/providers/microsoft.app/containerapps/test_app_name",
"aca.resource.group": "test_resource_group",
Expand Down

0 comments on commit 0d3a5a5

Please sign in to comment.