-
Notifications
You must be signed in to change notification settings - Fork 89
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
Add a BinariesPath configuration option, for prefetching Postgres binaries before the test #38
Conversation
@fergusstrange , just making sure that you saw this PR. Thanks. |
Sorry @mishas I totally did miss this! I've approved CI run and will review code this evening. Looks like a good change to include! |
@fergusstrange , Thanks for looking into it! I just fixed the lint warnings and the failing test from the CI, and pushed 2 fixing commit. A little bit about the failing test (
Before my change, the logic used to be:
In my change, I've split The problem is - that the To make things simple, I've fixed by moving the |
embedded_postgres_test.go
Outdated
panic(err) | ||
} | ||
|
||
// Expect everything to work without cacheLocator and/orr remoteFetch abilities. |
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.
// Expect everything to work without cacheLocator and/orr remoteFetch abilities. | |
// Expect everything to work without cacheLocator and/or remoteFetch abilities. |
@mishas changes all look sensible. One small typo but nothing major. Looks like the Alpine tests may still be failing after moving it? We'll need to get this fixed up before we can move forward. I'll look into auto running these tests on push as well, I'm not sure why they've stopped... Thanks |
I fixed the test, and ran it in my repo: https://github.com/mishas/embedded-postgres/actions/runs/1233929433 Thanks again. |
@mishas seems the Windows tests are now failing 🤦 around cleaning up after themselves.
I'm concerned we've not got he logic quite correct here if we're getting conflicting processes accessing the files. Do we need to take a slightly different approach? It's also interesting to see that the tests ran on your fork. Did you alter anything in the build? 🤔 |
@fergusstrange , this is really really strange! Furthermore, the test that is failing ( So - what is happening?
First of all - this shouldn't matter at all - you may run the same executable from two different processes. Whenever we do reuse the binaries - they're separated from the data and the runfiles, and as such can be run multiple times (can even be readonly) Is it possible it's some freakish race condition of the windows OS that's happening here? Can we try re-running the CI please? |
@fergusstrange , I was able to reproduce the same failure on master: https://github.com/mishas/embedded-postgres/pull/2/checks?check_run_id=3605422559 [Please note that the PR is not exactly empty, it has an extra space in README.md to make the CI actually trigger a new run...] |
Yeah this is very odd. I've rerun an old build https://github.com/fergusstrange/embedded-postgres/runs/3606273031?check_suite_focus=true and receiving the same failures you saw on your forked CI. Let me see if I can rewrite these tests quickly to be less flakey, then we can rebase on top of that and get this merged in. |
Okay @mishas I've dropped the removeAll which appears to have become flakey in Github Actions Windows only. This shouldn't be a problem as it's written to the OS Temp Dir anyway so would be cleaned up on reboot. https://github.com/fergusstrange/embedded-postgres/pull/39/files Try rebasing and see how that goes. |
e25af26
to
c5ec246
Compare
@fergusstrange , I can add tests to increase coverage if that's something you think is worth doing, but the missing coverage is for errors during os.MkdirAll and os.RemoveAll, which seem redundant to test. |
Great work @mishas! I've merged and will just allow a little manual testing with some of my own projects quickly. I'll cut a new release if this goes well tomorrow :) Thanks |
Thank you very much @fergusstrange , |
Release available here https://github.com/fergusstrange/embedded-postgres/releases/tag/v1.10.0 Thanks @mishas |
Downloading and Un-archiving the postgres binaries is slow and flaky in some CI systems.
For example - in my case, our CI system starts a fresh sandbox for every test it runs, and as such caching the downloaded postgres file is impossible.
Even when it is possible to cache the downloaded file, it's still might be slow due to the time it takes to unarchive it.
The change in this PR does the following:
It gives an option to specify a binaries path, where the binaries will be unarchived to, and will not get deleted between tests.
If the
BinariesPath/bin
directory exists, the system will assume files were pre-downloaded, and will not try to fetch/unarchive them.The PR is split into 4 commits:
This change should be fully backward compatible if
BinariesPath
is not specified.This also helps with #35 (@mbfr).