Skip to content

Commit

Permalink
Start suite to test attribute conversions
Browse files Browse the repository at this point in the history
  • Loading branch information
bryannaegele committed Jul 10, 2024
1 parent 67e1991 commit fbcb0f3
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions apps/opentelemetry_exporter/test/otel_otlp_common_SUITE.erl
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
-module(otel_otlp_common_SUITE).

-compile(export_all).
-compile(nowarn_export_all).

-include_lib("stdlib/include/assert.hrl").
-include_lib("common_test/include/ct.hrl").
-include_lib("opentelemetry_api/include/opentelemetry.hrl").

all() ->
[
to_attrs_list_atoms,
to_attrs_list_binaries,
to_attrs_tuple_binaries
].


init_per_suite(Config) ->
Config.

end_per_suite(_Config) ->
ok.

to_attrs_list_atoms(_Config) ->
ArrayExpected = #{value => {array_value, #{values => [#{value => {string_value,<<"a">>}}, #{value => {string_value,<<"b">>}}]}}},
[#{value := Actual}] = otel_otlp_common:to_attributes(#{atoms => [a, b]}),
?assertEqual(ArrayExpected, Actual).


to_attrs_list_binaries(_Config) ->
ArrayExpected = #{value => {array_value, #{values => [#{value => {string_value,<<"a">>}}, #{value => {string_value,<<"b">>}}]}}},
[#{value := Actual}] = otel_otlp_common:to_attributes(#{atoms => [<<"a">>, <<"b">>]}),
?assertEqual(ArrayExpected, Actual).


to_attrs_tuple_binaries(_Config) ->
ArrayExpected = #{value => {array_value, #{values => [#{value => {string_value,<<"a">>}}, #{value => {string_value,<<"b">>}}]}}},
[#{value := Actual}] = otel_otlp_common:to_attributes(#{atoms => {<<"a">>, <<"b">>}}),
?assertEqual(ArrayExpected, Actual).

0 comments on commit fbcb0f3

Please sign in to comment.