Skip to content
Open
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
5 changes: 0 additions & 5 deletions main.pm
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,6 @@ if (check_var('SECUREDROP_INSTALL', '1')) {
autotest::loadtest("tests/whonix_firstrun.pm", name => "Setup_sys-whonix");

autotest::loadtest("tests/securedrop/install_workstation.pm");

# Setup sd-whonix connection
my $args = OpenQA::Test::RunArgs->new();
$args->{whonix_gw_override} = 'sd-whonix';
autotest::loadtest("tests/whonix_firstrun.pm", name =>"Setup_sd-whonix", run_args => $args);
} elsif (check_var('SECUREDROP_TEST', "test_dom0")) {
autotest::loadtest("tests/securedrop/test_dom0.pm");
} elsif (check_var('SECUREDROP_TEST', "test_gui")) {
Expand Down
21 changes: 12 additions & 9 deletions tests/securedrop/install_workstation.pm
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ sub install_staging {
assert_script_run('qvm-run -p work -- "rpm -Kv securedrop-workstation-dom0-config-*.rpm"'); # TODO confirm output is correct
assert_script_run('qvm-run -p work -- "cat /home/user/securedrop-workstation-dom0-config-*.rpm" > securedrop-workstation.rpm');
assert_script_run('sudo dnf -y install securedrop-workstation.rpm');

# setup staging config.json
assert_script_run('echo {\"submission_key_fpr\": \"65A1B5FF195B56353CC63DFFCC40EF1228271441\", \"hidserv\": {\"hostname\": \"bnbo6ryxq24fz27chs5fidscyqhw2hlyweelg4nmvq76tpxvofpyn4qd.onion\", \"key\": \"FDF476DUDSB5M27BIGEVIFCFGHQJ46XS3STAP7VG6Z2OWXLHWZPA\"}, \"environment\": \"staging\", \"vmsizes\": {\"sd_app\": 10, \"sd_log\": 5}} | sudo tee /usr/share/securedrop-workstation-dom0-config/config.json');
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');

};

sub install_dev {
Expand Down Expand Up @@ -63,6 +69,12 @@ sub install_dev {
assert_script_run('qvm-run -p sd-dev "cd securedrop-workstation && make build-rpm"', timeout => 1000);
assert_script_run("qvm-run --pass-io sd-dev 'cat /home/user/securedrop-workstation/rpm-build/RPMS/noarch/*.rpm' > /tmp/sdw.rpm");
assert_script_run('sudo dnf -y install /tmp/sdw.rpm', timeout => 1000);

# setup dev config.json
assert_script_run('echo {\"submission_key_fpr\": \"65A1B5FF195B56353CC63DFFCC40EF1228271441\", \"hidserv\": {\"hostname\": \"bnbo6ryxq24fz27chs5fidscyqhw2hlyweelg4nmvq76tpxvofpyn4qd.onion\", \"key\": \"FDF476DUDSB5M27BIGEVIFCFGHQJ46XS3STAP7VG6Z2OWXLHWZPA\"}, \"environment\": \"dev\", \"vmsizes\": {\"sd_app\": 10, \"sd_log\": 5}} | sudo tee /usr/share/securedrop-workstation-dom0-config/config.json');
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');

};

sub run {
Expand All @@ -71,11 +83,6 @@ sub run {
$self->select_gui_console;
assert_screen "desktop";

# Enable "presentation mode" to prevent the screen from going dark
assert_and_click('disable-screen-blanking-click-power-tray-icon');
assert_and_click('disable-screen-blanking-click-presentation-mode');
send_key('esc');

x11_start_program('xterm');
send_key('alt-f10'); # maximize xterm to ease troubleshooting

Expand All @@ -85,10 +92,6 @@ sub run {

install_dev;

assert_script_run('echo {\"submission_key_fpr\": \"65A1B5FF195B56353CC63DFFCC40EF1228271441\", \"hidserv\": {\"hostname\": \"bnbo6ryxq24fz27chs5fidscyqhw2hlyweelg4nmvq76tpxvofpyn4qd.onion\", \"key\": \"FDF476DUDSB5M27BIGEVIFCFGHQJ46XS3STAP7VG6Z2OWXLHWZPA\"}, \"environment\": \"prod\", \"vmsizes\": {\"sd_app\": 10, \"sd_log\": 5}} | sudo tee /usr/share/securedrop-workstation-dom0-config/config.json');
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('env xset -dpms; env xset s off', valid => 0, timeout => 10); # disable screen blanking during long command
assert_script_run('sdw-admin --apply | tee /tmp/sdw-admin-apply.log', timeout => 6000); # long timeout due to slow virt.
upload_logs('/tmp/sdw-admin-apply.log', failok => 1);
Expand Down
15 changes: 10 additions & 5 deletions tests/securedrop/test_dom0.pm
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ use serial_terminal qw(select_root_console);
sub run {
my ($self) = @_;

$self->select_gui_console;

x11_start_program('xterm');
send_key('alt-f10'); # maximize xterm to ease troubleshooting
$self->select_root_console;

# HACK: work around "extra-files" failing to be obtained via the usual route (via CASEDIR b64)
assert_script_run("qvm-run -p sd-dev 'curl https://raw.githubusercontent.com/QubesOS/openqa-tests-qubesos/refs/heads/main/extra-files/convert_junit.py 2>/dev/null' > /home/user/convert_junit.py");
Expand All @@ -33,9 +30,17 @@ sub run {
# Setup testing requirements and run tests
assert_script_run('rpm -q python3-pytest || sudo qubes-dom0-update -y python3-pytest', timeout => 300);
assert_script_run('rpm -q python3-pytest-cov || sudo qubes-dom0-update -y python3-pytest-cov', timeout => 300);

# Install virtual screen (xvfb) so that launcher tests can access a display, otherwise not available in a root console
# See https://github.com/freedomofpress/securedrop-workstation/issues/1411
assert_script_run('rpm -q xorg-x11-server-Xvfb || sudo qubes-dom0-update -y xorg-x11-server-Xvfb', timeout => 300);

# Set up credentials
script_run('ln -s /usr/share/securedrop-workstation-dom0-config/config.json /home/user/securedrop-workstation/config.json');
script_run('ln -s /usr/share/securedrop-workstation-dom0-config/sd-journalist.sec /home/user/securedrop-workstation/sd-journalist.sec');
script_run("env CI=true make -C $sdw_path test | tee make-test.log", timeout => 2400);

# Run tests (xvfb-run needed to simulate screen in root console)
assert_script_run("xvfb-run env CI=true make -C $sdw_path test | tee make-test.log", timeout => 2400);
Copy link
Member

Choose a reason for hiding this comment

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

Maybe it's enough to set DISPLAY=:0 instead? User session is logged in after all, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Hm, could be some more variables, like XAUTHORITY=/run/lightdm/user/xauthority. It makes Qt apps work for me when started from tty2.

I think it's worth trying to avoid xvfb-run, because two X servers may result in weird errors down the road - for example applications using dbus activation will open on the primary x server (as user's dbus session daemon has DISPLAY=:0), which may confuse some tests at some point.



curl_via_netvm; # necessary for upload_logs
Expand Down