Skip to content

Full test environment setup

Saverio Miroddi edited this page Sep 11, 2017 · 2 revisions

See (probably) vendor/github.com/lib/pq/.travis.yml for pointers:

aptitude install apache2-utils postgres-9.5 postgresql-contrib-9.5

perl -i -pe 's/^(local.*postgres.*)peer/$1trust/' /etc/postgresql/9.5/main/pg_hba.conf
perl -i -pe 's/^(host.*127.0.0.1/32.*)md5/$1trust/' /etc/postgresql/9.5/main/pg_hba.conf

service postgresql restart

psql -c 'CREATE role test WITH LOGIN;' -U postgres
psql -c 'CREATE database goby_test;' -U postgres
psql -c 'CREATE database test;' -U postgres

Not sure how to proceed now, as make test fails without an obvious error (see also comment after):

$ make test
./test.sh
?     github.com/goby-lang/goby [no test files]
?     github.com/goby-lang/goby/compiler  [no test files]
?     github.com/goby-lang/goby/compiler/ast  [no test files]
ok    github.com/goby-lang/goby/compiler/bytecode 1.022s  coverage: 84.9% of statements
ok    github.com/goby-lang/goby/compiler/lexer  1.008s  coverage: 96.5% of statements
ok    github.com/goby-lang/goby/compiler/parser 1.022s  coverage: 73.6% of statements
ok    github.com/goby-lang/goby/compiler/token  1.004s  coverage: 100.0% of statements
?     github.com/goby-lang/goby/igb [no test files]
?     github.com/goby-lang/goby/test_fixtures/import_test/plugin  [no test files]
?     github.com/goby-lang/goby/test_fixtures/import_test/plugin/lib  [no test files]
?     github.com/goby-lang/goby/test_fixtures/import_test/struct  [no test files]
--- FAIL: TestPGConnectionPing (0.00s)
  vm_test.go:247: At test case 1: object has wrong value. expect=false, got=true
sql: database is closed
123
--- FAIL: TestHTTPObject (0.00s)
  vm_test.go:229: At test case 0: object has wrong value. expect=GET Hello World, got=
  vm_test.go:229: At test case 1: object has wrong value. expect=POST Hi Again, got=
--- FAIL: TestHTTPObjectFail (0.00s)
  error_test.go:191: At test case 0: Expect Error. got=*vm.StringObject (&{baseObj:0xc42039a040 value:})
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
  panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0xa31a75]

goroutine 1268 [running]:
testing.tRunner.func1(0xc42013c5a0)
  /usr/lib/go-1.9/src/testing/testing.go:711 +0x2d2
panic(0xb1f5e0, 0x1030b40)
  /usr/lib/go-1.9/src/runtime/panic.go:491 +0x283
github.com/goby-lang/goby/vm.checkError(0xc42013c5a0, 0x0, 0x1047f00, 0xc42039a020, 0xbaf650, 0x1c, 0xe2808a, 0x43, 0x4)
  /home/saverio/code/go/src/github.com/goby-lang/goby/vm/error_test.go:195 +0x1b5
github.com/goby-lang/goby/vm.TestHTTPObjectFail(0xc42013c5a0)
  /home/saverio/code/go/src/github.com/goby-lang/goby/vm/http_test.go:113 +0x202
testing.tRunner(0xc42013c5a0, 0xbd0508)
  /usr/lib/go-1.9/src/testing/testing.go:746 +0xd0
created by testing.(*T).Run
  /usr/lib/go-1.9/src/testing/testing.go:789 +0x2de
FAIL  github.com/goby-lang/goby/vm  0.490s
Makefile:18: recipe for target 'test' failed
make: *** [test] Error 1

The error itself is:

sql: database is closed
123

but nothing obvious is provided.

Clone this wiki locally