-
Notifications
You must be signed in to change notification settings - Fork 198
Compare nginx version against the major OS version #375
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../test/test_container_sizes.py |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../test/test_container_sizes.py |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../test/test_container_sizes.py |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../test/test_container_sizes.py |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| import pytest | ||
|
|
||
| from container_ci_suite.container_lib import ContainerTestLib | ||
| from container_ci_suite.compare_images import ContainerCompareClass | ||
| from container_ci_suite.utils import get_public_image_name, get_previous_os_version | ||
|
|
||
| from conftest import VARS, skip_if_version_not_minimal | ||
|
|
||
|
|
||
| class TestNginxContainerSizes: | ||
| """ | ||
| Test container sizes | ||
| """ | ||
|
|
||
| def setup_method(self): | ||
| """ | ||
| Setup method | ||
| """ | ||
| self.app = ContainerTestLib(image_name=VARS.IMAGE_NAME, s2i_image=True) | ||
|
|
||
| def teardown_method(self): | ||
| """ | ||
| Teardown method | ||
| """ | ||
| self.app.cleanup() | ||
|
|
||
| def test_compare_container_sizes(self): | ||
| """ | ||
| Test the size of the Nginx container against the | ||
| already published container images. | ||
| """ | ||
| skip_if_version_not_minimal() | ||
| if not VARS.OS.startswith("rhel"): | ||
| pytest.skip("Skipping container size comparison for non-RHEL OS.") | ||
| published_image_name = get_public_image_name( | ||
| os_name=get_previous_os_version(VARS.OS), | ||
| base_image_name="nginx", | ||
| version=VARS.VERSION, | ||
| stage_registry=True, | ||
| ) | ||
| is_less_uncopressed = ContainerCompareClass.is_uncompressed_image_smaller( | ||
| built_image_name=VARS.IMAGE_NAME, | ||
| published_image=published_image_name, | ||
| ) | ||
| is_less_compressed = ContainerCompareClass.is_compressed_image_smaller( | ||
| built_image_name=VARS.IMAGE_NAME, | ||
| published_image_name=published_image_name, | ||
| ) | ||
|
phracek marked this conversation as resolved.
|
||
| if not is_less_uncopressed or not is_less_compressed: | ||
| pytest.skip( | ||
| f"Container size is not less than the published image {published_image_name}. " | ||
| f"Uncompressed image size: {is_less_uncopressed}, Compressed image size: {is_less_compressed}" | ||
| ) | ||
|
Comment on lines
+27
to
+53
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Confirm get_previous_os_version behavior for the lowest supported RHEL and return type of the comparison helpers.
python - <<'PY'
import inspect
try:
from container_ci_suite.utils import get_previous_os_version, get_public_image_name
print("get_previous_os_version:", inspect.signature(get_previous_os_version))
for os_name in ("rhel8", "rhel9", "rhel10"):
try:
print(os_name, "->", get_previous_os_version(os_name))
except Exception as e:
print(os_name, "raises", type(e).__name__, e)
except Exception as e:
print("import failed:", e)
PYRepository: sclorg/nginx-container Length of output: 117 🏁 Script executed: #!/bin/bash
# Explore repository structure to find test file and helper function implementations
git ls-files | head -20
echo "---"
fd -t f "test_container_sizes"
fd -t f "\.py$" | grep -E "(utils|container)" | head -20Repository: sclorg/nginx-container Length of output: 780 🏁 Script executed: #!/bin/bash
# Read the test file mentioned in the review
head -100 test/test_container_sizes.pyRepository: sclorg/nginx-container Length of output: 1925 🏁 Script executed: #!/bin/bash
# Search for the helper functions referenced in the test
rg "def get_previous_os_version|def get_public_image_name|class ContainerCompareClass" -A 10Repository: sclorg/nginx-container Length of output: 48 🏁 Script executed: #!/bin/bash
# Check conftest.py and look for dependency definitions
cat -n test/conftest.pyRepository: sclorg/nginx-container Length of output: 1763 🏁 Script executed: #!/bin/bash
# Look for dependency/requirements files
fd -t f "requirements|setup|pyproject" | xargs ls -la 2>/dev/null
git ls-files | grep -E "requirements|setup|pyproject"Repository: sclorg/nginx-container Length of output: 1281 🏁 Script executed: #!/bin/bash
# Check .gitmodules to see if container_ci_suite is a submodule
cat .gitmodules 2>/dev/null || echo "No .gitmodules found"Repository: sclorg/nginx-container Length of output: 163 🏁 Script executed: #!/bin/bash
# Search for any existing try/except patterns in test files or error handling
rg "try:|except|raise" test/ --type py | head -30Repository: sclorg/nginx-container Length of output: 48 🏁 Script executed: #!/bin/bash
# Check GitHub workflows to understand test execution
cat -n .github/workflows/container-tests.yml | head -100Repository: sclorg/nginx-container Length of output: 684 🏁 Script executed: #!/bin/bash
# Search for all uses of get_previous_os_version in the test directory
rg "get_previous_os_version" test/Repository: sclorg/nginx-container Length of output: 261 🏁 Script executed: #!/bin/bash
# Check for any documentation about test dependencies
cat README.md | grep -A 5 -B 5 "test\|pytest\|container_ci_suite" | head -40Repository: sclorg/nginx-container Length of output: 1310 🏁 Script executed: #!/bin/bash
# Check if there's any mention of how to handle edge cases
rg "rhel8|rhel9|rhel10" test/ -B 2 -A 2Repository: sclorg/nginx-container Length of output: 1132 Wrap helper calls in try/except and add logging for comparison results. The test will error (not skip) if Additionally, add logging of the raw 🤖 Prompt for AI Agents
Comment on lines
+41
to
+53
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typo: Local variable misspelling (missing Proposed fix- is_less_uncopressed = ContainerCompareClass.is_uncompressed_image_smaller(
+ is_less_uncompressed = ContainerCompareClass.is_uncompressed_image_smaller(
built_image_name=VARS.IMAGE_NAME,
published_image=published_image_name,
)
is_less_compressed = ContainerCompareClass.is_compressed_image_smaller(
built_image_name=VARS.IMAGE_NAME,
published_image_name=published_image_name,
)
- if not is_less_uncopressed or not is_less_compressed:
+ if not is_less_uncompressed or not is_less_compressed:
pytest.skip(
f"Container size is not less than the published image {published_image_name}. "
- f"Uncompressed image size: {is_less_uncopressed}, Compressed image size: {is_less_compressed}"
+ f"Uncompressed image size: {is_less_uncompressed}, Compressed image size: {is_less_compressed}"
)🤖 Prompt for AI Agents |
||
Uh oh!
There was an error while loading. Please reload this page.