From f5253be4c993b4c2aabb8fc2c0a2015141e28535 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Lopez=20de=20Heredia?= Date: Thu, 19 Dec 2024 14:00:36 +0100 Subject: [PATCH 1/2] [APM] Mark ConfigHostname/external as flaky --- comp/trace/config/config_test.go | 2 +- comp/trace/config/hostname_test.go | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 comp/trace/config/hostname_test.go diff --git a/comp/trace/config/config_test.go b/comp/trace/config/config_test.go index 9706e2c784f4ca..6faebcda23b6c8 100644 --- a/comp/trace/config/config_test.go +++ b/comp/trace/config/config_test.go @@ -364,6 +364,7 @@ func TestConfigHostname(t *testing.T) { }) t.Run("external", func(t *testing.T) { + t.Skip("Skip flaky test while we explore fixes.") // makeProgram creates a new binary file which returns the given response and exits to the OS // given the specified code, returning the path of the program. makeProgram := func(t *testing.T, response string, code int) string { @@ -398,7 +399,6 @@ func TestConfigHostname(t *testing.T) { fallbackHostnameFunc = func() (string, error) { return "fallback.host", nil } t.Run("good", func(t *testing.T) { - t.Skip("Skip flaky test while we explore fixes.") bin := makeProgram(t, "host.name", 0) defer os.Remove(bin) diff --git a/comp/trace/config/hostname_test.go b/comp/trace/config/hostname_test.go new file mode 100644 index 00000000000000..0d585f4d213d3b --- /dev/null +++ b/comp/trace/config/hostname_test.go @@ -0,0 +1,22 @@ +package config + +import ( + "context" + "testing" + "time" + + pkgconfigsetup "github.com/DataDog/datadog-agent/pkg/config/setup" + "github.com/DataDog/datadog-agent/pkg/util/grpc" + "github.com/stretchr/testify/assert" +) + +func TestGetDDAgentClientTimeout(t *testing.T) { + ctx, cancel := context.WithTimeout(context.Background(), 10*time.Millisecond) + defer cancel() + + ipcAddress, err := pkgconfigsetup.GetIPCAddress(pkgconfigsetup.Datadog()) + assert.NoError(t, err) + + _, err = grpc.GetDDAgentClient(ctx, ipcAddress, "5001") + assert.Equal(t, context.DeadlineExceeded, err) +} From f98ff00a82e6b7f62bc171e4e7f339523640ee47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Lopez=20de=20Heredia?= Date: Thu, 19 Dec 2024 14:03:36 +0100 Subject: [PATCH 2/2] rm draft test file --- comp/trace/config/hostname_test.go | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 comp/trace/config/hostname_test.go diff --git a/comp/trace/config/hostname_test.go b/comp/trace/config/hostname_test.go deleted file mode 100644 index 0d585f4d213d3b..00000000000000 --- a/comp/trace/config/hostname_test.go +++ /dev/null @@ -1,22 +0,0 @@ -package config - -import ( - "context" - "testing" - "time" - - pkgconfigsetup "github.com/DataDog/datadog-agent/pkg/config/setup" - "github.com/DataDog/datadog-agent/pkg/util/grpc" - "github.com/stretchr/testify/assert" -) - -func TestGetDDAgentClientTimeout(t *testing.T) { - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Millisecond) - defer cancel() - - ipcAddress, err := pkgconfigsetup.GetIPCAddress(pkgconfigsetup.Datadog()) - assert.NoError(t, err) - - _, err = grpc.GetDDAgentClient(ctx, ipcAddress, "5001") - assert.Equal(t, context.DeadlineExceeded, err) -}