Esempio n. 1
0
	"os"
	"os/exec"
	"path/filepath"
	"strconv"
	"strings"
	"testing"
	"time"
)

var (
	hoverflyAdminUrl string
	hoverflyProxyUrl string

	hoverflyCmd *exec.Cmd

	adminPort         = freeport.GetPort()
	adminPortAsString = strconv.Itoa(adminPort)

	proxyPort         = freeport.GetPort()
	proxyPortAsString = strconv.Itoa(proxyPort)
)

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

var _ = BeforeSuite(func() {
	hoverflyAdminUrl = fmt.Sprintf("http://localhost:%v", adminPort)
	hoverflyProxyUrl = fmt.Sprintf("http://localhost:%v", proxyPort)
Esempio n. 2
0
	"fmt"
	"github.com/dghubble/sling"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	"github.com/phayes/freeport"
	"io/ioutil"
	"os"
	"os/exec"
	"path/filepath"
	"strconv"
	"strings"
)

var _ = Describe("When I use hoverctl", func() {
	var (
		adminPort = strconv.Itoa(freeport.GetPort())
		proxyPort = strconv.Itoa(freeport.GetPort())
	)

	BeforeEach(func() {
		WriteConfiguration("localhost", adminPort, proxyPort)
	})

	AfterEach(func() {
		exec.Command(hoverctlBinary, "stop", "--admin-port="+adminPort, "--proxy-port="+proxyPort).Output()
	})

	Context("I can get the logs using the log command", func() {

		It("should return the logs", func() {
			exec.Command(hoverctlBinary, "start", "--admin-port="+adminPort, "--proxy-port="+proxyPort).Output()
Esempio n. 3
0
func main() {
	fmt.Println(strconv.Itoa(freeport.GetPort()))
}
Esempio n. 4
0
func Create(dataDir string) Connection {
	tc := Connection{ControlPort: freeport.GetPort(), Port: freeport.GetPort()}
	Spawn(dataDir, tc)
	return tc
}