mirror of
https://github.com/giongto35/cloud-game.git
synced 2026-07-22 17:47:11 +00:00
Assert
This commit is contained in:
parent
ca9133b47a
commit
1c1f9be66f
1 changed files with 19 additions and 2 deletions
21
main_test.go
21
main_test.go
|
|
@ -90,6 +90,8 @@ func initClient(t *testing.T, host string) {
|
|||
|
||||
time.Sleep(time.Second * 3)
|
||||
fmt.Println("Sending start...")
|
||||
|
||||
roomID := make(chan string)
|
||||
client.send(WSPacket{
|
||||
ID: "start",
|
||||
Data: "Contra.nes",
|
||||
|
|
@ -98,12 +100,27 @@ func initClient(t *testing.T, host string) {
|
|||
}, func(resp WSPacket) {
|
||||
fmt.Println("Received response")
|
||||
fmt.Println("RoomID:", resp.RoomID)
|
||||
roomID <- resp.RoomID
|
||||
})
|
||||
|
||||
time.Sleep(time.Hour)
|
||||
respRoomID := <-roomID
|
||||
if respRoomID == "" {
|
||||
fmt.Println("RoomID should not be empty")
|
||||
t.Fail()
|
||||
}
|
||||
fmt.Println("Done")
|
||||
// If receive roomID, the server is running correctly
|
||||
}
|
||||
|
||||
func TestMain(t *testing.T) {
|
||||
//func TestSingleServerNoOverlord(t *testing.T) {
|
||||
//// Init slave server
|
||||
//s := initServer(t, "")
|
||||
//defer s.Close()
|
||||
|
||||
//initClient(t, s.URL)
|
||||
//}
|
||||
|
||||
func TestSingleServerOneOverlord(t *testing.T) {
|
||||
o := initOverlord()
|
||||
defer o.Close()
|
||||
// Init slave server
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue