I'm trying to write a simple integration test that spins up a dev appengine server and an HTTP Client that queries the spun up server. Here is the code snippet:
inst, err := aetest.NewInstance(nil)
check(err)
defer inst.Close()
var req http.Request
req, err = inst.NewRequest("GET", "/my/endpoint", nil)
check(err)
ctx := appengine.NewContex(req)
client := urlfetch.Client(ctx)
_, err = client.Do(req)
check(err)
This code snippet returns an error on the line client.Do. From what I've debugged, this is because the request's URL only contains "/my/endpoint" and not the entire localhost:port information. In this particular case I cannot use the hardcoded port 8080 because the aetest framework starts the test on the first ununsed port it can find.
Is there a way to programmatically determine the host:port information of the appengine server that was started by aetest framework?