package server_test

import (
	"code.cloudfoundry.org/garden/client"
	"code.cloudfoundry.org/garden/client/connection"
	"code.cloudfoundry.org/garden/server"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"

	"testing"
)

func TestServer(t *testing.T) {
	RegisterFailHandler(Fail)
	RunSpecs(t, "Server Suite")
}

func listenAndServe(apiServer *server.GardenServer, network, addr string) {
	Expect(apiServer.SetupBomberman()).To(Succeed())
	go func() {
		defer GinkgoRecover()
		Expect(apiServer.ListenAndServe()).To(Succeed())
	}()

	apiClient := client.New(connection.New(network, addr))
	Eventually(apiClient.Ping).Should(Succeed())
}

package server_test

import (
	"testing"

	"code.cloudfoundry.org/garden/client"
	"code.cloudfoundry.org/garden/client/connection"
	"code.cloudfoundry.org/garden/server"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

func TestServer(t *testing.T) {
	RegisterFailHandler(Fail)
	RunSpecs(t, "Server Suite")
}

func listenAndServe(apiServer *server.GardenServer, network, addr string) {
	ExpectWithOffset(1, apiServer.SetupBomberman()).To(Succeed())
	go func() {
		defer GinkgoRecover()
		Expect(apiServer.ListenAndServe()).To(Succeed())
	}()

	apiClient := client.New(connection.New(network, addr))
	EventuallyWithOffset(1, apiClient.Ping, "2s").Should(Succeed())
}

Increase listenAndServe timeout to 2s
Increase listenAndServe timeout to 2s

We *think* that tests fails sometimes because the server isn't quite
ready.

[#154516396]

Signed-off-by: Georgi Sabev <cd7643e50243a10153b49cb72b4bdbf8b48cb045@gmail.com>
