コード例 #1
0
func init() {
	endpoints, err := mockingjay.NewFakeEndpoints([]byte(yaml))

	if err != nil {
		log.Fatal("Couldn't make endpoints for test", endpoints)
	}

	server := mockingjay.NewServer(endpoints)
	http.Handle("/", server)
	go http.ListenAndServe(":9094", nil)
}
コード例 #2
0
func TestItLaunchesServersAndIsCompatibleWithItsOwnConfig(t *testing.T) {
	endpoints, err := mockingjay.NewFakeEndpoints([]byte(yaml))

	if err != nil {
		t.Log(err)
		t.Fatal("Couldnt make endpoints from YAML")
	}

	server := mockingjay.NewServer(endpoints)
	http.Handle("/", server)
	go http.ListenAndServe(":9094", nil)

	checker := NewCompatabilityChecker()

	if !checker.CheckCompatability(endpoints, "http://localhost:9094") {
		t.Log("Endpoints were not seen as compatible and they should've been.")
		t.Fail()
	}
}