Skip to content
This repository has been archived by the owner on Oct 2, 2024. It is now read-only.

Commit

Permalink
quick bug fixes for 0.38 (#1905)
Browse files Browse the repository at this point in the history
  • Loading branch information
reidpr authored Jun 13, 2024
1 parent 649c710 commit 1250c19
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 10 deletions.
17 changes: 9 additions & 8 deletions bin/ch-test
Original file line number Diff line number Diff line change
Expand Up @@ -299,16 +299,17 @@ pedantry_set () {
if [[ $ch_pedantic == no ]]; then
ch_pedantic= # proper boolean
fi
# The motivation here is that in pedantic mode, we want to run all the
# tests we reasonably can. So, if the user *has* sudo, then default --sudo
# to yes. What is a little awkward is that “sudo -v” can generate a
# password prompt in the middle of the status output. An alternative is
# “sudo -nv”, which doesn’t; drawbacks are that you have to analyze the
# output (not exit code) and it generates a failed password log message if
# there is not already a sudo session going.
# Motivation here: In pedantic mode, we want to run all the tests we
# reasonably can. So, if the user *has* sudo, then default --sudo to yes.
# What is a little awkward is that “sudo true” can generate a password
# prompt in the middle of the status output. An alternative is “sudo -nv”,
# which doesn’t; drawbacks are that you have to analyze the output (not
# exit code) and it generates a failed password log message if there is
# not already a sudo session going. We also used to use “sudo -v”, which
# prompts for a password even if you have passwordless sudo set up.
if [[ -n $ch_pedantic ]] \
&& command -v sudo > /dev/null \
&& sudo -v > /dev/null 2>&1; then
&& sudo true > /dev/null 2>&1; then
use_sudo_default=yes
else
use_sudo_default=
Expand Down
3 changes: 2 additions & 1 deletion test/build/50_dockerfile.bats
Original file line number Diff line number Diff line change
Expand Up @@ -1160,7 +1160,8 @@ EOF
[[ $status -ne 0 ]]
[[ $output = *'error: no context because '?'-'?' given'* \
|| $output = *'COPY failed: file not found in build context or'* \
|| $output = *'no such file or directory'* ]]
|| $output = *'no such file or directory'*
|| $output = *'not found'* ]]
}


Expand Down
2 changes: 1 addition & 1 deletion test/common.bash
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ fi
# Do we have and want sudo?
if [[ $CH_TEST_SUDO ]] \
&& command -v sudo >/dev/null 2>&1 \
&& sudo -v > /dev/null 2>&1; then
&& sudo true > /dev/null 2>&1; then
# This isn’t super reliable; it returns true if we have *any* sudo
# privileges, not specifically to run the commands we want to run.
ch_have_sudo=yes
Expand Down
11 changes: 11 additions & 0 deletions test/force-auto.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class Test(abc.ABC):
base = None
config = None
scope = Scope.FULL
skip_reason = None
prep_run = None
runs = { Run.UNNEEDED_FAIL: "false",
Run.UNNEEDED_WIN: "true" }
Expand All @@ -83,6 +84,13 @@ class Test(abc.ABC):
def build2_post_hook(self):
return ""

@property
def skip(self):
if (self.skip_reason is None):
return ""
else:
return "skip '%s'" % self.skip_reason

def as_grep_files(self, grep_files, image, invert=False):
cmds = []
for (re, path) in grep_files:
Expand Down Expand Up @@ -168,6 +176,7 @@ echo "$output"
# emit the test
print(f"""
@test "ch-image --force: {self}" {{
{self.skip}
scope {scope}
{arch_excludes}

Expand Down Expand Up @@ -234,6 +243,7 @@ class T_RHEL_UBI_8(RHEL8):
class CentOS_8(RHEL8, EPEL_Mixin):
prep_run = "dnf install -y epel-release"
class T_CentOS_8_Stream(CentOS_8):
skip_reason = "issue #1904"
# CentOS Stream pulls from quay.io per the CentOS wiki:
# https://wiki.centos.org/FAQ/CentOSStream#What_artifacts_are_built.3F
base = "quay.io/centos/centos:stream8"
Expand All @@ -254,6 +264,7 @@ class T_Rocky_8(CentOS_8):
class Fedora(RHEL8):
config = "fedora"
class T_Fedora_26(Fedora):
skip_reason = "issue #1904"
# We would prefer to test the lowest supported --force version, 24,
# but the ancient version of dnf it has doesn't fail the transaction when
# a package fails so we test with 26 instead.
Expand Down

0 comments on commit 1250c19

Please sign in to comment.