Skip to content

Commit

Permalink
Fix imports
Browse files Browse the repository at this point in the history
  • Loading branch information
gabedos committed Nov 15, 2024
1 parent 7e3ee88 commit 4ed7777
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 33 deletions.
8 changes: 4 additions & 4 deletions pkg/clusteragent/clusterchecks/dispatcher_isolate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ import (
"github.com/stretchr/testify/assert"

"github.com/DataDog/datadog-agent/comp/core/autodiscovery/integration"
"github.com/DataDog/datadog-agent/comp/core/tagger/taggerimpl"
"github.com/DataDog/datadog-agent/comp/core/tagger/mock"
"github.com/DataDog/datadog-agent/pkg/clusteragent/clusterchecks/types"
checkid "github.com/DataDog/datadog-agent/pkg/collector/check/id"
pkgconfigsetup "github.com/DataDog/datadog-agent/pkg/config/setup"
)

func TestIsolateCheckSuccessful(t *testing.T) {
fakeTagger := taggerimpl.SetupFakeTagger(t)
fakeTagger := mock.SetupFakeTagger(t)
testDispatcher := newDispatcher(fakeTagger)
testDispatcher.store.nodes["A"] = newNodeStore("A", "")
testDispatcher.store.nodes["A"].workers = pkgconfigsetup.DefaultNumWorkers
Expand Down Expand Up @@ -101,7 +101,7 @@ func TestIsolateCheckSuccessful(t *testing.T) {
}

func TestIsolateNonExistentCheckFails(t *testing.T) {
fakeTagger := taggerimpl.SetupFakeTagger(t)
fakeTagger := mock.SetupFakeTagger(t)
testDispatcher := newDispatcher(fakeTagger)
testDispatcher.store.nodes["A"] = newNodeStore("A", "")
testDispatcher.store.nodes["A"].workers = pkgconfigsetup.DefaultNumWorkers
Expand Down Expand Up @@ -180,7 +180,7 @@ func TestIsolateNonExistentCheckFails(t *testing.T) {
}

func TestIsolateCheckOnlyOneRunnerFails(t *testing.T) {
fakeTagger := taggerimpl.SetupFakeTagger(t)
fakeTagger := mock.SetupFakeTagger(t)
testDispatcher := newDispatcher(fakeTagger)
testDispatcher.store.nodes["A"] = newNodeStore("A", "")
testDispatcher.store.nodes["A"].workers = pkgconfigsetup.DefaultNumWorkers
Expand Down
2 changes: 1 addition & 1 deletion pkg/clusteragent/clusterchecks/dispatcher_main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"time"

"github.com/DataDog/datadog-agent/comp/core/autodiscovery/integration"
"github.com/DataDog/datadog-agent/comp/core/tagger"
tagger "github.com/DataDog/datadog-agent/comp/core/tagger/def"
"github.com/DataDog/datadog-agent/comp/core/tagger/types"
pkgconfigsetup "github.com/DataDog/datadog-agent/pkg/config/setup"
"github.com/DataDog/datadog-agent/pkg/status/health"
Expand Down
10 changes: 5 additions & 5 deletions pkg/clusteragent/clusterchecks/dispatcher_rebalance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"github.com/stretchr/testify/require"

"github.com/DataDog/datadog-agent/comp/core/autodiscovery/integration"
"github.com/DataDog/datadog-agent/comp/core/tagger/taggerimpl"
"github.com/DataDog/datadog-agent/comp/core/tagger/mock"
"github.com/DataDog/datadog-agent/pkg/clusteragent/clusterchecks/types"
checkid "github.com/DataDog/datadog-agent/pkg/collector/check/id"
pkgconfigsetup "github.com/DataDog/datadog-agent/pkg/config/setup"
Expand Down Expand Up @@ -1378,7 +1378,7 @@ func TestRebalance(t *testing.T) {
checkMetricSamplesWeight = originalMetricSamplesWeight
}()

fakeTagger := taggerimpl.SetupFakeTagger(t)
fakeTagger := mock.SetupFakeTagger(t)
dispatcher := newDispatcher(fakeTagger)

// prepare store
Expand Down Expand Up @@ -1435,7 +1435,7 @@ func TestMoveCheck(t *testing.T) {
},
} {
t.Run(fmt.Sprintf("case %d", i), func(t *testing.T) {
fakeTagger := taggerimpl.SetupFakeTagger(t)
fakeTagger := mock.SetupFakeTagger(t)
dispatcher := newDispatcher(fakeTagger)

// setup check id
Expand Down Expand Up @@ -1480,7 +1480,7 @@ func TestCalculateAvg(t *testing.T) {
checkMetricSamplesWeight = originalMetricSamplesWeight
}()

fakeTagger := taggerimpl.SetupFakeTagger(t)
fakeTagger := mock.SetupFakeTagger(t)
testDispatcher := newDispatcher(fakeTagger)

// The busyness of this node is 3 (1 + 2)
Expand Down Expand Up @@ -1522,7 +1522,7 @@ func TestRebalanceUsingUtilization(t *testing.T) {
// other tests specific for the checksDistribution struct that test more
// complex scenarios.

fakeTagger := taggerimpl.SetupFakeTagger(t)
fakeTagger := mock.SetupFakeTagger(t)
testDispatcher := newDispatcher(fakeTagger)

testDispatcher.store.active = true
Expand Down
40 changes: 20 additions & 20 deletions pkg/clusteragent/clusterchecks/dispatcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"gopkg.in/yaml.v2"

"github.com/DataDog/datadog-agent/comp/core/autodiscovery/integration"
"github.com/DataDog/datadog-agent/comp/core/tagger/taggerimpl"
"github.com/DataDog/datadog-agent/comp/core/tagger/mock"
"github.com/DataDog/datadog-agent/pkg/clusteragent/clusterchecks/types"
"github.com/DataDog/datadog-agent/pkg/config/env"
configmock "github.com/DataDog/datadog-agent/pkg/config/mock"
Expand Down Expand Up @@ -50,7 +50,7 @@ func extractCheckNames(configs []integration.Config) []string {
}

func TestScheduleUnschedule(t *testing.T) {
fakeTagger := taggerimpl.SetupFakeTagger(t)
fakeTagger := mock.SetupFakeTagger(t)
dispatcher := newDispatcher(fakeTagger)
stored, err := dispatcher.getAllConfigs()
assert.NoError(t, err)
Expand Down Expand Up @@ -82,7 +82,7 @@ func TestScheduleUnschedule(t *testing.T) {
}

func TestScheduleUnscheduleEndpoints(t *testing.T) {
fakeTagger := taggerimpl.SetupFakeTagger(t)
fakeTagger := mock.SetupFakeTagger(t)
dispatcher := newDispatcher(fakeTagger)

config1 := generateIntegration("cluster-check")
Expand All @@ -99,7 +99,7 @@ func TestScheduleUnscheduleEndpoints(t *testing.T) {
}

func TestExcludeEndpoint(t *testing.T) {
fakeTagger := taggerimpl.SetupFakeTagger(t)
fakeTagger := mock.SetupFakeTagger(t)
dispatcher := newDispatcher(fakeTagger)

config1 := generateEndpointsIntegration("endpoints-check1", "node1", true)
Expand All @@ -113,7 +113,7 @@ func TestExcludeEndpoint(t *testing.T) {
}

func TestScheduleReschedule(t *testing.T) {
fakeTagger := taggerimpl.SetupFakeTagger(t)
fakeTagger := mock.SetupFakeTagger(t)
dispatcher := newDispatcher(fakeTagger)
config := generateIntegration("cluster-check")

Expand Down Expand Up @@ -146,7 +146,7 @@ func TestScheduleReschedule(t *testing.T) {
}

func TestScheduleRescheduleEndpoints(t *testing.T) {
fakeTagger := taggerimpl.SetupFakeTagger(t)
fakeTagger := mock.SetupFakeTagger(t)
dispatcher := newDispatcher(fakeTagger)
config := generateEndpointsIntegration("endpoints-check1", "node1", false)

Expand Down Expand Up @@ -178,7 +178,7 @@ func TestScheduleRescheduleEndpoints(t *testing.T) {
}

func TestDescheduleRescheduleSameNode(t *testing.T) {
fakeTagger := taggerimpl.SetupFakeTagger(t)
fakeTagger := mock.SetupFakeTagger(t)
dispatcher := newDispatcher(fakeTagger)
config := generateIntegration("cluster-check")

Expand Down Expand Up @@ -212,7 +212,7 @@ func TestDescheduleRescheduleSameNode(t *testing.T) {
}

func TestProcessNodeStatus(t *testing.T) {
fakeTagger := taggerimpl.SetupFakeTagger(t)
fakeTagger := mock.SetupFakeTagger(t)
dispatcher := newDispatcher(fakeTagger)
status1 := types.NodeStatus{LastChange: 10}

Expand Down Expand Up @@ -254,7 +254,7 @@ func TestProcessNodeStatus(t *testing.T) {
}

func TestGetNodeWithLessChecks(t *testing.T) {
fakeTagger := taggerimpl.SetupFakeTagger(t)
fakeTagger := mock.SetupFakeTagger(t)
dispatcher := newDispatcher(fakeTagger)

// No node registered -> empty string
Expand All @@ -279,7 +279,7 @@ func TestGetNodeWithLessChecks(t *testing.T) {
}

func TestExpireNodes(t *testing.T) {
fakeTagger := taggerimpl.SetupFakeTagger(t)
fakeTagger := mock.SetupFakeTagger(t)
dispatcher := newDispatcher(fakeTagger)

// Node with no status (bug ?), handled by expiration
Expand Down Expand Up @@ -312,7 +312,7 @@ func TestExpireNodes(t *testing.T) {

func TestRescheduleDanglingFromExpiredNodes(t *testing.T) {
// This test case can represent a rollout of the cluster check workers
fakeTagger := taggerimpl.SetupFakeTagger(t)
fakeTagger := mock.SetupFakeTagger(t)
dispatcher := newDispatcher(fakeTagger)

// Register a node with a correct status & schedule a Check
Expand Down Expand Up @@ -363,7 +363,7 @@ func TestRescheduleDanglingFromExpiredNodes(t *testing.T) {
}

func TestDispatchFourConfigsTwoNodes(t *testing.T) {
fakeTagger := taggerimpl.SetupFakeTagger(t)
fakeTagger := mock.SetupFakeTagger(t)
dispatcher := newDispatcher(fakeTagger)

// Register two nodes
Expand Down Expand Up @@ -401,7 +401,7 @@ func TestDispatchFourConfigsTwoNodes(t *testing.T) {
}

func TestDanglingConfig(t *testing.T) {
fakeTagger := taggerimpl.SetupFakeTagger(t)
fakeTagger := mock.SetupFakeTagger(t)
dispatcher := newDispatcher(fakeTagger)
config := integration.Config{
Name: "cluster-check",
Expand Down Expand Up @@ -429,7 +429,7 @@ func TestDanglingConfig(t *testing.T) {
}

func TestUnscheduleDanglingConfig(t *testing.T) {
fakeTagger := taggerimpl.SetupFakeTagger(t)
fakeTagger := mock.SetupFakeTagger(t)
testDispatcher := newDispatcher(fakeTagger)

testConfig := integration.Config{
Expand Down Expand Up @@ -460,7 +460,7 @@ func TestUnscheduleDanglingConfig(t *testing.T) {
}

func TestReset(t *testing.T) {
fakeTagger := taggerimpl.SetupFakeTagger(t)
fakeTagger := mock.SetupFakeTagger(t)
dispatcher := newDispatcher(fakeTagger)
config := generateIntegration("cluster-check")

Expand Down Expand Up @@ -495,7 +495,7 @@ func TestPatchConfiguration(t *testing.T) {
}
initialDigest := checkConfig.Digest()

fakeTagger := taggerimpl.SetupFakeTagger(t)
fakeTagger := mock.SetupFakeTagger(t)
mockConfig := configmock.New(t)
mockConfig.SetWithoutSource("cluster_name", "testing")
clustername.ResetClusterName()
Expand Down Expand Up @@ -533,7 +533,7 @@ func TestPatchEndpointsConfiguration(t *testing.T) {
LogsConfig: integration.Data("[{\"service\":\"any_service\",\"source\":\"any_source\"}]"),
}

fakeTagger := taggerimpl.SetupFakeTagger(t)
fakeTagger := mock.SetupFakeTagger(t)
mockConfig := configmock.New(t)
mockConfig.SetWithoutSource("cluster_name", "testing")
clustername.ResetClusterName()
Expand Down Expand Up @@ -572,7 +572,7 @@ func TestExtraTags(t *testing.T) {
{[]string{"one", "two"}, "mycluster", "custom_name", []string{"one", "two", "custom_name:mycluster", "kube_cluster_name:mycluster"}},
} {
t.Run("", func(t *testing.T) {
fakeTagger := taggerimpl.SetupFakeTagger(t)
fakeTagger := mock.SetupFakeTagger(t)
mockConfig := configmock.New(t)
fakeTagger.SetGlobalTags(tc.extraTagsConfig, []string{}, []string{}, []string{})
mockConfig.SetWithoutSource("cluster_name", tc.clusterNameConfig)
Expand All @@ -586,7 +586,7 @@ func TestExtraTags(t *testing.T) {
}

func TestGetAllEndpointsCheckConfigs(t *testing.T) {
fakeTagger := taggerimpl.SetupFakeTagger(t)
fakeTagger := mock.SetupFakeTagger(t)
dispatcher := newDispatcher(fakeTagger)

// Register configs to different nodes
Expand Down Expand Up @@ -661,7 +661,7 @@ func (d *dummyClientStruct) GetRunnerWorkers(IP string) (types.Workers, error) {
}

func TestUpdateRunnersStats(t *testing.T) {
fakeTagger := taggerimpl.SetupFakeTagger(t)
fakeTagger := mock.SetupFakeTagger(t)
mockConfig := configmock.New(t)
mockConfig.SetWithoutSource("cluster_checks.rebalance_with_utilization", true)

Expand Down
2 changes: 1 addition & 1 deletion pkg/clusteragent/clusterchecks/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"time"

"github.com/DataDog/datadog-agent/comp/core/autodiscovery/scheduler"
"github.com/DataDog/datadog-agent/comp/core/tagger"
tagger "github.com/DataDog/datadog-agent/comp/core/tagger/def"
"github.com/DataDog/datadog-agent/pkg/clusteragent/api"
"github.com/DataDog/datadog-agent/pkg/clusteragent/clusterchecks/types"
pkgconfigsetup "github.com/DataDog/datadog-agent/pkg/config/setup"
Expand Down
4 changes: 2 additions & 2 deletions pkg/clusteragent/clusterchecks/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"github.com/stretchr/testify/mock"

"github.com/DataDog/datadog-agent/comp/core/autodiscovery/integration"
"github.com/DataDog/datadog-agent/comp/core/tagger/taggerimpl"
taggerMock "github.com/DataDog/datadog-agent/comp/core/tagger/mock"
"github.com/DataDog/datadog-agent/pkg/clusteragent/api"
"github.com/DataDog/datadog-agent/pkg/clusteragent/clusterchecks/types"
"github.com/DataDog/datadog-agent/pkg/util/testutil"
Expand Down Expand Up @@ -139,7 +139,7 @@ func TestUpdateLeaderIP(t *testing.T) {
func TestHandlerRun(t *testing.T) {
dummyT := &testing.T{}
ac := &mockedPluggableAutoConfig{}
fakeTagger := taggerimpl.SetupFakeTagger(t)
fakeTagger := taggerMock.SetupFakeTagger(t)
ac.Test(t)
le := &fakeLeaderEngine{
err: errors.New("failing"),
Expand Down

0 comments on commit 4ed7777

Please sign in to comment.