mirror of
https://github.com/hanzoai/telemetry.git
synced 2026-10-30 20:01:49 +00:00
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description Migrates existing scrapererror code to new scraper package. Sets aliases for receiver/scrapererror so that dependent code in contrib and elsewhere can be updated <!-- Issue number if applicable --> #### Link to tracking issue Relates to #11003 <!--Describe what testing was performed and which tests were added.--> #### Testing included unit/integration tests should suffice <!--Describe the documentation added.--> #### Documentation changelog yaml <!--Please delete paragraphs that you did not use before submitting.--> --------- Co-authored-by: Pablo Baeyens <[email protected]> Co-authored-by: Pablo Baeyens <[email protected]>
29 lines
654 B
Go
29 lines
654 B
Go
// Copyright The OpenTelemetry Authors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package scrapererror
|
|
|
|
import (
|
|
"errors"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestPartialScrapeError(t *testing.T) {
|
|
failed := 2
|
|
err := errors.New("some error")
|
|
partialErr := NewPartialScrapeError(err, failed)
|
|
require.EqualError(t, err, partialErr.Error())
|
|
assert.Equal(t, failed, partialErr.Failed)
|
|
}
|
|
|
|
func TestIsPartialScrapeError(t *testing.T) {
|
|
err := errors.New("testError")
|
|
require.False(t, IsPartialScrapeError(err))
|
|
|
|
err = NewPartialScrapeError(err, 2)
|
|
require.True(t, IsPartialScrapeError(err))
|
|
}
|