Skip to content

Commit 4c542f4

Browse files
committed
simplify test
1 parent 49bfc11 commit 4c542f4

File tree

1 file changed

+21
-18
lines changed

1 file changed

+21
-18
lines changed

pkg/pipeline/transform/transform_network_test.go

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -526,33 +526,36 @@ func Test_DecodeTCPFlags(t *testing.T) {
526526
tr, err := NewTransformNetwork(config.StageParam{
527527
Transform: &config.Transform{
528528
Network: &api.TransformNetwork{
529-
Rules: []api.NetworkTransformRule{{
530-
Type: "decode_tcp_flags",
531-
DecodeTCPFlags: &api.NetworkGenericRule{
532-
Input: "TcpFlags",
533-
Output: "TcpFlagsString",
529+
Rules: []api.NetworkTransformRule{
530+
{
531+
Type: "decode_tcp_flags",
532+
DecodeTCPFlags: &api.NetworkGenericRule{
533+
Input: "TcpFlagsU16",
534+
Output: "TcpFlagsU16String",
535+
},
534536
},
535-
}},
537+
{
538+
Type: "decode_tcp_flags",
539+
DecodeTCPFlags: &api.NetworkGenericRule{
540+
Input: "TcpFlagsU32",
541+
Output: "TcpFlagsU32String",
542+
},
543+
},
544+
},
536545
},
537546
},
538547
}, nil)
539548
require.NoError(t, err)
540549

541550
output, ok := tr.Transform(config.GenericMap{
542-
"TcpFlags": uint16(17),
543-
})
544-
require.True(t, ok)
545-
require.Equal(t, config.GenericMap{
546-
"TcpFlags": uint16(17),
547-
"TcpFlagsString": []string{"FIN", "ACK"},
548-
}, output)
549-
550-
output, ok = tr.Transform(config.GenericMap{
551-
"TcpFlags": uint32(17),
551+
"TcpFlagsU16": uint16(17),
552+
"TcpFlagsU32": uint32(18),
552553
})
553554
require.True(t, ok)
554555
require.Equal(t, config.GenericMap{
555-
"TcpFlags": uint32(17),
556-
"TcpFlagsString": []string{"FIN", "ACK"},
556+
"TcpFlagsU16": uint16(17),
557+
"TcpFlagsU16String": []string{"FIN", "ACK"},
558+
"TcpFlagsU32": uint32(18),
559+
"TcpFlagsU32String": []string{"SYN", "ACK"},
557560
}, output)
558561
}

0 commit comments

Comments
 (0)