-
Notifications
You must be signed in to change notification settings - Fork 2.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
fixes #1833 on postgres #2017
fixes #1833 on postgres #2017
Conversation
You can see that:
|
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.
Great work! I left some initial comments... Even that I hate to take docker in here I must admit that I cannot thing any better way either to test this one.
Also this test could be added also to mysql it would be awesome.
About the current status of the code I would be more confident about this if we would know the root cause why knex.destroy hangs some times and why test doesn't fail some times even without the change. Maybe printing out data from pool's internal state could help to figure that out?
var image = _.get(options, 'image', 'postgres:9.6'); | ||
var username = _.get(options, 'username', 'postgres'); | ||
var password = _.get(options, 'password', ''); | ||
var hostPort = _.get(options, 'hostPort', 5432); |
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.
This will collide with other postgresql servers.
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.
You think the test should run for every postgres version?
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.
No. I mean that usually CI machine (and pretty much every developers machine) is already running the default postgres server in that port. So if you are trying to use the same port for postgres which is ran in docker, starting the server should fail.
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.
Oh, OK. 5432
was just the default value. The docker container was actually running on hostPort: 49152
. You can this configuration now on knexfile.js
.
test/integration/reconnect/docker.js
Outdated
const $Docker = require('dockerode'); | ||
|
||
function Docker() { | ||
this.dockerAPI = new $Docker({ socketPath: '/var/run/docker.sock' }); |
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.
This isn't probably windows compatible. Is there way to use some other communication method that is not unix domain socket?
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.
Yeap, you're right
test/knexfile.js
Outdated
@@ -6,7 +6,7 @@ var _ = require('lodash'); | |||
var Promise = require('bluebird'); | |||
|
|||
// excluding oracle and mssql dialects from default integrations test | |||
var testIntegrationDialects = (process.env.DB || "maria mysql mysql2 postgres sqlite3").match(/\w+/g); | |||
var testIntegrationDialects = (process.env.DB || "postgres" || "maria mysql mysql2 postgres sqlite3").match(/\w+/g); |
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.
Why is this here? locally you can use DB env variable to select which bds are tested. IIRC they are set in .travis configuration for knex CI.
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.
Gone
test/integration/suite.js
Outdated
@@ -14,6 +14,7 @@ module.exports = function(knex) { | |||
return knex.destroy() | |||
}) | |||
|
|||
require('./reconnect')(knex) |
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.
should probably not use the same connection setup that is used for other integration tests, because of many reasons (one is that server must be in different port e.g. 15432). If there is a way to check that is docer host or something is available and only in that case require this test and make it completely separated (it can contain its own connection settings inside the test case)
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.
Gone
@elhigu I made corrections:
Please check and read the code, I don't have much more time to work on this, I'm busy with a load of stuff. |
2830a55
to
93436f6
Compare
@smulesoft thanks, I'll check this out when I get some spare time (I have to test this stuff out on windows too). |
|
1a3ef17
to
9436c8f
Compare
@elhigu Regarding why sometimes the When this happens, you can see in the logs there is an error on calling
Or
|
9436c8f
to
a71bccf
Compare
@elhigu Can we speed this up? Or, at least, can we merge the solution w/o the tests? |
@smulesoft I'm a bit reluctant to take anything in without tests, because if tests are not part of the same pull request it effectively means that those test will never be added. What could be done to make these tests work? |
467fb31
to
6b270d9
Compare
@elhigu Tests are passing! You can check again this PR and let me know what you think |
1 similar comment
@elhigu Tests are passing! You can check again this PR and let me know what you think |
@smulesoft thanks for updates, it seems to be almost working. There are still couple of strange problems: Arrow functions doesn't work on old node: Weird syntax error: Any idea why these happen? node 6 and 7 tests seems to work correctly though 👍 |
@elhigu there! |
@smulesoft still template strings are failing on 0.12 Unexpected token = with node 4 & 5 Node 6 & 7 works |
7f844c0
to
63b2952
Compare
@elhigu I can't find the error man |
d1d5e33
to
d28e9ca
Compare
test/docker/reconnect.js
Outdated
}); | ||
} | ||
|
||
function waitReadyForQueries(attempt = 0) { |
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.
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.
Arghh thanks man!
Any reason why you don't transpile test sources?
package.json
Outdated
@@ -72,9 +73,11 @@ | |||
"lint": "eslint src/**", | |||
"plaintest": "mocha --check-leaks -b -R spec test/index.js && npm run tape", | |||
"prepublish": "npm run babel", | |||
"docker_test": "bash ./scripts/docker-for-test.js", |
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.
I just noticed that this shell script is actually .js, should be .sh I'll try this thing on windows and check if it works correctly
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.
Oops, my bad
3098b86
to
c7e9148
Compare
@elhigu How can I fix all the syntax errors with a local command? |
@smulesoft you should see all the errors if you install node 0.12 with (pretty easy with nvm / docker) and running tests with it. Now there was destructuring used here |
@elhigu 🎉 |
Great and looks good. I'll still need to run this on windows to make sure we are not breaking test runner there. |
I just did run this on windows with git bash and cmd, both were failing due to some unix specific stuff like /dev/null file doesnt exist. I'll try to fix windows compatibility soonish (I'm changing house during next weeks so it might take a while). |
@elhigu Alright, good luck with everything! I'll keep an eye on this for more news |
Can't wait to see this merged - I've been tracking issue #1833 for a while and I thought you guys had given up. I've only just now found the cutting edge - good luck! |
233bad9
to
0aa5405
Compare
I just fixed the windows compatibility problem and rebased to get one failing tests to start working... hope that travis still approves this. |
Done, thanks @smulesoft for this! |
No, no, thank you my man! Cheers |
You guys are awesome 👍 |
@elhigu When do you think you are having your next release? |
@smulesoft thank you for this fix! knex now behaves more or less how I'd expect! 🥇 would be great to see this released asap |
Sorry for being unresponsive. Still really busy with changing apartments (and doing some upgrade to old one). I cannot promise that I'm able to release this month. |
@elhigu any update on when we could expect a release? |
@davidgwking I still don't want to make any promises that I might not be able to keep... my busyness is slowing down bit by bit though. |
Awesome @smulesoft alias Coco!! |
end
on the connection