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

Error running test #1761

Open
edwinyoyada opened this issue Sep 24, 2018 · 1 comment

Comments

@edwinyoyada
Copy link

commented Sep 24, 2018

Hi, I got this issue when running test with no database:

buffalo test
created database xendit_ovo_connector_test
schema is empty for xendit_ovo_connector_test, skipping
INFO[0000] go test -p 1 -tags development github.com/xendit/xendit-ovo-connector github.com/xendit/xendit-ovo-connector/actions github.com/xendit/xendit-ovo-connector/grifts github.com/xendit/xendit-ovo-connector/models github.com/xendit/xendit-ovo-connector/utils 
?       github.com/xendit/xendit-ovo-connector  [no test files]
[POP] 2018/09/24 16:28:48 info - Loading config file from /home/edyo/Documents/workspace/go/src/github.com/xendit/xendit-ovo-connector/database.yml
Warning: Log is deprecated, and will be removed in a future version. Please use SetLogger instead.
2018/09/24 16:28:48 pq: relation "users_merchants" does not exist
level=info msg=/merchants content_type=application/json db="0s" duration="5.166354ms" human_size="0 B" method=POST path=/merchants request_id=BxrMtnjKrH-KJsbSxsByO size="0" status="0"
level=error msg="pq: relation \"users_merchants\" does not exist" content_type=application/json db="0s" duration="5.166354ms" human_size="0 B" method=POST path=/merchants request_id=BxrMtnjKrH-KJsbSxsByO size="0" status="0"
--- FAIL: Test_ActionSuite (0.02s)
    --- FAIL: Test_ActionSuite/Test_Merchant_Create (0.02s)
        require.go:157: 
                        Error Trace:    merchant_test.go:10
                        Error:          Not equal: 
                                        expected: 201
                                        actual  : 500
                        Test:           Test_ActionSuite/Test_Merchant_Create
FAIL
FAIL    github.com/xendit/xendit-ovo-connector/actions  0.062s
?       github.com/xendit/xendit-ovo-connector/grifts   [no test files]
ok      github.com/xendit/xendit-ovo-connector/models   (cached)
ok      github.com/xendit/xendit-ovo-connector/utils    (cached) [no tests to run]
Usage:
  buffalo test [flags]

Flags:
  -m, --force-migrations   skips loading the schema and instead runs migrations before running tests
  -h, --help               help for test

ERRO[0001] Error: exit status 1

but if i migrate the database first, i will get this error:

buffalo test
Usage:
  buffalo test [flags]

Flags:
  -m, --force-migrations   skips loading the schema and instead runs migrations before running tests
  -h, --help               help for test

ERRO[0005] Error: error creating PostgreSQL database xendit_ovo_connector_test: pq: database "xendit_ovo_connector_test" already exists

i'm currently using:

go version go1.10.3 linux/amd64

and buffalo:

INFO[0000] Buffalo version is: v0.12.6

please help.. Thanks!!

@stanislas-m stanislas-m transferred this issue from gobuffalo/docs Aug 10, 2019

@markbates

This comment has been minimized.

Copy link
Member

commented Aug 15, 2019

pq: relation \"users_merchants\" does not exist

Have you run buffalo db migrate? You don't say what commands you've used. You said that "but if i migrate the database first, i will get this error:" that implies you ran the command, but the error you pasted implies that you ran buffalo db create.

Can you please clarify the issue for others to help you, or try running buffalo db migrate first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.