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
nixos/tests: fix pgjwt test #29927
nixos/tests: fix pgjwt test #29927
Conversation
nixos/tests/pgjwt.nix
Outdated
select * from verify('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ', 'secret'); | ||
''; | ||
test = (pkgs.fetchurl { | ||
url = https://raw.githubusercontent.com/michelp/pgjwt/master/test.sql; |
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.
Refering to a specific commit seems more robust
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 updated it @joachifm. It now uses the same revision pgjwt
has, so that the test- and package versions should always be compatible. I also added a comment to the pgjwt/default.nix
to update the hash in the test file with each revision change.
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 take it that the test file comes from the same source as the package itself. In that case you can exploit the fact that fetchFromGitHub
is based on fetchzip
which produces an unpacked source archive, allowing you to refer to test file as ${pgjwt.src}/test.sql
. A more generic solution is to include test.sql in the package output and refer to it that way (e.g., ${pgjwt}/share/pgjwt/test.sql
) or even as a separate output if it is very large.
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
3477e57
to
e4ea265
Compare
- updated to the latest revision - fixed version format as there are no releases yet
- update and refactor a bit
e4ea265
to
4776bea
Compare
- now using the test contained in the pgjwt source repo - also compatible with the new `superUser` option of the `postgresql` service
4776bea
to
7d09fc6
Compare
cc @spinus |
Thank you |
@WilliButz thank you! great stuff. |
Typo in hash broke evaluation; fixed in 583b8c1. |
Background: some older nix versions disregarded the few extra bits at the beginning, but newer versions throw an error. |
I'm on Nix 1.11.15, I wonder how it did not throw an error for me during evaluation %) |
Aha, 1.11.x doesn't have this :-/ See NixOS/nix#1121 |
Ah alright, good to know that 👍 |
The fork-off between master and 1.11.x was in January 2016 – I keep forgetting that. |
Things done
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)