File tree Expand file tree Collapse file tree 2 files changed +23
-5
lines changed
beaker-tests/Sanity/copr-cli-basic-operations Expand file tree Collapse file tree 2 files changed +23
-5
lines changed Original file line number Diff line number Diff line change @@ -127,3 +127,8 @@ setup_checks()
127
127
# mismatch, such tests will fail and it is not trivial to find out why.
128
128
rlRun " cat /etc/os-release |grep VERSION_ID=${FEDORA_VERSION} "
129
129
}
130
+
131
+ join_lines ()
132
+ {
133
+ tr ' \n' ' ' | sed ' s/ $//'
134
+ }
Original file line number Diff line number Diff line change @@ -44,12 +44,25 @@ function wait_for_finished_module()
44
44
local packages=$2
45
45
local tmp=$3
46
46
local timeout=1800
47
- local started=$( date +%s)
47
+ local started now built_count states states_one_line
48
+
49
+ started=$( date +%s)
50
+ rlLog " Waiting till packages are built: $packages "
48
51
while : ; do
49
52
now=$( date +%s)
50
- copr-cli list-packages $project --with-all-builds > $tmp
51
- if [ ` cat $tmp | grep state | grep " succeeded\|failed" | wc -l` -eq $packages ]; then break ; fi ;
52
- if [ $(( $now - $timeout )) -gt $started ]; then break ; fi ;
53
+ copr-cli list-packages " $project " --with-all-builds > " $tmp "
54
+ states=$( jq ' .[].builds[].state' < " $tmp " )
55
+ states_one_line=$( echo " $states " | join_lines)
56
+ built_count=$( echo " $states " | grep -e succeeded -e failed -e canceled -c)
57
+ rlLog " Currently existing packages: $( jq ' .[].name' < " $tmp " | join_lines) (states: $states_one_line )"
58
+ if test " $built_count " -ge " $packages " ; then
59
+ rlLogInfo " Successful waiting for $packages builds, states: $states_one_line "
60
+ break
61
+ fi
62
+ if [ $(( now - timeout)) -gt " $started " ]; then
63
+ rlLogFatal " This waiting is taking too long... stopping."
64
+ break
65
+ fi
53
66
sleep 10
54
67
done
55
68
}
@@ -64,7 +77,7 @@ function test_successful_packages()
64
77
local tmp=$2
65
78
rlAssertEquals " All packages should succeed" ` cat $tmp | grep " state" | grep " succeeded" | wc -l` ` echo $packages | wc -w`
66
79
for pkg in $packages ; do
67
- rlAssertEquals " Package $pkg is missing " ` cat $tmp | jq ' .[] | .name' | grep " $pkg " | wc -l ` 1
80
+ rlAssertEquals " Package $pkg is present " " $( jq ' .[].name' < " $tmp " | grep " $pkg " -c ) " 1
68
81
done
69
82
}
70
83
You can’t perform that action at this time.
0 commit comments