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

NO-ISSUE: chore(tests/containers): fix fake fips tests for macOS rootless podman machine #891

Merged

Conversation

jiridanek
Copy link
Member

@jiridanek jiridanek commented Feb 6, 2025

This is to fix this problem I have on macOS with rootless podman machine

base_image_test.py:146: in test_oc_command_runs_fake_fips
    assert ecode == 0, output.decode()
E   AssertionError: assertion failed [!result.is_error]: Unable to open /proc/sys/vm/mmap_min_addr
E     (VMAllocationTracker.cpp:317 init)
E
E   assert 137 == 0

Normally, there is /proc/sys/vm/mmap_min_addr file

lima cat /proc/sys/vm/mmap_min_addr
65536
podman machine ssh cat /proc/sys/vm/mmap_min_addr
65536
podman run --entrypoint /bin/bash --rm -it ghcr.io/jiridanek/notebooks/workbench-images:base-ubi9-python-3.11-jd_ubi_base_1e8dd3140d980ff573d56d3ae746959f31825d8a
WARNING: image platform (linux/amd64) does not match the expected platform (linux/arm64)
bash-5.1$ cat /proc/sys/vm/mmap_min_addr
65536

but in the tests when mounting iinto /proc/sys, we end up making /proc/sys/vm inaccessible. The broad mount is required for GitHub Actions on Ubuntu.

Description

Solution is conditional, to mount differently on ubuntu and in a different way elsewhere. Checking whether /proc/sys/crypto is present on macOS is harder (podman machine) so assume on macOS ppl are using Fedora in podman machine so it works.

How Has This Been Tested?

helpers/pycharm/_jb_pytest_runner.py --target base_image_test.py::TestBaseImage.test_oc_command_runs_fake_fips -- --image=ghcr.io/jiridanek/notebooks/workbench-images:base-ubi9-python-3.11-jd_ubi_base_1e8dd3140d980ff573d56d3ae746959f31825d8a 

Merge criteria:

  • The commits are squashed in a cohesive manner and have meaningful messages.
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has manually tested the changes and verified that the changes work

@openshift-ci openshift-ci bot added size/s and removed size/s labels Feb 6, 2025
…less podman machine

```
base_image_test.py:146: in test_oc_command_runs_fake_fips
    assert ecode == 0, output.decode()
E   AssertionError: assertion failed [!result.is_error]: Unable to open /proc/sys/vm/mmap_min_addr
E     (VMAllocationTracker.cpp:317 init)
E
E   assert 137 == 0
```

```
lima cat /proc/sys/vm/mmap_min_addr
65536
```

```
podman machine ssh cat /proc/sys/vm/mmap_min_addr
65536
```

```
podman run --entrypoint /bin/bash --rm -it ghcr.io/jiridanek/notebooks/workbench-images:base-ubi9-python-3.11-jd_ubi_base_1e8dd3140d980ff573d56d3ae746959f31825d8a
WARNING: image platform (linux/amd64) does not match the expected platform (linux/arm64)
bash-5.1$ cat /proc/sys/vm/mmap_min_addr
65536
```
@openshift-ci openshift-ci bot added size/s and removed size/s labels Feb 6, 2025
@jstourac
Copy link
Member

jstourac commented Feb 7, 2025

Hey Jiri - that "How this was tested section":

helpers/pycharm/_jb_pytest_runner.py --target base_image_test.py::TestBaseImage.test_oc_command_runs_fake_fips -- --image=ghcr.io/jiridanek/notebooks/workbench-images:base-ubi9-python-3.11-jd_ubi_base_1e8dd3140d980ff573d56d3ae746959f31825d8a 

what is that? how can somebody else run it?

@jstourac
Copy link
Member

jstourac commented Feb 7, 2025

Tested myself locally with the following command:

DOCKER_HOST=unix:///run/user/$UID/podman/podman.sock poetry run pytest tests/containers --image quay.io/modh/odh-generic-data-science-notebook@sha256:0efbb3ad6f8f342360cf1f002d40716a39d4c58f69163e053d5bd19b4fe732d4

The results are:

==== 6 passed, 3 skipped, 4 subtests passed in 10.24s =====

Seems like nothing truly break for non-macOS users.

/lgtm

@jiridanek
Copy link
Member Author

what is that?

that's how it was tested

how can somebody else run it?

if they install pycharm, they can right-click and pycharm will run the test exactly this way

otherwise, -k and --image with poetry run pytest, as usual, ofc

@jiridanek
Copy link
Member Author

/override ci/prow/images
/approve

Copy link
Contributor

openshift-ci bot commented Feb 7, 2025

@jiridanek: Overrode contexts on behalf of jiridanek: ci/prow/images

In response to this:

/override ci/prow/images
/approve

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Copy link
Contributor

openshift-ci bot commented Feb 7, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jiridanek

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved label Feb 7, 2025
@openshift-merge-bot openshift-merge-bot bot merged commit ff398da into opendatahub-io:main Feb 7, 2025
7 checks passed
@jiridanek jiridanek deleted the jd_rootless_podman branch February 7, 2025 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants