Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Add test with appengine context #31

Closed
wants to merge 4 commits into from

Conversation

akm
Copy link
Contributor

@akm akm commented Aug 27, 2018

Adding an example of test with appengine context.

Prerequisite

  • Click Download and install the original App Engine SDK for Go and Select one from App Engine SDK for Go
    • In order to use goapp

Steps

  1. git clone -b add_test_with_appengine git@github.com:akm/examples.git
  2. goagen bootstrap -d github.com/goadesign/examples/appengine/design
  3. glide install
  4. goapp test github.com/goadesign/examples/appengine/controller

@akm
Copy link
Contributor Author

akm commented Aug 27, 2018

Now I got an error

$ goapp test github.com/goadesign/examples/appengine/controller
2018/08/27 18:06:24 appengine: not running under devappserver2; using some default configuration
INFO     2018-08-27 09:06:25,042 devappserver2.py:178] Skipping SDK update check.
WARNING  2018-08-27 09:06:25,042 devappserver2.py:194] DEFAULT_VERSION_HOSTNAME will not be set correctly with --port=0
WARNING  2018-08-27 09:06:25,128 simple_search_stub.py:1196] Could not read search indexes from /var/folders/70/5yxt0jys7ss_m71y5pz_l_qc0000gn/T/appengine.testapp.user1/search_indexes
INFO     2018-08-27 09:06:25,130 api_server.py:275] Starting API server at: http://localhost:52013
INFO     2018-08-27 09:06:25,136 dispatcher.py:270] Starting module "default" running at: http://localhost:52014
INFO     2018-08-27 09:06:25,138 admin_server.py:152] Starting admin server at: http://localhost:52015
2018/08/27 18:06:25 appengine: NewContext passed an unknown http.Request
INFO     2018-08-27 09:06:26,143 stub_util.py:357] Applying all pending transactions and saving the datastore
INFO     2018-08-27 09:06:26,144 stub_util.py:360] Saving search indexes
--- FAIL: TestCreateUser (2.56s)
panic: appengine: NewContext passed an unknown http.Request [recovered]
	panic: appengine: NewContext passed an unknown http.Request

goroutine 5 [running]:
testing.tRunner.func1(0xc4201b60f0)
	/Users/user1/go_appengine_sdk_darwin_amd64-1.9.67/goroot-1.9/src/testing/testing.go:711 +0x2d2
panic(0x1424b40, 0xc4202060d0)
	/Users/user1/go_appengine_sdk_darwin_amd64-1.9.67/goroot-1.9/src/runtime/panic.go:491 +0x283
log.Panic(0xc420046b98, 0x1, 0x1)
	/Users/user1/go_appengine_sdk_darwin_amd64-1.9.67/goroot-1.9/src/log/log.go:326 +0xc0
appengine_internal.NewContext(0xc4201fc200, 0x1b20046c68, 0x0)
	/Users/user1/go_appengine_sdk_darwin_amd64-1.9.67/goroot-1.9/src/appengine_internal/api_go18.go:26 +0xfa
appengine.NewContext(0xc4201fc200, 0x6000111984e, 0x20)
	/Users/user1/go_appengine_sdk_darwin_amd64-1.9.67/goroot-1.9/src/appengine/appengine.go:55 +0x2b
github.com/goadesign/examples/appengine/vendor/google.golang.org/appengine/internal.WithContext(0x1945030, 0xc420018100, 0xc4201fc200, 0x1534c00, 0x1945030)
	/Users/user1/golang.workspace/src/github.com/goadesign/examples/appengine/vendor/google.golang.org/appengine/internal/api_classic.go:57 +0x2b
github.com/goadesign/examples/appengine/vendor/google.golang.org/appengine.WithContext(0x1945030, 0xc420018100, 0xc4201fc200, 0x1945030, 0xc420018100)
	/Users/user1/golang.workspace/src/github.com/goadesign/examples/appengine/vendor/google.golang.org/appengine/appengine.go:73 +0x3f
github.com/goadesign/examples/appengine/vendor/google.golang.org/appengine.NewContext(0xc4201fc200, 0x14d5e60, 0xc420200100)
	/Users/user1/golang.workspace/src/github.com/goadesign/examples/appengine/vendor/google.golang.org/appengine/appengine.go:66 +0x67
github.com/goadesign/examples/appengine/controller.(*HelloController).Show(0xc420208020, 0xc420200100, 0xc4201fc200, 0xc42020e000)
	/Users/user1/golang.workspace/src/github.com/goadesign/examples/appengine/controller/hello.go:26 +0x36
github.com/goadesign/examples/appengine/app/test.ShowHelloOK(0x1743460, 0xc4201b60f0, 0x1747660, 0xc4201fa090, 0xc42020e000, 0x17426a0, 0xc420208020, 0xc4201fc100, 0x0, 0x0)
	/Users/user1/golang.workspace/src/github.com/goadesign/examples/appengine/app/test/hello_testing.go:142 +0x67e
github.com/goadesign/examples/appengine/controller.TestCreateUser(0xc4201b60f0)
	/Users/user1/golang.workspace/src/github.com/goadesign/examples/appengine/controller/hello_test.go:32 +0x2e3
testing.tRunner(0xc4201b60f0, 0x1500030)
	/Users/user1/go_appengine_sdk_darwin_amd64-1.9.67/goroot-1.9/src/testing/testing.go:746 +0xd0
created by testing.(*T).Run
	/Users/user1/go_appengine_sdk_darwin_amd64-1.9.67/goroot-1.9/src/testing/testing.go:789 +0x2de
FAIL	github.com/goadesign/examples/appengine/controller	2.579s

$ goagen bootstrap -d github.com/goadesign/examples/appengine/design && rm hello.go main.go
In order to get inst.NewRequest in app/test/hello_testing.go .
@akm
Copy link
Contributor Author

akm commented Aug 27, 2018

I'll create another pull request after this problem is solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant