Skip to content

Commit

Permalink
update calls to the tagger
Browse files Browse the repository at this point in the history
  • Loading branch information
adel121 committed Oct 16, 2024
1 parent a3d07c4 commit d82fa97
Show file tree
Hide file tree
Showing 41 changed files with 80 additions and 81 deletions.
2 changes: 1 addition & 1 deletion comp/core/autodiscovery/listeners/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (s *service) GetPorts(_ context.Context) ([]ContainerPort, error) {

// GetTags returns the tags associated with the service.
func (s *service) GetTags() ([]string, error) {
return tagger.Tag(taggercommon.BuildTaggerEntityID(s.entity.GetID()).String(), tagger.ChecksCardinality())
return tagger.Tag(taggercommon.BuildTaggerEntityID(s.entity.GetID()), tagger.ChecksCardinality())
}

// GetPid returns the process ID of the service.
Expand Down
2 changes: 1 addition & 1 deletion comp/otelcol/otlp/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (t *tagEnricher) Enrich(_ context.Context, extraTags []string, dimensions *
enrichedTags = append(enrichedTags, extraTags...)
enrichedTags = append(enrichedTags, dimensions.Tags()...)

entityTags, err := tagger.Tag(dimensions.OriginID(), t.cardinality)
entityTags, err := tagger.LegacyTag(dimensions.OriginID(), t.cardinality)
if err != nil {
log.Tracef("Cannot get tags for entity %s: %s", dimensions.OriginID(), err)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import "github.com/DataDog/datadog-agent/comp/core/tagger/types"
// see comp/core/tagger for tagger functions; client for tagger interface
type taggerClient interface {
// Tag is an interface function that queries taggerclient singleton
Tag(entity string, cardinality types.TagCardinality) ([]string, error)
Tag(entity types.EntityID, cardinality types.TagCardinality) ([]string, error)
// GlobalTags is an interface function that queries taggerclient singleton
GlobalTags(cardinality types.TagCardinality) ([]string, error)
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ func newTestTaggerClient() *testTaggerClient {
}

// Tag mocks taggerimpl.Tag functionality for the purpose of testing, removing dependency on Taggerimpl
func (t *testTaggerClient) Tag(entityID string, _ types.TagCardinality) ([]string, error) {
return t.tagMap[entityID], nil
func (t *testTaggerClient) Tag(entityID types.EntityID, _ types.TagCardinality) ([]string, error) {
return t.tagMap[entityID.String()], nil
}

// GlobalTags mocks taggerimpl.GlobalTags functionality for purpose of testing, removing dependency on Taggerimpl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (ialp *infraAttributesLogProcessor) processLogs(_ context.Context, ld plog.

// Get all unique tags from resource attributes and global tags
for _, entityID := range entityIDs {
entityTags, err := ialp.tagger.Tag(entityID.String(), ialp.cardinality)
entityTags, err := ialp.tagger.Tag(entityID, ialp.cardinality)
if err != nil {
ialp.logger.Error("Cannot get tags for entity", zap.String("entityID", entityID.String()), zap.Error(err))
continue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func (iamp *infraAttributesMetricProcessor) processMetrics(_ context.Context, md

// Get all unique tags from resource attributes and global tags
for _, entityID := range entityIDs {
entityTags, err := iamp.tagger.Tag(entityID.String(), iamp.cardinality)
entityTags, err := iamp.tagger.Tag(entityID, iamp.cardinality)
if err != nil {
iamp.logger.Error("Cannot get tags for entity", zap.String("entityID", entityID.String()), zap.Error(err))
continue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (iasp *infraAttributesSpanProcessor) processTraces(_ context.Context, td pt

// Get all unique tags from resource attributes and global tags
for _, entityID := range entityIDs {
entityTags, err := iasp.tagger.Tag(entityID.String(), iasp.cardinality)
entityTags, err := iasp.tagger.Tag(entityID, iasp.cardinality)
if err != nil {
iasp.logger.Error("Cannot get tags for entity", zap.String("entityID", entityID.String()), zap.Error(err))
continue
Expand Down
2 changes: 1 addition & 1 deletion comp/trace/config/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func prepareConfig(c corecompcfg.Component) (*config.AgentConfig, error) {
}

func containerTagsFunc(cid string) ([]string, error) {
return tagger.Tag(types.NewEntityID(types.ContainerID, cid).String(), types.HighCardinality)
return tagger.Tag(types.NewEntityID(types.ContainerID, cid), types.HighCardinality)
}

// appendEndpoints appends any endpoint configuration found at the given cfgKey.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ func newNodePodTagProvider() PodTagProvider { return &nodePodTagProvider{} }

// GetTags implements PodTagProvider#GetTags
func (p *nodePodTagProvider) GetTags(pod *corev1.Pod, cardinality taggertypes.TagCardinality) ([]string, error) {
return tagger.Tag(taggertypes.NewEntityID(taggertypes.KubernetesPodUID, string(pod.UID)).String(), cardinality)
return tagger.Tag(taggertypes.NewEntityID(taggertypes.KubernetesPodUID, string(pod.UID)), cardinality)
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func ExtractECSTask(task TaskWithContainers) *model.ECSTask {
}

entityID := types.NewEntityID(types.ECSTask, task.Task.EntityID.ID)
tags, err := tagger.Tag(entityID.String(), types.HighCardinality)
tags, err := tagger.Tag(entityID, types.HighCardinality)
if err != nil {
log.Debugf("Could not retrieve tags for task: %s", err.Error())
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/collector/corechecks/containerimage/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (p *processor) processRefresh(allImages []*workloadmeta.ContainerImageMetad

func (p *processor) processImage(img *workloadmeta.ContainerImageMetadata) {
entityID := types.NewEntityID(types.ContainerImageMetadata, img.ID)
ddTags, err := tagger.Tag(entityID.String(), types.HighCardinality)
ddTags, err := tagger.Tag(entityID, types.HighCardinality)
if err != nil {
log.Errorf("Could not retrieve tags for container image %s: %v", img.ID, err)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/collector/corechecks/containers/containerd/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func computeEvents(events []containerdEvent, sender sender.Sender, fil *containe
alertType := event.AlertTypeInfo
if split[1] == "containers" || split[1] == "tasks" {
// For task events, we use the container ID in order to query the Tagger's API
t, err := tagger.Tag(types.NewEntityID(types.ContainerID, e.ID).String(), types.HighCardinality)
t, err := tagger.Tag(types.NewEntityID(types.ContainerID, e.ID), types.HighCardinality)
if err != nil {
// If there is an error retrieving tags from the Tagger, we can still submit the event as is.
log.Errorf("Could not retrieve tags for the container %s: %v", e.ID, err)
Expand Down
2 changes: 1 addition & 1 deletion pkg/collector/corechecks/containers/docker/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ func (d *DockerCheck) runDockerCustom(sender sender.Sender, du docker.Client, ra

isContainerExcluded := d.containerFilter.IsExcluded(annotations, containerName, resolvedImageName, rawContainer.Labels[kubernetes.CriContainerNamespaceLabel])
isContainerRunning := rawContainer.State == string(workloadmeta.ContainerStatusRunning)
taggerEntityID := types.NewEntityID(types.ContainerID, rawContainer.ID).String()
taggerEntityID := types.NewEntityID(types.ContainerID, rawContainer.ID)
tags, err := getImageTagsFromContainer(taggerEntityID, resolvedImageName, isContainerExcluded || !isContainerRunning)
if err != nil {
log.Debugf("Unable to fetch tags for image: %s, err: %v", rawContainer.ImageID, err)
Expand Down
2 changes: 1 addition & 1 deletion pkg/collector/corechecks/containers/docker/eventbundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func (b *dockerEventBundle) toDatadogEvent(hostname string) (event.Event, error)

for cid := range seenContainers {

tags, err := tagger.Tag(types.NewEntityID(types.ContainerID, cid).String(), types.HighCardinality)
tags, err := tagger.Tag(types.NewEntityID(types.ContainerID, cid), types.HighCardinality)
if err != nil {
log.Debugf("no tags for %s: %s", cid, err)
} else {
Expand Down
2 changes: 1 addition & 1 deletion pkg/collector/corechecks/containers/docker/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (d *DockerCheck) reportExitCodes(events []*docker.ContainerEvent, sender se
status = servicecheck.ServiceCheckCritical
}

tags, err := tagger.Tag(types.NewEntityID(types.ContainerID, ev.ContainerID).String(), types.HighCardinality)
tags, err := tagger.Tag(types.NewEntityID(types.ContainerID, ev.ContainerID), types.HighCardinality)
if err != nil {
log.Debugf("no tags for %s: %s", ev.ContainerID, err)
tags = []string{}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (t *unbundledTransformer) Transform(events []*docker.ContainerEvent) ([]eve
emittedEvents.Inc(string(alertType))

tags, err := tagger.Tag(
types.NewEntityID(types.ContainerID, ev.ContainerID).String(),
types.NewEntityID(types.ContainerID, ev.ContainerID),
types.HighCardinality,
)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/collector/corechecks/containers/docker/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func getProcessorFilter(legacyFilter *containers.Filter, store workloadmeta.Comp
}
}

func getImageTagsFromContainer(taggerEntityID string, resolvedImageName string, isContainerExcluded bool) ([]string, error) {
func getImageTagsFromContainer(taggerEntityID types.EntityID, resolvedImageName string, isContainerExcluded bool) ([]string, error) {
if isContainerExcluded {
return getImageTags(resolvedImageName)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/collector/corechecks/containers/generic/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (p *Processor) Run(sender sender.Sender, cacheValidity time.Duration) error

entityID := types.NewEntityID(types.ContainerID, container.ID)

tags, err := tagger.Tag(entityID.String(), types.HighCardinality)
tags, err := tagger.Tag(entityID, types.HighCardinality)
if err != nil {
log.Errorf("Could not collect tags for container %q, err: %v", container.ID[:12], err)
continue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (pn *ProcessorNetwork) processGroupedContainerNetwork() {
pn.generateNetworkMetrics(containerNetworks.tags, containerNetworks.stats)
} else if containerNetworks.owner != nil && containerNetworks.owner.Kind == workloadmeta.KindKubernetesPod {
podEntityID := types.NewEntityID(types.KubernetesPodUID, containerNetworks.owner.ID)
orchTags, err := tagger.Tag(podEntityID.String(), types.HighCardinality)
orchTags, err := tagger.Tag(podEntityID, types.HighCardinality)
if err != nil {
log.Debugf("Unable to get orchestrator tags for pod: %s", containerNetworks.owner.ID)
continue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,19 +192,19 @@ func TestNetworkProcessorExtension(t *testing.T) {
// Running them through the ProcessorExtension
networkProcessor.PreProcess(MockSendMetric, mockSender)

container1Tags, _ := fakeTagger.Tag("container_id://1", types.HighCardinality)
container1Tags, _ := fakeTagger.Tag(types.NewEntityID(types.ContainerID, "1"), types.HighCardinality)
networkProcessor.Process(container1Tags, container1, mockCollector, 0)
container2Tags, _ := fakeTagger.Tag("container_id://2", types.HighCardinality)
container2Tags, _ := fakeTagger.Tag(types.NewEntityID(types.ContainerID, "2"), types.HighCardinality)
networkProcessor.Process(container2Tags, container2, mockCollector, 0)
container3Tags, _ := fakeTagger.Tag("container_id://3", types.HighCardinality)
container3Tags, _ := fakeTagger.Tag(types.NewEntityID(types.ContainerID, "3"), types.HighCardinality)
networkProcessor.Process(container3Tags, container3, mockCollector, 0)
container4Tags, _ := fakeTagger.Tag("container_id://4", types.HighCardinality)
container4Tags, _ := fakeTagger.Tag(types.NewEntityID(types.ContainerID, "4"), types.HighCardinality)
networkProcessor.Process(container4Tags, container4, mockCollector, 0)
container5Tags, _ := fakeTagger.Tag("container_id://5", types.HighCardinality)
container5Tags, _ := fakeTagger.Tag(types.NewEntityID(types.ContainerID, "5"), types.HighCardinality)
networkProcessor.Process(container5Tags, container5, mockCollector, 0)
container6Tags, _ := fakeTagger.Tag("container_id://6", types.HighCardinality)
container6Tags, _ := fakeTagger.Tag(types.NewEntityID(types.ContainerID, "6"), types.HighCardinality)
networkProcessor.Process(container6Tags, container6, mockCollector, 0)
container7Tags, _ := fakeTagger.Tag("container_id://7", types.HighCardinality)
container7Tags, _ := fakeTagger.Tag(types.NewEntityID(types.ContainerID, "7"), types.HighCardinality)
networkProcessor.Process(container7Tags, container7, mockCollector, 0)

networkProcessor.PostProcess()
Expand Down
6 changes: 2 additions & 4 deletions pkg/collector/corechecks/containers/kubelet/common/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func (p *PodUtils) PopulateForPod(pod *kubelet.Pod) {
// computePodTagsByPVC stores the tags for a given pod in a global caching layer, indexed by pod namespace and persistent
// volume name.
func (p *PodUtils) computePodTagsByPVC(pod *kubelet.Pod) {
podUID := types.NewEntityID(types.KubernetesPodUID, pod.Metadata.UID).String()
podUID := types.NewEntityID(types.KubernetesPodUID, pod.Metadata.UID)
tags, _ := tagger.Tag(podUID, types.OrchestratorCardinality)
if len(tags) == 0 {
return
Expand Down Expand Up @@ -192,7 +192,5 @@ func GetContainerID(store workloadmeta.Component, metric model.Metric, filter *c
return "", ErrContainerExcluded
}

cID := types.NewEntityID(types.ContainerID, container.ID).String()

return cID, nil
return container.ID, nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ func (p *Provider) processContainerMetric(metricType, metricName string, metricF
// for static pods, see https://github.com/kubernetes/kubernetes/pull/59948
pod := p.getPodByMetricLabel(sample.Metric)
if pod != nil && p.podUtils.IsStaticPendingPod(pod.ID) {
podTags, _ := tagger.Tag(taggercommon.BuildTaggerEntityID(pod.GetID()).String(), types.HighCardinality)
podTags, _ := tagger.Tag(taggercommon.BuildTaggerEntityID(pod.GetID()), types.HighCardinality)
if len(podTags) == 0 {
continue
}
Expand Down Expand Up @@ -208,7 +208,7 @@ func (p *Provider) processPodRate(metricName string, metricFam *prom.MetricFamil
continue
}
entityID := taggercommon.BuildTaggerEntityID(pod.GetID())
tags, _ := tagger.Tag(entityID.String(), types.HighCardinality)
tags, _ := tagger.Tag(entityID, types.HighCardinality)
if len(tags) == 0 {
continue
}
Expand Down Expand Up @@ -250,7 +250,7 @@ func (p *Provider) processUsageMetric(metricName string, metricFam *prom.MetricF
pod := p.getPodByMetricLabel(sample.Metric)
if pod != nil && p.podUtils.IsStaticPendingPod(pod.ID) {
entityID := taggercommon.BuildTaggerEntityID(pod.EntityID)
podTags, _ := tagger.Tag(entityID.String(), types.HighCardinality)
podTags, _ := tagger.Tag(entityID, types.HighCardinality)
if len(podTags) == 0 {
continue
}
Expand Down Expand Up @@ -352,7 +352,7 @@ func (p *Provider) getEntityIDIfContainerMetric(labels model.Metric) string {
return p.getPodUID(labels)
}
cID, _ := common.GetContainerID(p.store, labels, p.filter)
return cID
return types.NewEntityID(types.ContainerID, cID).String()
}
return ""
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func (p *Provider) kubeletContainerLogFilesystemUsedBytes(metricFam *prom.Metric
continue
}

tags, _ := tagger.Tag(cID, types.HighCardinality)
tags, _ := tagger.Tag(types.NewEntityID(types.ContainerID, cID), types.HighCardinality)
if len(tags) == 0 {
log.Debugf("Tags not found for container: %s/%s/%s:%s", metric.Metric["namespace"], metric.Metric["pod"], metric.Metric["container"], cID)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func (p *Provider) Provide(kc kubelet.KubeUtilInterface, sender sender.Sender) e
return nil
}

func (p *Provider) generateContainerSpecMetrics(sender sender.Sender, pod *kubelet.Pod, container *kubelet.ContainerSpec, cStatus *kubelet.ContainerStatus, containerID string) {
func (p *Provider) generateContainerSpecMetrics(sender sender.Sender, pod *kubelet.Pod, container *kubelet.ContainerSpec, cStatus *kubelet.ContainerStatus, containerID types.EntityID) {
if pod.Status.Phase != "Running" && pod.Status.Phase != "Pending" {
return
}
Expand All @@ -140,7 +140,7 @@ func (p *Provider) generateContainerSpecMetrics(sender sender.Sender, pod *kubel
}
}

func (p *Provider) generateContainerStatusMetrics(sender sender.Sender, pod *kubelet.Pod, _ *kubelet.ContainerSpec, cStatus *kubelet.ContainerStatus, containerID string) {
func (p *Provider) generateContainerStatusMetrics(sender sender.Sender, pod *kubelet.Pod, _ *kubelet.ContainerSpec, cStatus *kubelet.ContainerStatus, containerID types.EntityID) {
if pod.Metadata.UID == "" || pod.Metadata.Name == "" {
return
}
Expand Down Expand Up @@ -184,7 +184,7 @@ func newRunningAggregator() *runningAggregator {
}
}

func (r *runningAggregator) recordContainer(p *Provider, pod *kubelet.Pod, cStatus *kubelet.ContainerStatus, containerID string) {
func (r *runningAggregator) recordContainer(p *Provider, pod *kubelet.Pod, cStatus *kubelet.ContainerStatus, containerID types.EntityID) {
if cStatus.State.Running == nil || time.Time.IsZero(cStatus.State.Running.StartedAt) {
return
}
Expand All @@ -210,7 +210,7 @@ func (r *runningAggregator) recordPod(p *Provider, pod *kubelet.Pod) {
log.Debug("skipping pod with no uid")
return
}
entityID := types.NewEntityID(types.KubernetesPodUID, podID).String()
entityID := types.NewEntityID(types.KubernetesPodUID, podID)
tagList, _ := tagger.Tag(entityID, types.LowCardinality)
if len(tagList) == 0 {
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func (p *Provider) proberProbeTotal(metricFam *prom.MetricFamily, sender sender.
continue
}

tags, _ := tagger.Tag(cID, types.HighCardinality)
tags, _ := tagger.Tag(types.NewEntityID(types.ContainerID, cID), types.HighCardinality)
if len(tags) == 0 {
continue
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func (p *Provider) processPodStats(sender sender.Sender,
}

entityID := types.NewEntityID(types.KubernetesPodUID, podStats.PodRef.UID)
podTags, _ := tagger.Tag(entityID.String(),
podTags, _ := tagger.Tag(entityID,
types.OrchestratorCardinality)

if len(podTags) == 0 {
Expand Down Expand Up @@ -221,7 +221,7 @@ func (p *Provider) processContainerStats(sender sender.Sender,
podStats.PodRef.Namespace) {
continue
}
tags, err := tagger.Tag(types.NewEntityID(types.ContainerID, ctr.ID).String(), types.HighCardinality)
tags, err := tagger.Tag(types.NewEntityID(types.ContainerID, ctr.ID), types.HighCardinality)
if err != nil || len(tags) == 0 {
log.Debugf("Tags not found for container: %s/%s/%s:%s - no metrics will be sent",
podStats.PodRef.Namespace, podStats.PodRef.Name, containerName, ctr.ID)
Expand Down
4 changes: 2 additions & 2 deletions pkg/collector/corechecks/ebpf/oomkill/oom_kill.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ func (m *OOMKillCheck) Run() error {
log.Debugf("Unable to extract containerID from cgroup name: %s, err: %v", line.CgroupName, err)
}

entityID := types.NewEntityID(types.ContainerID, containerID).String()
entityID := types.NewEntityID(types.ContainerID, containerID)
var tags []string
if entityID != "" {
if entityID.Empty() {
tags, err = tagger.Tag(entityID, tagger.ChecksCardinality())
if err != nil {
log.Errorf("Error collecting tags for container %s: %s", containerID, err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ func (t *TCPQueueLengthCheck) Run() error {
continue
}

entityID := types.NewEntityID(types.ContainerID, containerID).String()
entityID := types.NewEntityID(types.ContainerID, containerID)
var tags []string
if entityID != "" {
if entityID.Empty() {
tags, err = tagger.Tag(entityID, types.HighCardinality)
if err != nil {
log.Errorf("Error collecting tags for container %s: %s", k, err)
Expand Down
2 changes: 1 addition & 1 deletion pkg/collector/corechecks/sbom/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ func (p *processor) processImageSBOM(img *workloadmeta.ContainerImageMetadata) {
return
}

entityID := types.NewEntityID(types.ContainerImageMetadata, img.ID).String()
entityID := types.NewEntityID(types.ContainerImageMetadata, img.ID)
ddTags, err := tagger.Tag(entityID, types.HighCardinality)
if err != nil {
log.Errorf("Could not retrieve tags for container image %s: %v", img.ID, err)
Expand Down
2 changes: 1 addition & 1 deletion pkg/collector/python/tagger.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import "C"

// for testing purposes
var (
tagsFunc = tagger.TagDeprecated
tagsFunc = tagger.LegacyTag
)

// Tags bridges towards tagger.Tag to retrieve container tags
Expand Down
6 changes: 3 additions & 3 deletions pkg/collector/python/test_tagger.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func tagsMockEmpty(string, types.TagCardinality) ([]string, error) {

func testTags(t *testing.T) {
tagsFunc = tagsMock
defer func() { tagsFunc = tagger.Tag }()
defer func() { tagsFunc = tagger.LegacyTag }()

id := C.CString("test")
defer C.free(unsafe.Pointer(id))
Expand All @@ -68,7 +68,7 @@ func testTags(t *testing.T) {

func testTagsNull(t *testing.T) {
tagsFunc = tagsMockNull
defer func() { tagsFunc = tagger.Tag }()
defer func() { tagsFunc = tagger.LegacyTag }()

id := C.CString("test")
defer C.free(unsafe.Pointer(id))
Expand All @@ -79,7 +79,7 @@ func testTagsNull(t *testing.T) {

func testTagsEmpty(t *testing.T) {
tagsFunc = tagsMockEmpty
defer func() { tagsFunc = tagger.Tag }()
defer func() { tagsFunc = tagger.LegacyTag }()

id := C.CString("test")
defer C.free(unsafe.Pointer(id))
Expand Down
Loading

0 comments on commit d82fa97

Please sign in to comment.