Skip to content

Commit

Permalink
[chore] remove test only request impl for profile, use requesttest (#…
Browse files Browse the repository at this point in the history
…12248)

Signed-off-by: Bogdan Drutu <[email protected]>
  • Loading branch information
bogdandrutu authored Feb 2, 2025
1 parent 10f11f7 commit bcf27e1
Showing 1 changed file with 2 additions and 26 deletions.
28 changes: 2 additions & 26 deletions exporter/exporterhelper/xexporterhelper/profiles_batch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

"go.opentelemetry.io/collector/exporter/exporterbatcher"
"go.opentelemetry.io/collector/exporter/exporterhelper"
"go.opentelemetry.io/collector/exporter/internal/requesttest"
"go.opentelemetry.io/collector/pdata/pprofile"
"go.opentelemetry.io/collector/pdata/testdata"
)
Expand All @@ -26,9 +27,8 @@ func TestMergeProfiles(t *testing.T) {
}

func TestMergeProfilesInvalidInput(t *testing.T) {
pr1 := &dummyRequest{}
pr2 := newProfilesRequest(testdata.GenerateProfiles(3), nil)
_, err := pr2.MergeSplit(context.Background(), exporterbatcher.MaxSizeConfig{}, pr1)
_, err := pr2.MergeSplit(context.Background(), exporterbatcher.MaxSizeConfig{}, &requesttest.FakeRequest{Items: 1})
assert.Error(t, err)
}

Expand Down Expand Up @@ -125,13 +125,6 @@ func TestMergeSplitProfiles(t *testing.T) {
}
}

func TestMergeSplitProfilesInvalidInput(t *testing.T) {
r1 := &dummyRequest{}
r2 := newProfilesRequest(testdata.GenerateProfiles(3), nil)
_, err := r2.MergeSplit(context.Background(), exporterbatcher.MaxSizeConfig{}, r1)
assert.Error(t, err)
}

func TestExtractProfiles(t *testing.T) {
for i := 0; i < 10; i++ {
ld := testdata.GenerateProfiles(10)
Expand All @@ -140,20 +133,3 @@ func TestExtractProfiles(t *testing.T) {
assert.Equal(t, 10-i, ld.SampleCount())
}
}

// dummyRequest implements Request. It is for checking that merging two request types would fail
type dummyRequest struct{}

func (req *dummyRequest) Export(_ context.Context) error {
return nil
}

func (req *dummyRequest) ItemsCount() int {
return 1
}

func (req *dummyRequest) MergeSplit(_ context.Context, _ exporterbatcher.MaxSizeConfig, _ exporterhelper.Request) (
[]exporterhelper.Request, error,
) {
return nil, nil
}

0 comments on commit bcf27e1

Please sign in to comment.