-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
test: add acceptance-level tests for repository.execute()
#6046
Conversation
Please investigate CI failures. |
MongoDB tests are waiting for loopbackio/loopback-datasource-juggler#1857, sorry for not mentioning this in the PR description. I was not expecting PostgreSQL failure, I'll investigate.
|
77830dd
to
b062088
Compare
I am not able to identify why is the new PostgreSQL test failing. It passes when I execute it on its own, but fails on connection timeout when executed after the shared repository-test suite. I suspect there is a bug in the way how we deal with datasource initialization/cleanup and/or in PostgreSQL's pooling implementation. There were several issues reported in the past months where the connection process never finished (i.e. what we are observing too), they were fixed in multiple 8.x versions. Maybe there is another bug lurking somewhere. I am proposing to skip the failing test for now and investigate the problem more either as part of #3342 or in a follow-up issue. |
b062088
to
e461787
Compare
Before this change, when running tests locally, the environment was configured to use the database names `testdb` and `testdb_new`. However, the setup SQL script is creating `repository_tests` and `repository_tests_new` databases instead. As a result, the test accessing `*_new` database was failing. This commit fixes `setup.sh` script to export `POSTGRESQL_DATABASE` environment variable to tell the test suite to use the desired database. Signed-off-by: Miroslav Bajtoš <[email protected]>
Signed-off-by: Miroslav Bajtoš <[email protected]>
Signed-off-by: Miroslav Bajtoš <[email protected]>
e461787
to
796c027
Compare
The PR is ready for final review & landing, PTAL. @raymondfeng @hacksparrow @jannyHou @agnes512 |
describe('PostgreSQL repository.execute()', () => { | ||
// FIXME(bajtos) This test passes when executed in isolation, but fails | ||
// on connection timeout when executed after repository-test suite. | ||
it.skip('executes a parameterized native SQL query', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm interesting. It is indicative of some sort of bug somewhere (maybe a shared global state somehere?). I think we should resolve this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I agree this needs to be fixed. See #6046 (comment)
I am proposing to skip the failing test for now and investigate the problem more either as part of #3342 or in a follow-up issue.
My primary motivation in this pull request is to ensure MongoDB commands can be executed. I don't want to keep this pull request open for too long, to avoid merge conflicts.
I am going to investigate the failing test as part of #3342, I added a sub-task to the TODO list.
What about support for other databases? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
That's a valid concern. We don't have acceptance-level tests for other databases yet, adding such test suite is out of scope of this work 🤷♂️ |
See #3342
WAITING FOR loopbackio/loopback-datasource-juggler#1857Checklist
👉 Read and sign the CLA (Contributor License Agreement) 👈
npm test
passes on your machinepackages/cli
were updatedexamples/*
were updated👉 Check out how to submit a PR 👈