diff --git a/test/new-e2e/tests/agent-subcommands/configcheck/configcheck_common_test.go b/test/new-e2e/tests/agent-subcommands/configcheck/configcheck_common_test.go index 00abcfcac3efd..1171241815973 100644 --- a/test/new-e2e/tests/agent-subcommands/configcheck/configcheck_common_test.go +++ b/test/new-e2e/tests/agent-subcommands/configcheck/configcheck_common_test.go @@ -14,6 +14,7 @@ import ( "github.com/DataDog/datadog-agent/test/new-e2e/pkg/environments" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) type baseConfigCheckSuite struct { @@ -80,23 +81,27 @@ Config for instance ID: cpu:e331d61ed1323219 ~ ===` - result, err := MatchCheckToTemplate("uptime", sampleCheck) - assert.NoError(t, err) - - assert.Contains(t, result.CheckName, "uptime") - assert.Contains(t, result.Filepath, "file:/etc/datadog-agent/conf.d/uptime.d/conf.yaml.default") - assert.Contains(t, result.InstanceID, "uptime:c72f390abdefdf1a") - assert.Contains(t, result.Settings, "key: value") - assert.Contains(t, result.Settings, "path: http://example.com/foo") - assert.NotContains(t, result.Settings, "{}") - - result, err = MatchCheckToTemplate("cpu", sampleCheck) - assert.NoError(t, err) - - assert.Contains(t, result.CheckName, "cpu") - assert.Contains(t, result.Filepath, "file:/etc/datadog-agent/conf.d/cpu.d/conf.yaml.default") - assert.Contains(t, result.InstanceID, "cpu:e331d61ed1323219") - assert.Contains(t, result.Settings, "{}") + t.Run("uptime", func(t *testing.T) { + result, err := MatchCheckToTemplate("uptime", sampleCheck) + require.NoError(t, err) + + assert.Contains(t, result.CheckName, "uptime") + assert.Contains(t, result.Filepath, "file:/etc/datadog-agent/conf.d/uptime.d/conf.yaml.default") + assert.Contains(t, result.InstanceID, "uptime:c72f390abdefdf1a") + assert.Contains(t, result.Settings, "key: value") + assert.Contains(t, result.Settings, "path: http://example.com/foo") + assert.NotContains(t, result.Settings, "{}") + }) + + t.Run("cpu", func(t *testing.T) { + result, err := MatchCheckToTemplate("cpu", sampleCheck) + require.NoError(t, err) + + assert.Contains(t, result.CheckName, "cpu") + assert.Contains(t, result.Filepath, "file:/etc/datadog-agent/conf.d/cpu.d/conf.yaml.default") + assert.Contains(t, result.InstanceID, "cpu:e331d61ed1323219") + assert.Contains(t, result.Settings, "{}") + }) } func VerifyDefaultInstalledCheck(t *testing.T, output string, testChecks []CheckConfigOutput) { @@ -105,7 +110,7 @@ func VerifyDefaultInstalledCheck(t *testing.T, output string, testChecks []Check for _, testCheck := range testChecks { t.Run(fmt.Sprintf("default - %s test", testCheck.CheckName), func(t *testing.T) { result, err := MatchCheckToTemplate(testCheck.CheckName, output) - assert.NoError(t, err) + require.NoError(t, err) assert.Contains(t, result.Filepath, testCheck.Filepath) assert.Contains(t, result.InstanceID, testCheck.InstanceID) assert.Contains(t, result.Settings, testCheck.Settings) diff --git a/test/new-e2e/tests/agent-subcommands/configcheck/configcheck_nix_test.go b/test/new-e2e/tests/agent-subcommands/configcheck/configcheck_nix_test.go index d86df8957ad40..fa6f6a44c1325 100644 --- a/test/new-e2e/tests/agent-subcommands/configcheck/configcheck_nix_test.go +++ b/test/new-e2e/tests/agent-subcommands/configcheck/configcheck_nix_test.go @@ -8,10 +8,12 @@ package configcheck import ( "testing" - "github.com/DataDog/datadog-agent/test/new-e2e/pkg/e2e" - awshost "github.com/DataDog/datadog-agent/test/new-e2e/pkg/environments/aws/host" "github.com/DataDog/test-infra-definitions/components/datadog/agentparams" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "github.com/DataDog/datadog-agent/test/new-e2e/pkg/e2e" + awshost "github.com/DataDog/datadog-agent/test/new-e2e/pkg/environments/aws/host" ) type linuxConfigCheckSuite struct { @@ -109,7 +111,7 @@ func (v *linuxConfigCheckSuite) TestWithAddedIntegrationsCheck() { output := v.Env().Agent.Client.ConfigCheck() result, err := MatchCheckToTemplate("http_check", output) - assert.NoError(v.T(), err) + require.NoError(v.T(), err) assert.Contains(v.T(), result.Filepath, "file:/etc/datadog-agent/conf.d/http_check.d/conf.yaml") assert.Contains(v.T(), result.InstanceID, "http_check:") assert.Contains(v.T(), result.Settings, "name: My First Service") diff --git a/test/new-e2e/tests/agent-subcommands/configcheck/configcheck_win_test.go b/test/new-e2e/tests/agent-subcommands/configcheck/configcheck_win_test.go index fcaf2d287db27..e9b0ef147bd7c 100644 --- a/test/new-e2e/tests/agent-subcommands/configcheck/configcheck_win_test.go +++ b/test/new-e2e/tests/agent-subcommands/configcheck/configcheck_win_test.go @@ -8,9 +8,11 @@ package configcheck import ( "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/DataDog/datadog-agent/test/new-e2e/pkg/e2e" awshost "github.com/DataDog/datadog-agent/test/new-e2e/pkg/environments/aws/host" - "github.com/stretchr/testify/assert" "github.com/DataDog/test-infra-definitions/components/datadog/agentparams" "github.com/DataDog/test-infra-definitions/components/os" @@ -112,7 +114,7 @@ func (v *windowsConfigCheckSuite) TestWithAddedIntegrationsCheck() { output := v.Env().Agent.Client.ConfigCheck() result, err := MatchCheckToTemplate("http_check", output) - assert.NoError(v.T(), err) + require.NoError(v.T(), err) assert.Contains(v.T(), result.Filepath, "file:C:\\ProgramData\\Datadog\\conf.d\\http_check.d\\conf.yaml") assert.Contains(v.T(), result.InstanceID, "http_check:") assert.Contains(v.T(), result.Settings, "name: My First Service")