-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Fixed issue that prevented Postgres Tests from passing locally and on any port other than 5432 in travis #6531
Conversation
trying to stop loop
isolating postgres calls
Separating jobs
Separating builds again
Just added back version 10, just in case it gets called
Removed postgres installs from unneeded test cases. Added the ability to test Postgres 10 and 11
Added test for postgres 12 that's allowed to fail
Second round to see if it fails eventually
Round 3
Allowing all postgres to fail since it seems to occur randomly
This is ready to be reviewed. I expected the postgres time to improve a little more, but it looks like travis is currently having slower times than normal |
I updated the contributing guide for running postgres tests. The rest of the updates for how to run in docker are in pull request #6506 |
On a related note and for future reference, I think the changes here helped me find the root cause of #6374. My assumption is that when previously running tests with postgres-9, the issue didn't show because postgres-9 is pre-installed on the image and runs on port 5432. The change to postgres 11 required an add-on and two issues were created:
Looking at the raw logs of travis, when postgres installs as an add-on, it stops all postgres services and starts up the add-on version using: So if you really want to run on 5432, change the port in the add-on as before, Or, with the fix in this branch that fixes the hard coded URIs in two of the spec files, simply use the already included |
@dplewis can we merge this one too? |
This looks good to me. We could probably do the same for mongo in the future. I’ll run this locally right now then merge after |
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.
Just a quick change from me and we should be good to go!
CONTRIBUTING.md
Outdated
@@ -58,13 +58,18 @@ Once you have babel running in watch mode, you can start making changes to parse | |||
|
|||
If your pull request introduces a change that may affect the storage or retrieval of objects, you may want to make sure it plays nice with Postgres. | |||
|
|||
* Run the tests against the postgres database with `PARSE_SERVER_TEST_DB=postgres npm test`. You'll need to have postgres running on your machine and setup [appropriately](https://github.com/parse-community/parse-server/blob/master/.travis.yml#L37) or use [`Docker`](#run-a-parse-postgres-with-docker). | |||
* Run the tests against the postgres database with `PARSE_SERVER_TEST_DB=postgres PARSE_SERVER_TEST_DATABASE_URI=postgres://postgres:password@localhost:5432/parse_server_postgres_adapter_test_database npm test`. You'll need to have postgres running on your machine and setup [appropriately](https://github.com/parse-community/parse-server/blob/master/.travis.yml#L43) or use [`Docker`](#run-a-parse-postgres-with-docker). |
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.
Can you change the run test command to include npm run testonly
so that it doesn't start the mongodb-runner
PARSE_SERVER_TEST_DB=postgres PARSE_SERVER_TEST_DATABASE_URI=postgres://postgres:password@localhost:5432/parse_server_postgres_adapter_test_database npm run testonly
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.
Done
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.
@cbaker6 Can you run the testonly locally? Making sure you don't have mongo running locally? I have 6 failing tests that require mongodb
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 can try, I've always ran "npm test" because of the older versions of the docs
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.
testonly
was added because we didn't want to keep starting the mongodb-runner. It makes testing locally faster.
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.
In the future can you delete your fork, re create it and work off of branches instead of your master branch?
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.
@dplewis thanks, I didn't know this. I will try it next time
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.
Even though we squash commits. As you can see there are 60+ commits that carried over from previous PRs that you have done. A rule of thumb is to keep the master branch on your fork up to date and branch off of that before every PR.
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.
what i do is create a 'feature' branch that I put all my commits into and I periodically merge master into it.
making tons of small commits is a good practice imho (not disagreeing with dplewis, just adding my$.02).
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 have a develop branch that I use similar concept.
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.
LGTM! Thanks for the dedication to the project.
For postgres testers if you attempt to run a local test using the official Postgres (which PostGIS docker image uses), POSTGRES_PASSWORD has to be set or else the image won't build. This means that all local postgres tests using docker will require the use if PARSE_SERVER_TEST_DATABASE_URI as the default postgres URI set in the spec won't work.
Currently, two tests in the spec cause failure in this case, ParseQuery.FullTextSearch.spec.js and PostgresInitOptions.spec.js. This is because they have hardcoded URI's and locally create their own adaptors instead of using the Config (from what I've seen, tests that depend on the adapter typically use config). In the case of PostgresInitOptions.spec.js, it tests creating a new adaptor, so it makes since not to depend on config here, the problem is that it currently doesn't know about PARSE_SERVER_TEST_DATABASE_URI from the spec which lets you define your own URI for testing.
The reciprocal of this problem is running the test on travis and attempting to use the default port, 5433, that the image installs add-on versions of postgres on (standard port for postgres in general is 5432). Running travis on any port other than 5432 will cause ParseQuery.FullTextSearch.spec.js and PostgresInitOptions.spec.js to fail due to the aforementioned issues. The main branch gets around this by changing the config file for the postgres image to port 5432, but also needs to remove unnecessary postgres versions for it to run without issues.