Skip to content

Commit

Permalink
chore(test): add test for new IPv6 address normalization for addresse…
Browse files Browse the repository at this point in the history
…s with 'IPv6:' prefix.
  • Loading branch information
d--j committed Apr 5, 2023
1 parent fff66c0 commit e3eda61
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions session_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ func Test_milterSession_Process(t *testing.T) {
check: func(t *testing.T, s *serverSession) {
p := s.backend.(*processTestMilter)
if p.family != "tcp6" {
t.Errorf("expected tcp4, got %q", p.family)
t.Errorf("expected tcp6, got %q", p.family)
}
if p.addr != "::" {
t.Errorf("expected ::, got %q", p.addr)
Expand All @@ -278,7 +278,7 @@ func Test_milterSession_Process(t *testing.T) {
check: func(t *testing.T, s *serverSession) {
p := s.backend.(*processTestMilter)
if p.family != "tcp6" {
t.Errorf("expected tcp4, got %q", p.family)
t.Errorf("expected tcp6, got %q", p.family)
}
if p.addr != "::" {
t.Errorf("expected ::, got %q", p.addr)
Expand All @@ -291,6 +291,24 @@ func Test_milterSession_Process(t *testing.T) {
}
},
}, &wire.Message{wire.CodeConn, []byte{'h', 0, '6', 9, 251, '[', ':', ':', ']', 0}}, cont, false},
{"conn tcp6 protocol 3", fields{
backend: &processTestMilter{},
check: func(t *testing.T, s *serverSession) {
p := s.backend.(*processTestMilter)
if p.family != "tcp6" {
t.Errorf("expected tcp6, got %q", p.family)
}
if p.addr != "::1" {
t.Errorf("expected ::1, got %q", p.addr)
}
if p.port != 2555 {
t.Errorf("expected 2555, got %v", p.port)
}
if p.host != "h" {
t.Errorf("expected \"h\", got %q", p.host)
}
},
}, &wire.Message{wire.CodeConn, []byte{'h', 0, '6', 9, 251, 'I', 'P', 'v', '6', ':', '0', ':', '0', ':', '0', ':', '0', ':', '0', ':', '0', ':', '0', ':', '1', 0}}, cont, false},
{"conn tcp6 protocol err", fields{
backend: &processTestMilter{},
}, &wire.Message{wire.CodeConn, []byte{'h', 0, '6', 9, 251, '[', '@', ']', 0}}, nil, true},
Expand Down

0 comments on commit e3eda61

Please sign in to comment.