Skip to content

Commit

Permalink
Merge pull request #4170 from M0ses/fix_docker_test
Browse files Browse the repository at this point in the history
[ci] wait for publishing in docker upload test
  • Loading branch information
M0ses committed Dec 11, 2017
2 parents 11c3444 + 6f712a8 commit 21f4ad3
Showing 1 changed file with 36 additions and 2 deletions.
38 changes: 36 additions & 2 deletions dist/t/osc/0200-check_docker_registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
use strict;
use warnings;

use Test::More tests => 1;
use Test::More tests => 2;

# These test need a lot of resources, so they should be
# skipable

SKIP: {
skip 1, "tests disabled by default. To enable set ENABLE_DOCKER_REGISTRY_TESTS=1" unless $ENV{ENABLE_DOCKER_REGISTRY_TESTS};
skip "tests disabled by default. To enable set ENABLE_DOCKER_REGISTRY_TESTS=1", 1 unless $ENV{ENABLE_DOCKER_REGISTRY_TESTS};
`osc rdelete -m "testing deleted it" -rf BaseContainer 2>&1`;
`rm -rf /tmp/BaseContainer`;
`osc branch openSUSE.org:openSUSE:Templates:Images:42.3:Base openSUSE-Leap-Container-Base BaseContainer`;

chdir("/tmp");
Expand All @@ -34,6 +36,38 @@ SKIP: {
`osc r -w`;

ok($? == 0,"Checking result code");

my $last_upload="";
my $timeout=600;
# waiting for publishing to start
sleep 10;
# Waiting for publishing
while (1) {
my $found="";
$timeout--;
open(my $fh, "<", "/srv/obs/log/publisher.log");
while (<$fh>) {
$last_upload = $1 if ( $_ =~ /Decompressing.*(\/tmp\/\w*)/ );
}
close($fh);
open($fh, "<", "/srv/obs/log/publisher.log");
while (<$fh>) {
$found = $1 if ( $_ =~ /Deleting ($last_upload)/);
}
close($fh);

if ( $found ) {
ok(1,"Checking for upload");

last;
} else {
if ($timeout < 0 ) {
ok(0,"Checking for upload");
last;
}
}
sleep 1;
}
}

exit 0;

0 comments on commit 21f4ad3

Please sign in to comment.