From 141d335f56147ce5586714c17ecc61da2c1b46ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dirk=20M=C3=BCller?= Date: Tue, 11 Jul 2023 18:05:09 +0200 Subject: [PATCH 1/7] Enable regular CI for OS_VERSION=tumbleweed as well --- .github/workflows/ci.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 71090e2e..1a559754 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -101,6 +101,7 @@ jobs: - PODMAN os_version: - 15.5 + - "tumbleweed" include: - toxenv: repository container_runtime: PODMAN From 60a6fa811e2d4798d9bd3f519b00fd5d19a412ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dirk=20M=C3=BCller?= Date: Tue, 19 Sep 2023 23:53:28 +0200 Subject: [PATCH 2/7] only test golang-openssl containers on sle15 --- bci_tester/data.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/bci_tester/data.py b/bci_tester/data.py index 16c5b206..5d33bb35 100755 --- a/bci_tester/data.py +++ b/bci_tester/data.py @@ -71,6 +71,7 @@ OS_CONTAINER_TAG = "latest" APP_CONTAINER_PREFIX = "opensuse" BCI_CONTAINER_PREFIX = "bci" + OS_VERSION_ID = None #: The Tumbleweed pretty name (from /etc/os-release) OS_PRETTY_NAME = os.getenv( @@ -368,18 +369,26 @@ def create_BCI( bci_type=ImageType.OS, ) +# The very last container in this list needs to be available for all +# tested OSes GOLANG_CONTAINERS = [ create_BCI( build_tag=f"{BCI_CONTAINER_PREFIX}/golang:{golang_version}", extra_marks=[pytest.mark.__getattr__(f"golang_{stability}")], + available_versions=["15.5", "15.6"], ) for golang_version, stability in ( - ("1.20", "oldstable"), ("oldstable-openssl", "oldstable"), ("stable-openssl", "stable"), + ) +] + [ + create_BCI( + build_tag=f"{BCI_CONTAINER_PREFIX}/golang:{golang_version}", + extra_marks=[pytest.mark.__getattr__(f"golang_{stability}")], + ) + for golang_version, stability in ( + ("1.20", "oldstable"), ("1.21", "stable"), - # does not exist yet (as of 2023/08/15) - # ("1.21-openssl", "stable"), ) ] From d9dd145176da28fa6a47f34be3626efe6ffbb592 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dirk=20M=C3=BCller?= Date: Fri, 22 Sep 2023 17:59:31 +0200 Subject: [PATCH 3/7] Skip some python tests that are not PEP 668 compatible on tumbleweed --- tests/test_python.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/tests/test_python.py b/tests/test_python.py index 08b14b38..58499713 100644 --- a/tests/test_python.py +++ b/tests/test_python.py @@ -12,6 +12,7 @@ from pytest_container.runtime import LOCALHOST from pytest_container.runtime import Version +from bci_tester.data import OS_VERSION from bci_tester.data import PYTHON_CONTAINERS from bci_tester.runtime_choice import PODMAN_SELECTED @@ -100,11 +101,19 @@ def test_pip(auto_container): assert f"pip {version_from_env}" in reported_version +@pytest.mark.skipif( + OS_VERSION == "tumbleweed", + reason="pip --user not working properly with PEP 668", +) def test_tox(auto_container): """Ensure we can use :command:`pip` to install :command:`tox`.""" auto_container.connection.run_expect([0], "pip install --user tox") +@pytest.mark.skipif( + OS_VERSION == "tumbleweed", + reason="pip --user not working properly with PEP 668", +) def test_pip_install_source_cryptography(auto_container_per_test): """Check that cryptography python module can be installed from source so that it is built against the SLE BCI FIPS enabled libopenssl.""" @@ -193,6 +202,10 @@ def test_python_webserver_1( ) +@pytest.mark.skipif( + OS_VERSION == "tumbleweed", + reason="pip --user not working properly with PEP 668", +) @pytest.mark.parametrize( "container_per_test", CONTAINER_IMAGES_T2, indirect=["container_per_test"] ) @@ -249,6 +262,10 @@ def test_python_webserver_2( assert container_per_test.connection.file(destdir + xfilename).exists +@pytest.mark.skipif( + OS_VERSION == "tumbleweed", + reason="pip --user not working properly with PEP 668", +) @pytest.mark.skipif( # skip test if architecture is not x86. LOCALHOST.system_info.arch != "x86_64", @@ -272,7 +289,10 @@ def test_tensorf(container_per_test): assert "sse4" in cpuflg # install TF module for python - if container_per_test.connection.run("pip install tensorflow").rc != 0: + if ( + container_per_test.connection.run("pip install --user tensorflow").rc + != 0 + ): pytest.xfail( "pip install failure: check tensorflow requirements or update pip" ) From 611f49080f1227c5b567087499d38fe9c9685503 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dirk=20M=C3=BCller?= Date: Fri, 22 Sep 2023 17:59:12 +0200 Subject: [PATCH 4/7] Update sizings for Tumbleweed containers --- tests/test_base.py | 21 ++++++++++++++------- tests/test_busybox.py | 19 ++++++++++++------- tests/test_minimal.py | 8 ++++---- 3 files changed, 30 insertions(+), 18 deletions(-) diff --git a/tests/test_base.py b/tests/test_base.py index 90ada1ec..629600e0 100644 --- a/tests/test_base.py +++ b/tests/test_base.py @@ -34,10 +34,10 @@ def test_base_size(auto_container, container_runtime): #: size limits of the base container per arch in MiB if OS_VERSION in ("basalt", "tumbleweed"): BASE_CONTAINER_MAX_SIZE: Dict[str, int] = { - "x86_64": 126, - "aarch64": 146, - "ppc64le": 166, - "s390x": 131, + "x86_64": 135, + "aarch64": 135, + "ppc64le": 175, + "s390x": 140, } else: BASE_CONTAINER_MAX_SIZE: Dict[str, int] = { @@ -46,9 +46,16 @@ def test_base_size(auto_container, container_runtime): "ppc64le": 160, "s390x": 125, } - assert ( - container_runtime.get_image_size(auto_container.image_url_or_id) - < BASE_CONTAINER_MAX_SIZE[LOCALHOST.system_info.arch] * 1024 * 1024 + container_size = container_runtime.get_image_size( + auto_container.image_url_or_id + ) // (1024 * 1024) + max_container_size = BASE_CONTAINER_MAX_SIZE[LOCALHOST.system_info.arch] + min_container_size = ( + BASE_CONTAINER_MAX_SIZE[LOCALHOST.system_info.arch] - 5 + ) + assert container_size <= max_container_size, ( + f"Base container size is {container_size} MiB for {LOCALHOST.system_info.arch} " + f"(expected {min_container_size}..{BASE_CONTAINER_MAX_SIZE[LOCALHOST.system_info.arch]} MiB)" ) diff --git a/tests/test_busybox.py b/tests/test_busybox.py index 899678c5..4a4ea406 100644 --- a/tests/test_busybox.py +++ b/tests/test_busybox.py @@ -24,10 +24,10 @@ def test_busybox_provides_sh(auto_container): #: size limits of the micro image per architecture in MiB BUSYBOX_IMAGE_MAX_SIZE: Dict[str, int] = { - "x86_64": 16 if OS_VERSION == "tumbleweed" else 14, - "aarch64": 16 if OS_VERSION == "tumbleweed" else 14, - "s390x": 16 if OS_VERSION == "tumbleweed" else 14, - "ppc64le": 16 if OS_VERSION == "tumbleweed" else 14, + "x86_64": 16 if OS_VERSION == "tumbleweed" else 13, + "aarch64": 16 if OS_VERSION == "tumbleweed" else 13, + "s390x": 16 if OS_VERSION == "tumbleweed" else 13, + "ppc64le": 16 if OS_VERSION == "tumbleweed" else 13, } @@ -43,9 +43,14 @@ def test_busybox_image_size( specified in :py:const:`BUSYBOX_IMAGE_MAX_SIZE`. """ - assert ( - container_runtime.get_image_size(container.image_url_or_id) - < size[LOCALHOST.system_info.arch] * 1024 * 1024 + container_size = container_runtime.get_image_size( + container.image_url_or_id + ) // (1024 * 1024) + min_container_size = size[LOCALHOST.system_info.arch] - 5 + max_container_size = size[LOCALHOST.system_info.arch] + assert container_size <= max_container_size, ( + f"Base container size is {container_size} MiB for {LOCALHOST.system_info.arch} " + f"(expected {min_container_size}..{max_container_size} MiB)" ) diff --git a/tests/test_minimal.py b/tests/test_minimal.py index 4eb94902..860ce196 100644 --- a/tests/test_minimal.py +++ b/tests/test_minimal.py @@ -34,10 +34,10 @@ } TW_MICRO_IMAGE_MAX_SIZE: Dict[str, int] = { - "x86_64": 32, - "aarch64": 34, - "s390x": 32, - "ppc64le": 39, + "x86_64": 34, + "aarch64": 36, + "s390x": 34, + "ppc64le": 41, } From 85a390705958747be143ceb4dc41b447f5908913 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dirk=20M=C3=BCller?= Date: Tue, 24 Oct 2023 13:37:42 +0200 Subject: [PATCH 5/7] Skip apache_envvars test for tumbleweed this no longer exists and was silently removed in tumbleweed as part of a version update --- tests/test_php.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/test_php.py b/tests/test_php.py index c5d079ea..f309a73a 100644 --- a/tests/test_php.py +++ b/tests/test_php.py @@ -18,6 +18,7 @@ from bci_tester.data import PHP_8_APACHE from bci_tester.data import PHP_8_CLI from bci_tester.data import PHP_8_FPM +from bci_tester.data import OS_VERSION CONTAINER_IMAGES = [PHP_8_CLI, PHP_8_APACHE, PHP_8_FPM] @@ -271,11 +272,12 @@ def get_env_var(env_var: str) -> str: f"{apache_confdir}/httpd.conf" ).is_file - apache_envvars = get_env_var("APACHE_ENVVARS") - assert container_per_test.connection.file(apache_envvars).is_file - assert container_per_test.connection.run_expect( - [0], f"source {apache_envvars}" - ) + if OS_VERSION not in ("basalt", "tumbleweed"): + apache_envvars = get_env_var("APACHE_ENVVARS") + assert container_per_test.connection.file(apache_envvars).is_file + assert container_per_test.connection.run_expect( + [0], f"source {apache_envvars}" + ) @pytest.mark.parametrize("container_image", [PHP_8_CLI]) From bc65fa40116af8def321c1bc6aeca52a4856b331 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dirk=20M=C3=BCller?= Date: Tue, 24 Oct 2023 17:35:09 +0200 Subject: [PATCH 6/7] Fix rails test on tumbleweed libyaml-devel is now required to be installed to instanciate the rails scaffold --- tests/test_ruby.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/test_ruby.py b/tests/test_ruby.py index 673c085b..70e31803 100644 --- a/tests/test_ruby.py +++ b/tests/test_ruby.py @@ -81,7 +81,7 @@ def test_rails_hello_world(auto_container_per_test): # Rails asset pipeline needs Node.js and yarn auto_container_per_test.connection.run_expect( - [0], "zypper -n in nodejs-default yarn" + [0], "zypper -n in nodejs-default yarn libyaml-devel" ) auto_container_per_test.connection.run_expect( [0], "rails new /hello/ --minimal" @@ -90,6 +90,11 @@ def test_rails_hello_world(auto_container_per_test): @pytest.mark.skipif(OS_VERSION != "tumbleweed", reason="no rails for ruby 2.5") def test_rails_template(auto_container_per_test): + # Rails asset pipeline needs Node.js and yarn + auto_container_per_test.connection.run_expect( + [0], "zypper -n in nodejs-default yarn libyaml-devel" + ) + auto_container_per_test.connection.run_expect( [0], "gem install 'rails:~> 7.0'" ) @@ -111,9 +116,6 @@ def test_rails_template(auto_container_per_test): ): pytest.xfail("timezone data are not in the container") - curl_localhost = auto_container_per_test.connection.run_expect( - [0], + assert "Ruby on Rails" in auto_container_per_test.connection.check_output( "cd /hello/ && (rails server > /dev/null &) && curl -sf --retry 5 --retry-connrefused http://localhost:3000", ) - - assert "Ruby on Rails" in curl_localhost.stdout.strip() From 0c270b95d874b728125f294996c03194925264dd Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Wed, 25 Oct 2023 17:02:47 +0200 Subject: [PATCH 7/7] Wording improvements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Dan Čermák <45594031+dcermak@users.noreply.github.com> --- tests/test_python.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_python.py b/tests/test_python.py index 58499713..765e31a9 100644 --- a/tests/test_python.py +++ b/tests/test_python.py @@ -103,7 +103,7 @@ def test_pip(auto_container): @pytest.mark.skipif( OS_VERSION == "tumbleweed", - reason="pip --user not working properly with PEP 668", + reason="pip --user not working due to PEP 668", ) def test_tox(auto_container): """Ensure we can use :command:`pip` to install :command:`tox`.""" @@ -112,7 +112,7 @@ def test_tox(auto_container): @pytest.mark.skipif( OS_VERSION == "tumbleweed", - reason="pip --user not working properly with PEP 668", + reason="pip --user not working due to PEP 668", ) def test_pip_install_source_cryptography(auto_container_per_test): """Check that cryptography python module can be installed from source so that @@ -204,7 +204,7 @@ def test_python_webserver_1( @pytest.mark.skipif( OS_VERSION == "tumbleweed", - reason="pip --user not working properly with PEP 668", + reason="pip --user not working due to PEP 668", ) @pytest.mark.parametrize( "container_per_test", CONTAINER_IMAGES_T2, indirect=["container_per_test"] @@ -264,7 +264,7 @@ def test_python_webserver_2( @pytest.mark.skipif( OS_VERSION == "tumbleweed", - reason="pip --user not working properly with PEP 668", + reason="pip --user not working due to PEP 668", ) @pytest.mark.skipif( # skip test if architecture is not x86.