-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
ASCII-808: Linter ensures fxutil.Run is tested using TestRun #21461
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// 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 2016-present Datadog, Inc. | ||
|
||
//go:build otlp | ||
|
||
package main | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/DataDog/datadog-agent/pkg/util/fxutil" | ||
) | ||
|
||
func TestFxRun(t *testing.T) { | ||
// TODO: (components) "missing type: *aggregator.AgentDemultiplexer" | ||
t.SkipNow() | ||
fxutil.TestOneShot(t, main) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// 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 2016-present Datadog, Inc. | ||
|
||
//go:build windows | ||
|
||
package main | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
|
||
"github.com/DataDog/datadog-agent/pkg/util/fxutil" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestFxRun(t *testing.T) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about |
||
svc := service{} | ||
ctx := context.Background() | ||
fxutil.TestOneShot(t, func() { | ||
err := svc.Run(ctx) | ||
require.NoError(t, err) | ||
}) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ import ( | |
|
||
"github.com/DataDog/datadog-agent/pkg/config" | ||
"github.com/DataDog/datadog-agent/pkg/serverless/logs" | ||
"github.com/DataDog/datadog-agent/pkg/util/fxutil" | ||
) | ||
|
||
func setupTest() { | ||
|
@@ -43,3 +44,7 @@ func TestTagsSetup(t *testing.T) { | |
assert.Subset(t, metricAgent.GetExtraTags(), allTags) | ||
assert.Subset(t, logs.GetLogsTags(), allTags) | ||
} | ||
|
||
func TestFxApp(t *testing.T) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These I think make sense staying this way because they are specifically testing the usage of fx dependencies. |
||
fxutil.TestOneShot(t, main) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// 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 2016-present Datadog, Inc. | ||
//go:build windows | ||
|
||
package command | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/DataDog/datadog-agent/pkg/util/fxutil" | ||
) | ||
|
||
func TestFxRunCommand(t *testing.T) { | ||
cmd := MakeCommand() | ||
fxutil.TestRun(t, func() error { | ||
ogaca-dd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return cmd.Execute() | ||
}) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// 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 2016-present Datadog, Inc. | ||
|
||
package run | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
|
||
"github.com/DataDog/datadog-agent/cmd/trace-agent/subcommands" | ||
"github.com/DataDog/datadog-agent/pkg/util/fxutil" | ||
) | ||
|
||
func TestFxRun(t *testing.T) { | ||
fxutil.TestRun(t, func() error { | ||
ctx := context.Background() | ||
cliParams := RunParams{GlobalParams: &subcommands.GlobalParams{}} | ||
defaultConfPath := "" | ||
return runTraceAgentProcess(ctx, &cliParams, defaultConfPath) | ||
}) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about
TestRun
?