Skip to content

Commit

Permalink
[dist] made system tests fedora ready
Browse files Browse the repository at this point in the history
  • Loading branch information
M0ses authored and eduardoj committed Feb 16, 2022
1 parent a31d0b5 commit 9d61ab1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
24 changes: 23 additions & 1 deletion dist/t/0060-check_required_services.ts
Expand Up @@ -8,7 +8,16 @@ my $tests = 14;
my $max_wait = 300;

my @daemons = qw/obsdispatcher.service obspublisher.service obsrepserver.service
obsscheduler.service obssrcserver.service apache2.service mysql.service/;
obsscheduler.service obssrcserver.service /;

my $os = get_distribution();
if ($os eq "suse") {
push @daemons, "apache2.service", "mysql.service";
} elsif ($os eq 'rh') {
push @daemons, "httpd.service", "mariadb.service";
} else {
die "Could not determine distribution!\n";
}

my $version = `rpm -q --queryformat %{Version} obs-server`;

Expand Down Expand Up @@ -52,3 +61,16 @@ foreach my $srv ( @daemons ) {


exit 0;

sub get_distribution {
my $fh;
my $os = "";
open $fh, '<', '/etc/os-release' || die "Could not open /etc/os-release: $!";
my $line;
while ($line = <$fh>) {
$os = 'suse' if ($line =~ /^ID_LIKE=.*suse.*/);
$os = 'rh' if ($line =~ /^ID_LIKE=.*fedora.*/);
}
close $fh;
return $os
}
4 changes: 2 additions & 2 deletions dist/t/0090-check_database.ts
Expand Up @@ -14,8 +14,8 @@ TABLES_IN_DB=$(mysql -e "show tables" $DB_NAME)
[[ $TABLES_IN_DB ]]
is "$?" 0 "Checking if tables in database $DB_NAME"

D=`ps -ef|grep "mysqld .* --datadir=/srv/obs/MySQL"|wc -l`
D=$(mysql -e 'SHOW VARIABLES WHERE Variable_Name LIKE "datadir"'|grep datadir |awk '{ print $2 }')

[ $D -gt 1 -o -f /srv/obs/MySQL/*.pid ]
[ $D == '/srv/obs/MySQL/' -o -f /srv/obs/MySQL/*.pid ]

is "$?" 0 "Checking if database is started under /srv/obs/MySQL"

0 comments on commit 9d61ab1

Please sign in to comment.