Skip to content
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 development service convenience runner "openqa-run" #5796

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions docs/Contributing.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,17 @@ assets can need a big amount of disk space.

WARNING: Be sure to *clear* that variable when running unit tests locally.

For convenience you can use the `openqa-run` wrapper in to call openQA
services with `OPENQA_BASEDIR` set to your local development environment with
the appropriate service account. For example to start the openQA GRU service
Comment on lines +297 to +298
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disagree. The service account this script chooses is not appropriate for local development. I recommend not to mix the production/packaged setup with the development environment.

This description also makes it not clear at all to what OPENQA_BASEDIR is actually set (because "your local development environment" is not clear in this context, apparently it means test files from the current working dir but also only if OPENQA_BASEDIR is not set anyway).

call:

[source,sh]
----
tools/openqa-run script/openqa-gru
----


=== Customize configuration directory
It can be necessary during development to change the configuration.
For example you have to edit `etc/openqa/database.ini` to use another database.
Expand Down
39 changes: 39 additions & 0 deletions tools/openqa-run
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash
set -euo pipefail

usage() {
cat << EOF
Usage: openqa-run [OPTIONS...] OPENQA_SERVICE
Call an openQA service OPENQA_SERVICE with appropriate user account and the
base-dir set to the local working copy.

Example:
openqa-run openqa-webui-daemon
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This kind of usage is very annoying without auto completion. In my helper is worked around this via shortcuts.

The script doesn't seem to ensure that e.g. openqa-webui-daemon is actually in the PATH so I guess this example also won't lead to a great out-of-the-box experience even if copied verbatimly. (The example you added to the docs does make sense, though.)


Options:
-h, --help display this help
EOF
exit "$1"
}

OPENQA_BASEDIR="${OPENQA_BASEDIR:-"$(dirname "$0")/../t/data"}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure whether that's the best idea. I get the idea of reusing test fixtures. However, it is also a bit problematic as this might lead to accidental cluttering and changes in that directory. This might be annoying because those changes might show up in Git (and we cannot just ignore them because files in that directory are supposed to be under version control) and might also lead to failures when running unit tests (which might not be obvious to debug).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could create a temporary directory and use that.

export OPENQA_BASEDIR

opts=$(getopt -o h --long help -n "$0" -- "$@") || usage 1
eval set -- "$opts"
while true; do
case "$1" in
-h | --help) usage 0 ;;
--)
shift
break
;;
*) break ;;
esac
done

main() {
"$@"
}

caller 0 > /dev/null || main "$@"
Loading