appengine
                                
                                 appengine copied to clipboard
                                
                                    appengine copied to clipboard
                            
                            
                            
                        aetest: appengine.ModuleName calls log.Fatalf
package foo
import (
    "testing"
    "google.golang.org/appengine"
    "google.golang.org/appengine/aetest"
)
func TestModule(t *testing.T) {
    ctx, cancel, err := aetest.NewContext()
    if err != nil {
        t.Fatal(err)
    }
    defer cancel()
    t.Log(appengine.ModuleName(ctx))
}
$ go test
INFO     2016-09-01 22:49:59,307 devappserver2.py:769] Skipping SDK update check.
WARNING  2016-09-01 22:49:59,307 devappserver2.py:785] DEFAULT_VERSION_HOSTNAME will not be set correctly with --port=0
WARNING  2016-09-01 22:49:59,341 simple_search_stub.py:1146] Could not read search indexes from /tmp/appengine.testapp.cbro/search_indexes
INFO     2016-09-01 22:49:59,342 api_server.py:205] Starting API server at: http://localhost:55749
INFO     2016-09-01 22:49:59,845 dispatcher.py:197] Starting module "default" running at: http://localhost:35850
INFO     2016-09-01 22:49:59,846 admin_server.py:116] Starting admin server at: http://localhost:48945
2016/09/01 15:49:59 Metadata fetch failed: Get http://metadata/computeMetadata/v1/instance/attributes/gae_backend_name: dial tcp: lookup metadata on 127.0.1.1:53: no such host
exit status 1
FAIL    github.com/broady/junk/moduleae 1.037s
Thanks to Lucas Natraj via Slack for the report.
What is the ask here? Having ModuleName call log.Fatal seems like it might not have been the best thing to do, but I'm not sure what we can do now that the API has been established. I guess we could panic instead?
Yeah, perhaps panic is the correct thing to do.
Actually, thinking back on it, aetest shouldn't crash here. appengine.ModuleName needs to properly handle being called from a unit test.