Fix TCP constant

Signed-off-by: jolheiser <john.olheiser@gmail.com>
This commit is contained in:
jolheiser 2021-10-03 16:23:29 -05:00
parent 89efd38c10
commit 2ffb20201c
No known key found for this signature in database
GPG Key ID: B853ADA5DA7BBF7A
2 changed files with 5 additions and 6 deletions

View File

@ -37,10 +37,9 @@ type roomMap struct {
sync.Mutex
}
const (
timeToRoomDeletion = 10 * time.Minute
pingRoom = "pinglkasjdlfjsaldjf"
)
const pingRoom = "pinglkasjdlfjsaldjf"
var timeToRoomDeletion = 10 * time.Minute
// Run starts a tcp listener, run async
func Run(debugLevel, host, port, password string, banner ...string) (err error) {

View File

@ -25,13 +25,13 @@ func TestTCP(t *testing.T) {
log.SetLevel("error")
timeToRoomDeletion = 100 * time.Millisecond
go Run("debug", "localhost", "8281", "pass123", "8282")
time.Sleep(100 * time.Millisecond)
time.Sleep(timeToRoomDeletion)
err := PingServer("localhost:8281")
assert.Nil(t, err)
err = PingServer("localhost:8333")
assert.NotNil(t, err)
time.Sleep(100 * time.Millisecond)
time.Sleep(timeToRoomDeletion)
c1, banner, _, err := ConnectToTCPServer("localhost:8281", "pass123", "testRoom", 1*time.Minute)
assert.Equal(t, banner, "8282")
assert.Nil(t, err)