Skip to content

Commit 06c7e8f

Browse files
committed
Add TestNilAddressGenerator
Relates to #92
1 parent 6ceeff4 commit 06c7e8f

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

server_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1604,6 +1604,18 @@ func TestRelayAddressGeneratorPortRange(t *testing.T) {
16041604
})
16051605
}
16061606

1607+
func TestNilAddressGenerator(t *testing.T) {
1608+
generator := &nilAddressGenerator{}
1609+
1610+
assert.ErrorIs(t, generator.Validate(), errRelayAddressGeneratorNil)
1611+
1612+
_, _, err := generator.AllocatePacketConn("", 0)
1613+
assert.ErrorIs(t, err, errRelayAddressGeneratorNil)
1614+
1615+
_, _, err = generator.AllocateConn("", 0)
1616+
assert.ErrorIs(t, err, errRelayAddressGeneratorNil)
1617+
}
1618+
16071619
func RunBenchmarkServer(b *testing.B, clientNum int) { //nolint:cyclop
16081620
b.Helper()
16091621

0 commit comments

Comments
 (0)