-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correctly report single-step agent installations on Docker (#25472)
* Report single-step agent installations on Docker * Add copyright notice * Address a lint comment * Address a review comment * Finish addressing a review comment
- Loading branch information
1 parent
5966dc6
commit 93ed8f7
Showing
2 changed files
with
50 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Unless explicitly stated otherwise all files in this repository are licensed | ||
// under the Apache License Version 2.0. | ||
// This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
// Copyright 2024-present Datadog, Inc. | ||
|
||
package config | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestInferInstallTypeFromEnvironment(t *testing.T) { | ||
t.Run("Non-dockerized agent", func(t *testing.T) { | ||
assert.Equal(t, defaultInstallType, inferInstallTypeFromEnvironment()) | ||
}) | ||
|
||
t.Run("Dockerized manual instrumentation", func(t *testing.T) { | ||
t.Setenv("DOCKER_DD_AGENT", "true") | ||
assert.Equal(t, defaultDockerInstallType, inferInstallTypeFromEnvironment()) | ||
}) | ||
|
||
t.Run("Dockerized single-step instrumentation", func(t *testing.T) { | ||
t.Setenv("DOCKER_DD_AGENT", "true") | ||
t.Setenv("DD_APM_ENABLED", "true") | ||
assert.Equal(t, dockerSingleStepInstallType, inferInstallTypeFromEnvironment()) | ||
}) | ||
|
||
t.Run("Non-standard environment variable values", func(t *testing.T) { | ||
t.Setenv("DOCKER_DD_AGENT", "yes") | ||
t.Setenv("DD_APM_ENABLED", "sure") | ||
assert.Equal(t, dockerSingleStepInstallType, inferInstallTypeFromEnvironment()) | ||
}) | ||
} |