mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-09-09 06:21:57 +00:00
Add TestRegister
, TestMacros
and TestPing
methods
This commit is contained in:
@@ -34,6 +34,30 @@ const (
|
|||||||
testUpdate = "TEST_UPDATE"
|
testUpdate = "TEST_UPDATE"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func TestRegister(t *testing.T) {
|
||||||
|
dissector := NewDissector()
|
||||||
|
extension := &api.Extension{}
|
||||||
|
dissector.Register(extension)
|
||||||
|
assert.Equal(t, "http", extension.Protocol.Name)
|
||||||
|
assert.NotNil(t, extension.MatcherMap)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestMacros(t *testing.T) {
|
||||||
|
expectedMacros := map[string]string{
|
||||||
|
"http": `proto.name == "http" and proto.version.startsWith("1")`,
|
||||||
|
"http2": `proto.name == "http" and proto.version == "2.0"`,
|
||||||
|
"grpc": `proto.name == "http" and proto.version == "2.0" and proto.macro == "grpc"`,
|
||||||
|
}
|
||||||
|
dissector := NewDissector()
|
||||||
|
macros := dissector.Macros()
|
||||||
|
assert.Equal(t, expectedMacros, macros)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestPing(t *testing.T) {
|
||||||
|
dissector := NewDissector()
|
||||||
|
dissector.Ping()
|
||||||
|
}
|
||||||
|
|
||||||
func TestDissect(t *testing.T) {
|
func TestDissect(t *testing.T) {
|
||||||
var testUpdateEnabled bool
|
var testUpdateEnabled bool
|
||||||
_, present := os.LookupEnv(testUpdate)
|
_, present := os.LookupEnv(testUpdate)
|
||||||
|
Reference in New Issue
Block a user