-
-
Notifications
You must be signed in to change notification settings - Fork 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
Migrate io-tests from bash to pytest #1682
Conversation
Ah, the first test is already so much nicer compared to the bash script. You might want to consider using pathlib. Specifically the following could make stuff even easier to read: |
Yes, will be useful to handle the config files! I will also properly use pytest fixtures, avoiding the iteration in the config test function https://docs.pytest.org/en/stable/fixture.html#parametrizing-fixtures |
I'll add more tests from the original bash file as I can, but probably not before next weekend - so marking as ready to review, please feel free to merge if you want to build on top of this scaffolding. When all tests are migrated, the can remove the old bash file. |
CI currently shows the tests as:
Can we get an output with each test-case listed here as well? That would be more green :D
Looks very good so far. I don't think we need to hurry, but can merge this in one go when it's done. I have added another config io test to the bash script locally already - but that's written for now, so we can rewrite it when we're there. |
Being able to filter the tests is going to be a great usability improvement I think - e.g. |
All tests covered! Now to clean it up, refactor and add some docs |
Travis is acting up again, but we shouldn't have impacted anything that concerns it. Ready for review/merge :-) |
Actually, we did. Travis runs the code-coverage currently and that includes the io-tests. They fail with:
You could have a look at that and see how hard it would be to install those python deps there to be able to run them - or not. I wanted to move the code coverage to a nix tool and to circleci anyway, so that might be the time to do it... |
Nice shot. I never make those on the first try. Nor the 2nd. :D So I went through everything twice. Once just looking at the python stuff, once comparing the old io tests to the new ones. Everything is correct, only nit-picks and small improvements suggested. Great job, Remo! |
I'm super surprised myself! :D 😎 Thank you for the great comments! Will add a few fixes |
Co-authored-by: Wolfgang Walther <wolfgangwalther@users.noreply.github.com>
Co-authored-by: Wolfgang Walther <wolfgangwalther@users.noreply.github.com>
Not sure if you already noticed: The reload tests fail kind of randomly. One test here, one test there. Maybe we need a sleep after the send_signal or something? |
Yes, just noticed also - seems like we are going too fast. I added short sleeps in the affected tests |
Hmm. We still have an issue with the code coverage though. It's showing only 75%. Compare those two reports:
This PR is missing all the files that are collected by running the IO tests. So it seems like the python IO test script is not launching the instrumented executable? |
Hm. Could be some stack issue as well. In the travis coverage job there is a huge debug output from stack - no idea what it means. Later it also shows this:
This script is brittle - part of the reason why I want to switch to a different setup with nix etc. The first command fails. I would assume it's because the test/io-tests/postgrest.tix file is not there. The simple reason could be that it's just in some other location now. The The file is probably just in the repo root now. |
It should also be using the postgrest executable on the path... It might have been an issue with passing the flags, let's see if this works |
I think this should do it:
to
|
Yes, had the same thought! ...aand we're back randomly poking at travis again :D |
I'm glad about that. So much fun. Some things don't change. |
That worked. Even though the coverage is not shown now.. but that is a different bug. It's happening in other PRs as well, I just realized. Basically coverage is disabled right now... At least this PR doesn't report a lower number, now. Just none at all, like the others :D Fine for now. |
@monacoremo @wolfgangwalther Great work here guys! Liking the new python test suite. One thing though. When running
I also get a large stack trace, which I've pasted here: https://pastebin.com/bCqTbvbx Could that be improved to make the test runs more deterministic? |
If I remember correctly, that would be the |
As discussed in #1676 (comment), the io-tests are pushing bash to its limits and migrating to a python setup might be much more maintainable
Tests to migrate (Edit: updated from master)
For later PRs:
postgrest-watch postgrest-test-io -k ...
etc.)