Gikngo Tests hang during goapp tests

60 views
Skip to first unread message

shaunak...@gmail.com

unread,
May 7, 2017, 6:38:42 PM5/7/17
to google-appengine-go

I'm trying to use Gikngo to write some tests for appengine.

My setup for the tests is as follows:

suite_test.go:

BeforeSuite() {
  inst, err = aetest.NewInstance(options)
  if err != nil {
    Fail(fmt.Sprintf("%s", err))
  }
}

var(
  req *http.Request
  ctx context.Context
)
BeforeEach() {
  req = inst.NewRequest()
  ctx = appengine.NewContext(req)

  // Clean up local datastore using the context.
}

validation_test.go

Describe("Some Test", func() {
  It("ValidateFoo", func() {
    // Access ctx here
  })
  ...
  It("ValidateBar", func() {
    // Access ctx here.
  })
})

I see our tests consistently hanging with the error of the type:

Expected success, but got an error:
    <*url.Error | 0xc8210570b0>: {
        Op: "Post",
        URL: "http://localhost:59072",
        Err: {s: "EOF"},
    }
    Post http://localhost:59072: EOF

This seems to indicate that the API server has become inaccessible. However, the test output does not seem to indicate this.

What are the ways in which we can debug a goapp test?

Shaunak Godbole

unread,
May 9, 2017, 1:46:50 AM5/9/17
to google-appengine-go
I did a bit more investigating into this, and turns out that ginkgo has nothing to do with it.  Something in dev_appserver.py (Most probably the datastore, which I think is SQLite) can support only 240 operations per second.  I wrote the following piece of code:

package preorder

import (
"fmt"
"testing"

)

func TestLoad(t *testing.T) {
        opts := aetest.Options{StronglyConsistentDatastore: true}
        inst, _ := aetest.NewInstance(opts)
defer inst.Close()


for i := 0; i < 10000; i++ {
req, _ := inst.NewRequest("GET", "/", nil)
ctx := appengine.NewContext(req)

k := datastore.NewKey(ctx, MY_ENTITY_NAME, "", 12345, nil)
var entity Entity
datastore.Get(ctx, k, &entity)
fmt.Println("Iteration Count ", i+1)
ctx.Done()
}
}

This program always hangs at Iteration Count 240.  Note that this is the number of operations / fields read so if you throw in a complex query involving multiple filters, the iteration stops much sooner.  

I have no idea how to fix this problem, but having a solution for this so that when we don't have to respawn our servers before every test as they usually take 4 seconds to run.

Thanks,
Shaunak

Steven Buss

unread,
May 17, 2017, 12:57:12 PM5/17/17
to Shaunak Godbole, google-appengine-go, David Nicholson, Kai Wang
That's a pretty surprising bug. Looping in David and Kai from the dev_appserver team to see if they can help you.

--
You received this message because you are subscribed to the Google Groups "google-appengine-go" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengine-go+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Shaunak Godbole

unread,
May 17, 2017, 1:12:50 PM5/17/17
to Steven Buss, google-appengine-go, David Nicholson, Kai Wang
Thanks!  I reported this to the Google Cloud Support people and they said that someone from appengine-team has been able to reproduce this.  Hoping that this resolves quickly :-)

Shaunak

To unsubscribe from this group and stop receiving emails from it, send an email to google-appengine-go+unsubscribe...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.




--
It is not the aptitude but the attitude that decides a persons altitude
Shaunak Godbole
Reply all
Reply to author
Forward
0 new messages