Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove SetupConfigForTest #29985

Merged
merged 1 commit into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 0 additions & 55 deletions cmd/agent/common/test_helpers.go

This file was deleted.

9 changes: 1 addition & 8 deletions pkg/config/utils/endpoints_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ import (
"testing"

"github.com/DataDog/datadog-agent/pkg/config/mock"
pkgconfigsetup "github.com/DataDog/datadog-agent/pkg/config/setup"

"github.com/DataDog/datadog-agent/comp/core/secrets"
"github.com/DataDog/datadog-agent/pkg/util/optional"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand All @@ -22,11 +19,7 @@ import (
// endpoints are configured.
// Refer to https://github.com/DataDog/viper/pull/2 for more details.
func TestSecretBackendWithMultipleEndpoints(t *testing.T) {
conf := mock.New(t)
conf.SetConfigFile("./tests/datadog_secrets.yaml")
// load the configuration
_, err := pkgconfigsetup.LoadDatadogCustom(conf, "datadog_secrets.yaml", optional.NewNoneOption[secrets.Component](), nil)
assert.NoError(t, err)
conf := mock.NewFromFile(t, "./tests/datadog_secrets.yaml")

expectedKeysPerDomain := map[string][]string{
"https://app.datadoghq.com": {"someapikey", "someotherapikey"},
Expand Down
4 changes: 2 additions & 2 deletions pkg/config/utils/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,24 @@ replace (
)

require (
github.com/DataDog/datadog-agent/comp/core/secrets v0.56.0-rc.3
github.com/DataDog/datadog-agent/pkg/config/mock v0.58.0-devel
github.com/DataDog/datadog-agent/pkg/config/model v0.56.0-rc.3
github.com/DataDog/datadog-agent/pkg/config/setup v0.56.0-rc.3
github.com/DataDog/datadog-agent/pkg/util/log v0.56.0-rc.3
github.com/DataDog/datadog-agent/pkg/util/optional v0.56.0-rc.3
github.com/DataDog/datadog-agent/pkg/version v0.56.0-rc.3
github.com/stretchr/testify v1.9.0
)

require (
github.com/DataDog/datadog-agent/comp/core/secrets v0.56.0-rc.3 // indirect
github.com/DataDog/datadog-agent/pkg/collector/check/defaults v0.56.0-rc.3 // indirect
github.com/DataDog/datadog-agent/pkg/config/env v0.56.0-rc.3 // indirect
github.com/DataDog/datadog-agent/pkg/config/nodetreemodel v0.0.0-00010101000000-000000000000 // indirect
github.com/DataDog/datadog-agent/pkg/config/teeconfig v0.0.0-00010101000000-000000000000 // indirect
github.com/DataDog/datadog-agent/pkg/util/executable v0.56.0-rc.3 // indirect
github.com/DataDog/datadog-agent/pkg/util/filesystem v0.56.0-rc.3 // indirect
github.com/DataDog/datadog-agent/pkg/util/hostname/validate v0.56.0-rc.3 // indirect
github.com/DataDog/datadog-agent/pkg/util/optional v0.56.0-rc.3 // indirect
github.com/DataDog/datadog-agent/pkg/util/pointer v0.56.0-rc.3 // indirect
github.com/DataDog/datadog-agent/pkg/util/scrubber v0.56.0-rc.3 // indirect
github.com/DataDog/datadog-agent/pkg/util/system v0.56.0-rc.3 // indirect
Expand Down
3 changes: 0 additions & 3 deletions pkg/flare/archive_security_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (

"go.uber.org/fx"

"github.com/DataDog/datadog-agent/cmd/agent/common"
flarehelpers "github.com/DataDog/datadog-agent/comp/core/flare/helpers"
flaretypes "github.com/DataDog/datadog-agent/comp/core/flare/types"
"github.com/DataDog/datadog-agent/comp/core/status"
Expand All @@ -26,9 +25,7 @@ import (
)

func TestCreateSecurityAgentArchive(t *testing.T) {
common.SetupConfigForTest("./test")
mockConfig := configmock.New(t)

statusComponent := fxutil.Test[status.Mock](t, fx.Options(
statusimpl.MockModule(),
))
Expand Down
7 changes: 3 additions & 4 deletions pkg/flare/archive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (

procmodel "github.com/DataDog/agent-payload/v5/process"

"github.com/DataDog/datadog-agent/cmd/agent/common"
flarehelpers "github.com/DataDog/datadog-agent/comp/core/flare/helpers"
"github.com/DataDog/datadog-agent/comp/core/tagger/types"
workloadmeta "github.com/DataDog/datadog-agent/comp/core/workloadmeta/def"
Expand All @@ -44,7 +43,7 @@ func TestGoRoutines(t *testing.T) {
}

func TestIncludeSystemProbeConfig(t *testing.T) {
common.SetupConfigForTest("./test/datadog-agent.yaml")
configmock.NewFromFile(t, "./test/datadog-agent.yaml")
// create system-probe.yaml file because it's in .gitignore
_, err := os.Create("./test/system-probe.yaml")
require.NoError(t, err, "couldn't create system-probe.yaml")
Expand All @@ -58,7 +57,7 @@ func TestIncludeSystemProbeConfig(t *testing.T) {
}

func TestIncludeConfigFiles(t *testing.T) {
common.SetupConfigForTest("./test")
configmock.New(t)

mock := flarehelpers.NewFlareBuilderMock(t, false)
getConfigFiles(mock.Fb, searchPaths{"": "./test/confd"})
Expand All @@ -69,7 +68,7 @@ func TestIncludeConfigFiles(t *testing.T) {
}

func TestIncludeConfigFilesWithPrefix(t *testing.T) {
common.SetupConfigForTest("./test")
configmock.New(t)

mock := flarehelpers.NewFlareBuilderMock(t, false)
getConfigFiles(mock.Fb, searchPaths{"prefix": "./test/confd"})
Expand Down
Loading