-
-
Notifications
You must be signed in to change notification settings - Fork 10
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 SecureDrop installation test #25
Conversation
tests/securedrop/install.pm
Outdated
assert_and_click("menu-vm-xterm"); | ||
|
||
|
||
assert_script_run('gpg --keyserver hkps://keys.openpgp.org --recv-key "2359 E653 8C06 13E6 5295 5E6C 188E DD3B 7B22 E6A3"'); |
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.
assert_script_run
depends on seeing serial console output - serial console from "work" VM isn't directly connected to the one of the host; for this to work you either need to run something like tail -F /var/log/xen/console/guest-work.log >> /dev/hvc0
in dom0 (we do that here), or do all that from dom0's terminal via qvm-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.
I see. Would type_string and then "ret" work as well? I'm trying not to deviate to much from the original instructions so it's easy to update.
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.
Yes, that would work, but your test wouldn't detect if any of those command fails (other than possible some later step dom0 in dom0 failing).
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.
Fair point 😔. I'll just go ahead an use qvm-run
, then.
3502fd7
to
2008e3f
Compare
Hint: add |
5c8b79c
to
3a2149a
Compare
Thanks for the tip. I had seen that in some places and was wondering about its purpose. I'll add it in the next round. |
3a2149a
to
deebce7
Compare
tests/securedrop/install.pm
Outdated
assert_script_run('curl https://raw.githubusercontent.com/freedomofpress/securedrop/d91dc67/securedrop/tests/files/test_journalist_key.sec.no_passphrase | sudo tee /usr/share/securedrop-workstation-dom0-config/sd-journalist.sec'); | ||
assert_script_run('sdw-admin --validate'); | ||
|
||
assert_script_run('xfce4-power-manager -q'); # disable screen blanking during long command |
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.
@marmarek there's a command which takes quite a while and in the meantime the screen blanks. I don't think it's xscreensaver because I think that's killed at the beginning of the test. Then I tried to disable XFCE's power management, but didn't help.
Have you encountered this before?
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.
My notes have this line:
x11_start_program('env xset s off', valid => 0);
but I'm not sure if that was enough either.
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.
Thanks! I had to combine it with env xset -dpms
for this to fully work.
And FYI I noticed that just with env xset s off
it still blanked for a lot of the slow command (sdw-admin --apply
), but oddly enough the screen showed up just the logs upload command (video). No idea what went on there.
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.
It unblanked on the key press.
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.
Oh! I totally forgot that it was literally typing each letter. That's why, 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.
I recall that the above options were still not working perfectly (the screeen was still bllanking at some point). What seems to have solved it is enabling presentation mode. I haven't look at what it's doing under the hood. But it seems to work. And because the setting is persistent, I think it shouldn't need anymore all the xscreensaver exits.
Anyway:
So, longer timeout? This is running virtualized, so runs slower than native. And also, I recommend collecting and uploading logs. For example wrap it with |
bf7f90e
to
fb294a2
Compare
Fair point. I have added some timeout. Now I am running into another issue. I have created a needle through the web interface added for this step an |
Have you restarted the test after adding the needle? Or did you added it via developer mode? |
I thought I had restarted it afterwards. But will try again. It for sure wasn't via developer mode. Let's see if it now finds the needle. |
I see the issue: you haven't added the |
OK. Makes sense. I was afraid to create new tags. Where can I edit the needle? Or should I create a new one? |
For this one I just edited it manually. |
fb294a2
to
ff78699
Compare
ce75b93
to
502e47b
Compare
tests/securedrop/upload_packages.pm
Outdated
next unless /Template/; | ||
s/\|.*//; | ||
$fname = $self->save_and_upload_log("qvm-run --no-gui -ap $_ 'rpm -qa; dpkg -l; pacman -Q; true'", | ||
"template-$_-packages.txt", ('timeout' => 90, 'failok' => 1)); |
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'm not a perl expert by any means, but in other places I see a syntax like this:
"template-$_-packages.txt", ('timeout' => 90, 'failok' => 1)); | |
"template-$_-packages.txt", timeout => 90, failok => 1); |
So, without extra quotes or parenthesis.
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.
Thanks! I'll try this tomorrow. If you look on the other save_and_upload_log
calls (the ones which have the timeout), it does call with {timeout => 90}
. The thing here is that save_and_upload_log
does not have explicit parameters like timeout
and failok
but instead a kind of "python dict". I'm really tempted to just converting the function to have explicit args just to make things easier and then I think will work as you suggest.
64e7e92
to
bd03839
Compare
Upload failed after all... |
Make it reusable, deduplicate the code (it's already in two places). While at it, add support for failok argument and log info if it actually failed to upload.
Diff at openqa webui doesn't show context at all. While it's possible to guess from where a given package is based in the version format, lets make it easier by making it explicit.
Ok, I think I got it working: #27, feel free to merge/rebase/whatever |
bd03839
to
2b22546
Compare
2b22546
to
ef7fbce
Compare
FYI now that the install job worked, you can click restart on just the second job and not wait for re-install (assuming that install was okay and you don't want to change something at that stage). |
The failing assert_screen x11 is part of switching back to the graphical console - it expects no windows open... If SD client autostart is expected, then I suggest making a needle with |
Thanks! I've been waiting for quite a bit now for the main test to actually pass, so that I can iterate on the second test. That's why it's also failing. I think it's worth dealing with the X11 needle situation in a separate PR, since the most important part is to get this first test across the finish line. As the order of operations, I would suggest the following:
Whatever is left to polish can be done in a subsequent PR as you suggested |
you already did ;) As for merging this PR, I'd prefer it to be green (even if the second job - the actual test - is more or less empty). For example I see the SECUREDROP_TEST variable was set to wrong value (I fixed it in settings now). If I'm correct about the X11 needle situation, it's just a matter of adding it via needle editor. |
That was it - it's now passing. I added the So I'd say this is ready for merging. |
I was assuming the |
@deeplow unrelated to this PR, but still about openqa tests:
Is it something you know about, or maybe need help with? This part is normally quite reliable... |
Thanks for the prompt response, as always. I ended up not having time yesterday, but I was focusing more on first getting the dependent test right. But this issue is something we may need help with if it happens to be too unreliable and we can't figure it out. But I'll let you know. FYI we also had If any case, I'll let you know if one of these issues is adding too much unreliability. Unless you think it's unwise to take a look at these failures later, of course. Thanks again. |
@deeplow I see you are hitting hard job timeout. Not sure why (it seems that install simply takes that long now? I guess Tor is having bad days...), but you can increase the timeout by setting MAX_JOB_TIME (in seconds). |
Thanks! Just started a new one with a longer timeout. I'm going to eventually have to parallelize at least the server installation part. Otherwise it just takes too long. |
FYI the fedora-41 update issue you've hit recently is QubesOS/qubes-issues#9744, it's fixed now. |
Thank you. |
First attempt at adding a test for SecureDrop.