-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy pathcommon_test.go
83 lines (67 loc) · 2.15 KB
/
common_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// 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 autodiscovery
import (
"context"
"github.com/DataDog/datadog-agent/pkg/autodiscovery/listeners"
"github.com/DataDog/datadog-agent/pkg/util/containers"
)
type dummyService struct {
ID string
ADIdentifiers []string
Hosts map[string]string
Ports []listeners.ContainerPort
Pid int
Hostname string
CheckNames []string
}
// GetServiceID returns the service entity name
func (s *dummyService) GetServiceID() string {
return s.ID
}
// GetTaggerEntity returns the tagger entity ID for the entity corresponding to this service
func (s *dummyService) GetTaggerEntity() string {
return s.ID
}
// GetADIdentifiers returns dummy identifiers
func (s *dummyService) GetADIdentifiers(context.Context) ([]string, error) {
return s.ADIdentifiers, nil
}
// GetHosts returns dummy hosts
func (s *dummyService) GetHosts(context.Context) (map[string]string, error) {
return s.Hosts, nil
}
// GetPorts returns dummy ports
func (s *dummyService) GetPorts(context.Context) ([]listeners.ContainerPort, error) {
return s.Ports, nil
}
// GetTags returns mil
func (s *dummyService) GetTags() ([]string, string, error) {
return nil, "", nil
}
// GetPid return a dummy pid
func (s *dummyService) GetPid(context.Context) (int, error) {
return s.Pid, nil
}
// GetHostname return a dummy hostname
func (s *dummyService) GetHostname(context.Context) (string, error) {
return s.Hostname, nil
}
// IsReady returns if the service is ready
func (s *dummyService) IsReady(context.Context) bool {
return true
}
// GetCheckNames returns slice of check names defined in container labels
func (s *dummyService) GetCheckNames(context.Context) []string {
return s.CheckNames
}
// HasFilter returns false
func (s *dummyService) HasFilter(filter containers.FilterType) bool {
return false
}
// GetExtraConfig isn't supported
func (s *dummyService) GetExtraConfig(key []byte) ([]byte, error) {
return []byte{}, nil
}