Skip to content

Windows CI failure in TestScanner::test_version_in_package_make_download and more #2038

@terriko

Description

@terriko

We're getting a sporadic and not consistent failure in the windows tests. It may be related to ongoing issues with network access in github actions' windows instances, but I thought we'd changed this test to use a local copy of the file so it needs some more investigation.

=========================== short test summary info ===========================
FAILED test/test_scanner.py::TestScanner::test_version_in_package_make_download
= 1 failed, 724 passed, 11 skipped, 21 xfailed, 37 warnings in 600.92s (0:10:00) =

Longer error:

================================== FAILURES ===================================
______________ TestScanner.test_version_in_package_make_download ______________
[gw2] win32 -- Python 3.9.13 C:\hostedtoolcache\windows\Python\3.9.13\x64\python.exe

self = <test.test_scanner.TestScanner object at 0x0000016622A167F0>
mocker = <pytest_mock.plugin.MockerFixture object at 0x000001662415A9A0>

    @pytest.mark.skipif(LONG_TESTS() != 1, reason="Skipping long tests")
    def test_version_in_package_make_download(self, mocker: MockerFixture):
    
        url = "https://kojipkgs.fedoraproject.org//packages/python3/3.8.2~rc1/1.fc33/aarch64/"
        package_name = "python3-3.8.2~rc1-1.fc33.aarch64.rpm"
        product = "python"
        version = "3.8.2"
    
        mock_func = mocker.patch("pathlib.Path.is_file", return_value=False)
    
>       self.test_version_in_package(url, package_name, product, version)

test\test_scanner.py:272: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <test.test_scanner.TestScanner object at 0x0000016622A167F0>
url = 'https://kojipkgs.fedoraproject.org//packages/python3/3.8.2~rc1/1.fc33/aarch64/'
package_name = 'python3-3.8.2~rc1-1.fc33.aarch64.rpm', product = 'python'
version = '3.8.2'

    @pytest.mark.parametrize(
        "url, package_name, product, version",
        (
            pytest.param(
                d["url"],
                d["package_name"],
                d["product"],
                d["version"],
                marks=[
                    pytest.mark.skipif(
                        "ACTIONS" in os.environ
                        and os.environ["ACTIONS"] == "1"
                        and d["product"] in DISABLED_TESTS_ACTIONS,
                        reason=f"{d['product']} Long tests disabled due to issues working in github actions",
                    ),
                    pytest.mark.skipif(
                        "ACTIONS" not in os.environ
                        and d["product"] in DISABLED_TESTS_LOCAL,
                        reason=f"{d['product']} Long tests disabled locally",
                    ),
                ],
            )
            for list_data in package_test_data
            for d in list_data
        ),
    )
    @unittest.skipUnless(LONG_TESTS() > 0, "Skipping long tests")
    def test_version_in_package(self, url, package_name, product, version):
        """Helper function to get a file (presumed to be a real copy
        of a library, probably from a Linux distribution) and run a
        scan on it.  Any test using this should likely be listed as a
        long test."""
        # get file
        tempfile = self.condensed_filepath(url, package_name)
        # new scanner for the new test.
        # self.scanner = VersionScanner(self.cve_scanner, should_extract=True)
        # run the tests
        list_products = set()
        list_versions = set()
        for scan_info in self.scanner.recursive_scan(tempfile):
            if scan_info:
                product_info, file_path = scan_info
                list_products.add(product_info.product)
                list_versions.add(product_info.version)
    
        # Make sure the product and version are in the results
>       assert (
            product in list_products
        ), f"""{product} not found in {package_name}.
        The checker signature or url may be incorrect."""
E       AssertionError: python not found in python3-3.8.2~rc1-1.fc33.aarch64.rpm.
E                 The checker signature or url may be incorrect.
E       assert 'python' in set()

test\test_scanner.py:256: AssertionError

Metadata

Metadata

Assignees

No one assigned

    Labels

    CIRelated to our continuous integration service (GitHub Actions)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions