Skip to content

Commit

Permalink
clean-up tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeGoldsmith committed Jun 5, 2024
1 parent 5b5d274 commit f46ff84
Showing 1 changed file with 10 additions and 23 deletions.
33 changes: 10 additions & 23 deletions processors/baggage/baggagetrace/processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,10 @@ func NewTestExporter() *testExporter {
return &testExporter{}
}

func TestSpanProcessorAppendsBaggageAttributes(t *testing.T) {
suitcase, err := otelbaggage.New()
require.NoError(t, err)
packingCube, err := otelbaggage.NewMemberRaw("baggage.test", "baggage value")
require.NoError(t, err)
suitcase, err = suitcase.SetMember(packingCube)
require.NoError(t, err)
ctx := otelbaggage.ContextWithBaggage(context.Background(), suitcase)
func TestSpanProcessorAppendsAllBaggageAttributes(t *testing.T) {
baggage, _ := otelbaggage.New()
baggage = addEntryToBaggage(baggage, "baggage.test", "baggage value")
ctx := otelbaggage.ContextWithBaggage(context.Background(), baggage)

// create trace provider with baggage processor and test exporter
exporter := NewTestExporter()
Expand All @@ -63,13 +59,9 @@ func TestSpanProcessorAppendsBaggageAttributes(t *testing.T) {
}

func TestSpanProcessorAppendsBaggageAttributesWithHaPrefixPredicate(t *testing.T) {
suitcase, err := otelbaggage.New()
require.NoError(t, err)
packingCube, err := otelbaggage.NewMemberRaw("baggage.test", "baggage value")
require.NoError(t, err)
suitcase, err = suitcase.SetMember(packingCube)
require.NoError(t, err)
ctx := otelbaggage.ContextWithBaggage(context.Background(), suitcase)
baggage, _ := otelbaggage.New()
baggage = addEntryToBaggage(baggage, "baggage.test", "baggage value")
ctx := otelbaggage.ContextWithBaggage(context.Background(), baggage)

baggageKeyPredicate := func(key string) bool {
return strings.HasPrefix(key, "baggage.")
Expand All @@ -95,13 +87,9 @@ func TestSpanProcessorAppendsBaggageAttributesWithHaPrefixPredicate(t *testing.T
}

func TestSpanProcessorAppendsBaggageAttributesWithRegexPredicate(t *testing.T) {
suitcase, err := otelbaggage.New()
require.NoError(t, err)
packingCube, err := otelbaggage.NewMemberRaw("baggage.test", "baggage value")
require.NoError(t, err)
suitcase, err = suitcase.SetMember(packingCube)
require.NoError(t, err)
ctx := otelbaggage.ContextWithBaggage(context.Background(), suitcase)
baggage, _ := otelbaggage.New()
baggage = addEntryToBaggage(baggage, "baggage.test", "baggage value")
ctx := otelbaggage.ContextWithBaggage(context.Background(), baggage)

expr := regexp.MustCompile(`^baggage\..*`)
baggageKeyPredicate := func(key string) bool {
Expand Down Expand Up @@ -131,7 +119,6 @@ func TestOnlyAddsBaggageEntriesThatMatchPredicate(t *testing.T) {
baggage, _ := otelbaggage.New()
baggage = addEntryToBaggage(baggage, "foo", "foo value")
baggage = addEntryToBaggage(baggage, "bar", "bar value")

ctx := otelbaggage.ContextWithBaggage(context.Background(), baggage)

baggageKeyPredicate := func(key string) bool {
Expand Down

0 comments on commit f46ff84

Please sign in to comment.