Skip to content

Commit

Permalink
Fix rabbitmq and rails test for both TW and Leap (rails < v5) (#1964)
Browse files Browse the repository at this point in the history
* Fix rabbitmq test 'wait_serial' regex

Local verification run: http://lord.arch/tests/5145

* Fix rails test for both TW and Leap (rails < v5)

Local verification runs:
* Leap 42.2: http://lord.arch/tests/5145
* Tumbleweed: http://lord.arch/tests/5294
  • Loading branch information
okurz authored and coolo committed Oct 14, 2016
1 parent b6093fb commit d7289c9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion tests/console/rabbitmq.pm
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ python send.py
wget https://raw.githubusercontent.com/rabbitmq/rabbitmq-tutorials/master/python/receive.py
EOF
assert_script_run($_) foreach (split /\n/, $cmd);
validate_script_output 'timeout 1 python receive.py', sub { m/[x] Received 'Hello World!'/ };
type_string("timeout 1 python receive.py > /dev/$serialdev\n");
wait_serial(".*Received.*Hello World.*");
assert_script_sudo('systemctl stop rabbitmq-server');
}

Expand Down
11 changes: 6 additions & 5 deletions tests/console/rails.pm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# notice and this notice are preserved. This file is offered as-is,
# without any warranty.

# Summary: Rails 5.0 test - just installing and starting server
# Summary: Rails test - just installing and starting server
# Maintainer: Oliver Kurz <okurz@suse.de>

use strict;
Expand All @@ -16,15 +16,16 @@ use testapi;

sub run() {
select_console 'root-console';
# something like `test -f tmp/pids/server.pid; pumactl -P tmp/pids/server.pid stop; !test -f tmp/pids/server.pid`
# is the correct test procedure on rails >= 5, for earlier versions we
# need to handle this on our own
my $cmd = <<'EOF';
zypper -n in -C "rubygem(rails)"
rails new -B mycoolapp
cd mycoolapp
(rails server &)
for i in {1..100} ; do sleep 0.1; curl -s http://localhost:3000 | grep "<title>Ruby on Rails</title>" && break ; done
test -f tmp/pids/server.pid
pumactl -P tmp/pids/server.pid stop
!test -f tmp/pids/server.pid
for i in {1..100} ; do sleep 0.1; curl -s http://localhost:3000 | grep "<title>Ruby on Rails" && break ; done
pkill -f "rails server" || pumactl -P tmp/pids/server.pid stop
EOF
assert_script_run($_) foreach (split /\n/, $cmd);
}
Expand Down

0 comments on commit d7289c9

Please sign in to comment.