Skip to content

Commit

Permalink
add e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kuiperda committed Sep 25, 2024
1 parent 38e3c5f commit 481a6e3
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions pkg/ottl/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,9 @@ func Test_e2e_editors(t *testing.T) {
}
}




func Test_e2e_converters(t *testing.T) {
tests := []struct {
statement string
Expand Down Expand Up @@ -609,6 +612,30 @@ func Test_e2e_converters(t *testing.T) {
m.PutStr("k2", "v2__!__v2")
},
},
{
statement: `set(attributes["test"], MarshalKeyValue(ParseKeyValue("k1=v1 k2=v2")))`,
want: func(tCtx ottllog.TransformContext) {
tCtx.GetLogRecord().Attributes().PutStr("test", "k1=v1 k2=v2")
},
},
{
statement: `set(attributes["test"], MarshalKeyValue(ParseKeyValue("k1:v1,k2:v2", ":" , ","), ":", ","))`,
want: func(tCtx ottllog.TransformContext) {
tCtx.GetLogRecord().Attributes().PutStr("test", "k1:v1,k2:v2")
},
},
{
statement: `set(attributes["test"], MarshalKeyValue(ParseKeyValue("k1=v1 k2=v2"), "!", "+"))`,
want: func(tCtx ottllog.TransformContext) {
tCtx.GetLogRecord().Attributes().PutStr("test", "k1!v1+k2!v2")
},
},
{
statement: `set(attributes["test"], MarshalKeyValue(ParseKeyValue("k1=v1 k2=v2=v3")))`,
want: func(tCtx ottllog.TransformContext) {
tCtx.GetLogRecord().Attributes().PutStr("test", "k1=v1 k2=\"v2=v3\"")
},
},
{
statement: `set(attributes["test"], ParseXML("<Log id=\"1\"><Message>This is a log message!</Message></Log>"))`,
want: func(tCtx ottllog.TransformContext) {
Expand Down

0 comments on commit 481a6e3

Please sign in to comment.