Skip to content

Commit

Permalink
Fix test errors
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarocabanas committed Aug 18, 2023
1 parent 1ec843d commit 4994c11
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
7 changes: 5 additions & 2 deletions pkg/metrics/process/sampler_darwin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ package process

import (
"errors"
"testing"

"github.com/newrelic/infrastructure-agent/pkg/metrics"

"github.com/newrelic/infrastructure-agent/internal/agent/mocks"
"github.com/newrelic/infrastructure-agent/pkg/config"
"github.com/newrelic/infrastructure-agent/pkg/metrics/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"testing"
)

func TestProcessSampler_Sample(t *testing.T) {
Expand Down Expand Up @@ -110,7 +113,7 @@ func TestProcessSampler_Sample_DockerDecorator(t *testing.T) {
harvester := &HarvesterMock{}
sampler := NewProcessSampler(ctx).(*processSampler)
sampler.harvest = harvester
sampler.containerSampler = &fakeContainerSampler{}
sampler.containerSamplers = []metrics.ContainerSampler{&fakeContainerSampler{}}

samples := []*types.ProcessSample{
{
Expand Down
3 changes: 2 additions & 1 deletion pkg/metrics/process/sampler_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"github.com/newrelic/infrastructure-agent/pkg/config"
"github.com/newrelic/infrastructure-agent/pkg/entity"
"github.com/newrelic/infrastructure-agent/pkg/entity/host"
"github.com/newrelic/infrastructure-agent/pkg/metrics"
"github.com/newrelic/infrastructure-agent/pkg/metrics/types"
"github.com/newrelic/infrastructure-agent/pkg/plugins/ids"
"github.com/newrelic/infrastructure-agent/pkg/sample"
Expand All @@ -41,7 +42,7 @@ func TestProcessSampler_DockerDecorator(t *testing.T) {
ProcessDisplayName: "Bye",
},
}}
ps.containerSampler = &fakeContainerSampler{}
ps.containerSamplers = []metrics.ContainerSampler{&fakeContainerSampler{}}

// When asking for the process samples
samples, err := ps.Sample()
Expand Down
2 changes: 1 addition & 1 deletion pkg/metrics/procs_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ func (self *ProcsMonitor) Sample() (results sample.EventBatch, err error) {
}

var containerDecorators []ProcessDecorator
for _, containerSampler := range ps.containerSamplers {
for _, containerSampler := range self.containerSamplers {
if containerSampler.Enabled() {
decorator, err := containerSampler.NewDecorator()
if err != nil {
Expand Down

0 comments on commit 4994c11

Please sign in to comment.