Skip to content

Commit

Permalink
Use unknown tool version when env var is not set (#1345) (#1348)
Browse files Browse the repository at this point in the history
  • Loading branch information
levan-m committed Aug 9, 2024
1 parent 1640ba7 commit 01b70b4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion controllers/datadogagent/feature/enabledefault/feature.go
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ func buildInstallInfoConfigMap(dda metav1.Object) *corev1.ConfigMap {
}

func getInstallInfoValue() string {
toolVersion := "datadog-operator"
toolVersion := "unknown"
if envVar := os.Getenv(apicommon.InstallInfoToolVersion); envVar != "" {
toolVersion = envVar
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ package enabledefault

import (
"encoding/json"
"github.com/google/go-cmp/cmp"
"testing"

"github.com/google/go-cmp/cmp"

"github.com/stretchr/testify/assert"
"gopkg.in/yaml.v2"
corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -41,7 +42,7 @@ func Test_getInstallInfoValue(t *testing.T) {
{
name: "Env var empty/unset (os.Getenv returns unset env var as empty string)",
toolVersionEnvVarValue: "",
expectedToolVersion: "datadog-operator",
expectedToolVersion: "unknown",
},
{
name: "Env var set",
Expand Down

0 comments on commit 01b70b4

Please sign in to comment.