|
| 1 | +-module(otel_otlp_common_SUITE). |
| 2 | + |
| 3 | +-compile(export_all). |
| 4 | +-compile(nowarn_export_all). |
| 5 | + |
| 6 | +-include_lib("stdlib/include/assert.hrl"). |
| 7 | +-include_lib("common_test/include/ct.hrl"). |
| 8 | +-include_lib("opentelemetry_api/include/opentelemetry.hrl"). |
| 9 | + |
| 10 | +all() -> |
| 11 | + [ |
| 12 | + to_attrs_list_atoms, |
| 13 | + to_attrs_list_binaries, |
| 14 | + to_attrs_tuple_binaries |
| 15 | + ]. |
| 16 | + |
| 17 | + |
| 18 | +init_per_suite(Config) -> |
| 19 | + Config. |
| 20 | + |
| 21 | +end_per_suite(_Config) -> |
| 22 | + ok. |
| 23 | + |
| 24 | +to_attrs_list_atoms(_Config) -> |
| 25 | + ArrayExpected = #{value => {array_value, #{values => [#{value => {string_value,<<"a">>}}, #{value => {string_value,<<"b">>}}]}}}, |
| 26 | + [#{value := Actual}] = otel_otlp_common:to_attributes(#{atoms => [a, b]}), |
| 27 | + ?assertEqual(ArrayExpected, Actual). |
| 28 | + |
| 29 | + |
| 30 | +to_attrs_list_binaries(_Config) -> |
| 31 | + ArrayExpected = #{value => {array_value, #{values => [#{value => {string_value,<<"a">>}}, #{value => {string_value,<<"b">>}}]}}}, |
| 32 | + [#{value := Actual}] = otel_otlp_common:to_attributes(#{atoms => [<<"a">>, <<"b">>]}), |
| 33 | + ?assertEqual(ArrayExpected, Actual). |
| 34 | + |
| 35 | + |
| 36 | +to_attrs_tuple_binaries(_Config) -> |
| 37 | + ArrayExpected = #{value => {array_value, #{values => [#{value => {string_value,<<"a">>}}, #{value => {string_value,<<"b">>}}]}}}, |
| 38 | + [#{value := Actual}] = otel_otlp_common:to_attributes(#{atoms => {<<"a">>, <<"b">>}}), |
| 39 | + ?assertEqual(ArrayExpected, Actual). |
0 commit comments