|
1 | 1 | # Throwaway experiment (deleted after it runs): proves the fix in |
2 | | -# docker/Dockerfile by forcing openSUSE-Tumbleweed-Update unreachable. |
| 2 | +# docker/Dockerfile by forcing the Update repo (alias repo-update) unreachable. |
3 | 3 | # A dup --dry-run before the install forces the code path that failed: |
4 | 4 | # "fixed" must build; "mutant" (the pre-fix Dockerfile) must fail. |
5 | 5 | name: exp-opensuse |
|
27 | 27 | s = open(p).read() |
28 | 28 | key = '\t\tzretry zypper --non-interactive --gpg-auto-import-keys refresh' |
29 | 29 | assert s.count(key) == 1, 'anchor missing' |
30 | | - bad = ('\t\tzypper lr; f=$(grep -l "^\\[openSUSE-Tumbleweed-Update\\]" ' |
| 30 | + bad = ('\t\tzypper lr; f=$(grep -l "^\\[repo-update\\]" ' |
31 | 31 | '/etc/zypp/repos.d/*.repo); test -n "$f"; ' |
32 | 32 | 'sed -i "s|^baseurl=.*|baseurl=http://invalid.invalid/|" $f; ' |
33 | 33 | 'grep baseurl $f; \\\n') |
|
43 | 43 | --build-arg BASE=opensuse/tumbleweed --build-arg CC=gcc \ |
44 | 44 | --build-arg BUILD_FLAGS='OPT=1 SAFE=1' . > build.log 2>&1 |
45 | 45 | rc=$? |
46 | | - grep -vE "Retrieving|^#[0-9]+ [0-9.]+ +[0-9]+ " build.log | tail -150 |
| 46 | + grep -v Retrieving build.log | tail -150 |
47 | 47 | echo "docker build rc=$rc for ${{ matrix.v }}" |
48 | | - # The sabotage itself must have run, or a failure proves nothing. |
49 | | - grep -qE "^#[0-9]+ [0-9.]+ baseurl=http://invalid.invalid/" build.log |
50 | | - if [ "${{ matrix.v }}" = fixed ]; then test "$rc" -eq 0; else test "$rc" -ne 0; fi |
| 48 | + # Each guard aborts on its own (set +e is on): a failure for the |
| 49 | + # wrong reason, or a pass that skipped the sabotage, proves nothing. |
| 50 | + need() { grep -qE "$1" build.log || { echo "missing: $1"; exit 1; }; } |
| 51 | + need "^#[0-9]+ [0-9.]+ baseurl=http://invalid.invalid/" |
| 52 | + need "Failed to retrieve new repository metadata" |
| 53 | + need "^#[0-9]+ [0-9.]+ \+ zypper --non-interactive dup --dry-run" |
| 54 | + if [ "${{ matrix.v }}" = fixed ]; then |
| 55 | + need "modifyrepo --disable repo-update" |
| 56 | + test "$rc" -eq 0 |
| 57 | + else |
| 58 | + test "$rc" -ne 0 |
| 59 | + fi |
0 commit comments