-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add containerID checks to test
- Loading branch information
Showing
2 changed files
with
66 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// 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 2024-present Datadog, Inc. | ||
|
||
//go:build linux | ||
|
||
package servicediscovery | ||
|
||
import ( | ||
"time" | ||
|
||
model "github.com/DataDog/agent-payload/v5/process" | ||
|
||
proccontainers "github.com/DataDog/datadog-agent/pkg/process/util/containers" | ||
) | ||
|
||
type containerProviderStub struct { | ||
pidToCid map[int]string | ||
} | ||
|
||
func newContainerProviderStub(targetPIDs []int) proccontainers.ContainerProvider { | ||
pidToCid := make(map[int]string) | ||
|
||
for _, pid := range targetPIDs { | ||
pidToCid[pid] = "abcd" | ||
} | ||
|
||
return &containerProviderStub{ | ||
pidToCid: pidToCid, | ||
} | ||
} | ||
|
||
func (*containerProviderStub) GetContainers(_ time.Duration, _ map[string]*proccontainers.ContainerRateMetrics) ([]*model.Container, map[string]*proccontainers.ContainerRateMetrics, map[int]string, error) { | ||
return nil, nil, nil, nil | ||
} | ||
|
||
func (s *containerProviderStub) GetPidToCid(_ time.Duration) map[int]string { | ||
return s.pidToCid | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters