Skip to content

Commit

Permalink
update mapping.go test for mapping type from string test
Browse files Browse the repository at this point in the history
Signed-off-by: Saumya Shah <saumyabshah90@gmail.com>
  • Loading branch information
Saumya40-codes committed Oct 15, 2024
1 parent 81fa810 commit 656a79d
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions plugin/storage/es/mappings/mapping_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,32 @@ func TestMappingBuilderGetMapping(t *testing.T) {
}
}

func TestMappingTypeFromString(t *testing.T) {
tests := []struct {
input string
expected MappingType
hasError bool
}{
{"jaeger-span", SpanMapping, false},
{"jaeger-service", ServiceMapping, false},
{"jaeger-dependencies", DependenciesMapping, false},
{"jaeger-sampling", SamplingMapping, false},
{"invalid", MappingType(-1), true},
}

for _, tt := range tests {
t.Run(tt.input, func(t *testing.T) {
result, err := MappingTypeFromString(tt.input)
if tt.hasError {
assert.Error(t, err)
} else {
assert.NoError(t, err)

Check failure on line 102 in plugin/storage/es/mappings/mapping_test.go

View workflow job for this annotation

GitHub Actions / lint

require-error: for error assertions use require (testifylint)
assert.Equal(t, tt.expected, result)
}
})
}
}

func TestMappingBuilderLoadMapping(t *testing.T) {
tests := []struct {
name string
Expand Down

0 comments on commit 656a79d

Please sign in to comment.