-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
add: override PGRST_CMD for postgrest-loadtest from env #4219
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
base: main
Are you sure you want to change the base?
Conversation
The above is real nice, we can use it to improve perf. Looking at this #4220 (comment), is this PR dependent on #4220? Or how do you confirm this PR is working as expected? |
It doesn't depend on #4220, I've merely used |
echo -n "Building postgrest (cabal)... " | ||
postgrest-build | ||
PGRST_CMD=postgrest-run | ||
if [ -z "''${PGRST_CMD:-}" ]; then |
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.
How about using argbash ARG_USE_ENV
instead?
There's an example on
postgrest/nix/tools/withTools.nix
Lines 28 to 32 in cc4f920
"ARG_USE_ENV([PGUSER], [postgrest_test_authenticator], [Authenticator PG role])" | |
"ARG_USE_ENV([PGDATABASE], [postgres], [PG database name])" | |
"ARG_USE_ENV([PGRST_DB_SCHEMAS], [test], [Schema to expose])" | |
"ARG_USE_ENV([PGTZ], [utc], [Timezone to use])" | |
"ARG_USE_ENV([PGOPTIONS], [-c search_path=public,test], [PG options to use])" |
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 way we also document the command has the PGRST_CMD option when doing --help
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.
And have it documented too! Thanks for the suggestion, will do!
2959cb6
to
aba9623
Compare
nix/tools/withTools.nix
Outdated
@@ -339,6 +339,7 @@ let | |||
"ARG_POSITIONAL_SINGLE([command], [Command to run])" | |||
"ARG_LEFTOVERS([command arguments])" | |||
"ARG_OPTIONAL_SINGLE([monitor], [m], [Enable CPU and memory monitoring of the PostgREST process and output to the designated file as markdown])" | |||
"ARG_USE_ENV([PGRST_CMD], [postgrest-run], [PostgREST executable to run])" |
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.
With the default of postgrest-run
, this will change the logic heavily now. We will now have to explicitly set this to the empty string to get the default behavior from before.
Also, we can't make use of PGRST_BUILD_CABAL
anymore.
I think we should not control this via env variable at all, but instead add a --profiled
flag to postgrest-loadtest
and then use the profiled package in both variants if this is set.
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.
PGRST_CMD
env argument doesn't have a default value anymore and should be good to go now
re: separate flag> I agree this is a cleaner behavior, but it'd require to propagate the desired executable name (path) from pgrst-loadtest
to postgrest-with-pgrst
script, which I'm yet to wrap my head around of.
aba9623
to
03ebc68
Compare
Enables `PGRST_CMD=postgrest-profiled-run postgrest-loadtest` running loadtest against profiled executable, which wasn't available before
03ebc68
to
0d77a4d
Compare
Enables overriding postgrest executable with
PGRST_CMD
environment variable inpostgrest-loadtest
script. This enables, for example, running loadtest against profiled executable with simplePGRST_CMD=postgrest-profiled-run postgrest-loadtest
, which wasn't possible before, becausePGRST_CMD
was defined internally.