Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CentOS Stream to distro util #5834

Merged
merged 2 commits into from
Dec 15, 2023

Conversation

richtja
Copy link
Contributor

@richtja richtja commented Dec 14, 2023

Add CentOS Stream to distro util

Reference: #5667

@richtja richtja added the bug label Dec 14, 2023
@richtja richtja requested a review from clebergnu December 14, 2023 17:03
@richtja richtja self-assigned this Dec 14, 2023
@richtja richtja linked an issue Dec 14, 2023 that may be closed by this pull request
@mr-avocado
Copy link

mr-avocado bot commented Dec 14, 2023

Dear contributor,
Avocado is currently under sprint #103, which is due to release an LTS (Long Term Stability) release.
Please avoid merging changes that do not fall into these categories:

  • Bug fixes
  • Usability Improvements
  • Documentation updates

As for the Avocado utility modules (“avocado.utils”) it is OK to introduce new functionality,
but changes to the existing APIs (including interface and behavior) should be avoided.
These kind of changes should wait until sprint #104.

@@ -304,7 +304,7 @@ def get_distro(self):
self.score += 1

if self.check_release():
release = self.release()
release = self.release() or UNKNOWN_DISTRO_RELEASE
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation of release() already sets the default value to UNKNOWN_DISTRO_RELEASE. Would you care to explain why this is needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed, because I used optional group (\d{1,2})? for the release. But when I am looking at it now, I think the better place will be in self.release(). I will send an update.

Copy link
Contributor

@clebergnu clebergnu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @richtja ,

Thanks for this. Besides the UNKNOWN_DISTRO_RELEASE question, it'd be nice to add a test such as:

diff --git a/selftests/functional/utils/distro.py b/selftests/functional/utils/distro.py
index be9bca03f..d11f042b4 100644
--- a/selftests/functional/utils/distro.py
+++ b/selftests/functional/utils/distro.py
@@ -53,3 +53,14 @@ class Distro(Test):
             + os.uname().machine.encode()
             + b") version 9 release 1\n",
         )
+
+    def test_centos_stream_9(self):
+        """
+        :avocado: dependency={"type": "podman-image", "uri": "quay.io/centos/centos:stream9"}
+        """
+        self.run_job(
+            "quay.io/centos/centos:stream9",
+            b"Detected distribution: centos-stream ("
+            + os.uname().machine.encode()
+            + b") version 9 release 0\n"
+        )

But, as a new probe, it needs to use an egg built from the actual source code (and not use a released Avocado version). We could simply open an issue to add such a test after 103.0 is released so that we don't forget about it.

@richtja
Copy link
Contributor Author

richtja commented Dec 15, 2023

Hi @richtja ,

Thanks for this. Besides the UNKNOWN_DISTRO_RELEASE question, it'd be nice to add a test such as:

diff --git a/selftests/functional/utils/distro.py b/selftests/functional/utils/distro.py
index be9bca03f..d11f042b4 100644
--- a/selftests/functional/utils/distro.py
+++ b/selftests/functional/utils/distro.py
@@ -53,3 +53,14 @@ class Distro(Test):
             + os.uname().machine.encode()
             + b") version 9 release 1\n",
         )
+
+    def test_centos_stream_9(self):
+        """
+        :avocado: dependency={"type": "podman-image", "uri": "quay.io/centos/centos:stream9"}
+        """
+        self.run_job(
+            "quay.io/centos/centos:stream9",
+            b"Detected distribution: centos-stream ("
+            + os.uname().machine.encode()
+            + b") version 9 release 0\n"
+        )

But, as a new probe, it needs to use an egg built from the actual source code (and not use a released Avocado version). We could simply open an issue to add such a test after 103.0 is released so that we don't forget about it.

Yes you are right, I will create an issue and prepare the test.

This commit adds Linux to the CentOS distro detection. This will be
helpful for differentiating the CentOS and CentOS Streams distros.

Signed-off-by: Jan Richter <[email protected]>
Copy link
Contributor

@clebergnu clebergnu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@clebergnu clebergnu merged commit edcd859 into avocado-framework:master Dec 15, 2023
63 checks passed
@richtja richtja deleted the cos_distro branch March 26, 2024 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Distro detection: CentOS Stream broken
2 participants