Ejemplo n.º 1
0
// New returns prepares the *app.App and then
// returns a new Tester. It also disables
// logging in the App, since the Tester does
// its own logging.
func New(r Reporter, a *app.App) *Tester {
	if !flag.Parsed() {
		flag.Parse()
	}
	if *remoteHost == "" {
		if gaeLocal != nil && *gaeLocal {
			h := gaeLocalHost
			remoteHost = &h
		} else if gaeRemote != nil && *gaeRemote {
			h := internal.AppEngineAppHost()
			if h == "" {
				panic(errors.New("no application found in app.yaml - please, specify one to run remote tests"))
			}
			remoteHost = &h
		}
	}
	if *remoteHost != "" {
		r.Log(fmt.Sprintf("using host %s", *remoteHost))
	}
	if err := a.Prepare(); err != nil {
		r.Fatal(fmt.Errorf("error preparing app: %s", err))
	}
	a.Logger = nil
	return &Tester{r, a}
}
Ejemplo n.º 2
0
func init() {
	if internal.InTest() {
		remoteHost = flag.String("H", "", "Host to run the test against")
		if internal.InAppEngine() {
			gaeHost := internal.AppEngineAppHost()
			if gaeHost == "" {
				gaeHost = "not found"
			}
			gaeRemote = flag.Bool("R", false, fmt.Sprintf("Run tests against remote GAE instance (%s)", gaeHost))
			gaeLocal = flag.Bool("L", false, fmt.Sprintf("Run tests local GAE instance (%s)", gaeLocalHost))
		}
	}
}