-
Notifications
You must be signed in to change notification settings - Fork 25
Prevent worker to fail on missing key and secret keys #248
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: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -3,10 +3,34 @@ use testapi; | |||||||||||||
| use utils; | ||||||||||||||
|
|
||||||||||||||
| sub run { | ||||||||||||||
| my $volumes = '-v "/root/data/factory:/data/factory" -v "/root/data/tests:/data/tests" -v "/root/openQA/container/openqa_data/data.template/conf/:/data/conf:ro"'; | ||||||||||||||
| assert_script_run("docker run -d --network testing $volumes --name openqa_worker openqa_worker"); | ||||||||||||||
| wait_for_container_log('openqa_worker', 'API key and secret are needed', 'docker'); | ||||||||||||||
| clear_root_console; | ||||||||||||||
| my $confdir = '/tmp/openqa_worker_conf'; | ||||||||||||||
| assert_script_run("mkdir -p $confdir"); | ||||||||||||||
| assert_script_run( | ||||||||||||||
| "echo \"\$(cat <<EOF | ||||||||||||||
| [openqa_webui] | ||||||||||||||
| key = 1234567890ABCDEF | ||||||||||||||
| secret = 1234567890ABCDEF | ||||||||||||||
| EOF | ||||||||||||||
| )\" > $confdir/client.conf"); | ||||||||||||||
|
Comment on lines
+9
to
+14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. os-autoinst/openQA#6767 should help so that we can set environment variables instead of needing to write config files |
||||||||||||||
|
|
||||||||||||||
| assert_script_run( | ||||||||||||||
| "echo \"\$(cat <<EOF | ||||||||||||||
| [global] | ||||||||||||||
| BACKEND = qemu | ||||||||||||||
| HOST = openqa_webui | ||||||||||||||
| WORKER_HOSTNAME = openqa_worker | ||||||||||||||
| EOF | ||||||||||||||
| )\" > $confdir/workers.ini"); | ||||||||||||||
| my $volumes = qq{-v "/root/data/factory:/data/factory" -v "/root/data/tests:/data/tests" -v "$confdir:/data/conf:ro"}; | ||||||||||||||
| assert_script_run('curl -v http://localhost/login'); | ||||||||||||||
| assert_script_run(qq{docker run -d --network testing $volumes --hostname openqa_worker --name openqa_worker openqa_worker}); | ||||||||||||||
| wait_for_container_log('openqa_worker', 'Registered and connected', 'docker'); | ||||||||||||||
| clear_root_console; | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| sub post_run_hook { | ||||||||||||||
| script_run('docker rm -f openqa_worker'); | ||||||||||||||
| script_run('docker rm -f openqa_webui'); | ||||||||||||||
| } | ||||||||||||||
|
Comment on lines
+31
to
34
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it could be. But I went with script_run because the assert is overkill here. I usually expect assert in the sense of test validation. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need to worry about performance. Please use it unless it's expected to fail. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think some comments have been mixed up here. I don't see the need for this post_run_hook. For sure the worker module shouldn't care to cleanup the webUI container There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we wanted to avoid this dependency, we would need to setup & run a web UI container within the worker test. That was discussed before. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think originally the webUI container was removed to not influence any other test modules after that which is a good approach for testing. You now wanted to change the test from a "component test" to an "integration test" so the worker module relies on the webui test module. Fine for me. I would have not cared about removing the containers in this module then because the whole test flow became an integration test and left cleanup to the whole run, i.e. not call There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @d3flex Please fix this as well
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Better just remove the complete |
||||||||||||||
|
|
||||||||||||||
| 1; | ||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.
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.
should help you to not need to put this into the config file.
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 is this MR supposed to help here? What would be the value to set
-mto? Reading https://open.qa/docs/#_fake it doesn't mention any other method to enable fake authentication. Or is something like https://github.com/os-autoinst/openQA/blob/05b96119875a37729e11d143ebbc6a402c96d50c/lib/OpenQA/Schema.pm#L39 also implemented in the auth-backend?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.
By setting the mode to "development" or "test" the fake authentication and log=debug is automatically enabled in https://github.com/os-autoinst/openQA/blob/05b96119875a37729e11d143ebbc6a402c96d50c/lib/OpenQA/Setup.pm#L270 . So instead of writing a config file one just needs to set the environment variable
OPENQA_WEBUI_MODE=testwhen starting the openQA web UI container