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

UnsupportedDigestmodError on 15-SP6 FIPS mode #213

Closed
grisu48 opened this issue Jul 1, 2024 · 2 comments · Fixed by #212
Closed

UnsupportedDigestmodError on 15-SP6 FIPS mode #213

grisu48 opened this issue Jul 1, 2024 · 2 comments · Fixed by #212

Comments

@grisu48
Copy link
Collaborator

grisu48 commented Jul 1, 2024

We're seeing some _hashlib.UnsupportedDigestmodError in the newly enabled 15-SP6 FIPS host tests for BCI. There are multiple errors of the same kind showing up, see e.g. https://openqa.suse.de/tests/14776877#step/_root_BCI-tests_all_/1

# Test messages # test_os_release[bci/bci-base:15.6 from registry.suse.de/suse/sle-15-sp6/update/cr/totest/images/bci/bci-base:15.6]
# error: 

failed on setup with "_hashlib.UnsupportedDigestmodError: [digital envelope routines] unsupported"
request = <SubRequest 'auto_container' for <Function test_os_release[bci/bci-base:15.6 from registry.suse.de/suse/sle-15-sp6/update/cr/totest/images/bci/bci-base:15.6]>>
container_runtime = PodmanRuntime(build_command=['buildah', 'bud', '--layers', '--force-rm'], runner_binary='podman', _runtime_functional=True)
pytestconfig = <_pytest.config.Config object at 0x7f52f0b72610>

    def fixture_funct(
        request: SubRequest,
        # we must call this parameter container runtime, so that pytest will
        # treat it as a fixture, but that causes pylint to complain…
        # pylint: disable=redefined-outer-name
        container_runtime: OciRuntimeBase,
        pytestconfig: Config,
    ) -> Generator[ContainerData, None, None]:
        """Fixture that will build & launch a container that is either passed as a
        request parameter or it will be automatically parametrized via
        pytest_generate_tests.
        """
    
        try:
            container, _ = container_and_marks_from_pytest_param(request.param)
        except AttributeError as attr_err:
            raise RuntimeError(
                "This fixture was not parametrized correctly, "
                "did you forget to call `auto_container_parametrize` in `pytest_generate_tests`?"
            ) from attr_err
        _logger.debug("Requesting the container %s", str(container))
    
        if scope == "session" and container.singleton:
            raise RuntimeError(
                f"A singleton container ({container}) cannot be used in a session level fixture"
            )
    
        add_labels = [
            "--label",
            f"pytest_container.request={request}",
            "--label",
            f"pytest_container.node.name={request.node.name}",
            "--label",
            f"pytest_container.scope={request.scope}",
        ]
        try:
            add_labels.extend(
                ["--label", f"pytest_container.path={request.path}"]
            )
        except AttributeError:
            pass
    
        with ContainerLauncher(
            container=container,
            container_runtime=container_runtime,
            rootdir=pytestconfig.rootpath,
            extra_build_args=get_extra_build_args(pytestconfig),
            extra_run_args=get_extra_run_args(pytestconfig) + add_labels,
        ) as launcher:
            # we want to ensure that the container's logs are saved at "all
            # cost", especially when the container fails to launch for some
            # reason
            try:
>               launcher.launch_container()

.tox/all/lib/python3.11/site-packages/pytest_container/plugin.py:120: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.tox/all/lib/python3.11/site-packages/pytest_container/container.py:1047: in launch_container
    Path(tempfile.gettempdir()) / self.container.filelock_filename
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = DerivedContainer(url='', container_id='', entry_point=<EntrypointSelection.AUTO: 1>, custom_entry_point=None, extra_la....de/suse/sle-15-sp6/update/cr/totest/images/bci/bci-base:15.6', containerfile='', image_format=None, add_build_tags=[])

    @property
    def filelock_filename(self) -> str:
        """Filename of a lockfile unique to the container image under test.
    
        It is a hash of the properties of this class excluding all values that
        are set after the container is launched. Thereby, this filename can be
        used to acquire a lock blocking any action using this specific container
        image across threads/processes.
    
        """
        all_elements = []
        for attr_name, value in self.__dict__.items():
            # don't include the container_id in the hash calculation as the id
            # might not yet be known but could be populated later on i.e. that
            # would cause a different hash for the same container
            if attr_name == "container_id":
                continue
            if isinstance(value, list):
                all_elements.append("".join([str(elem) for elem in value]))
            elif isinstance(value, dict):
                all_elements.append("".join(value.values()))
            else:
                all_elements.append(str(value))
>       return f"{md5((''.join(all_elements)).encode()).hexdigest()}.lock"
E       _hashlib.UnsupportedDigestmodError: [digital envelope routines] unsupported

.tox/all/lib/python3.11/site-packages/pytest_container/container.py:622: UnsupportedDigestmodError

I was told to file an issue for this problem here by @dcermak 😉

@grisu48
Copy link
Collaborator Author

grisu48 commented Jul 1, 2024

Should be fixed in #212

@grisu48
Copy link
Collaborator Author

grisu48 commented Jul 2, 2024

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant