coreos-assembler icon indicating copy to clipboard operation
coreos-assembler copied to clipboard

podman.workflow test incorrect parsing of `podman rmi` output

Open dustymabe opened this issue 7 months ago • 4 comments

Yields results in the logs of tests that looks like:

--- PASS: podman.workflow (367.30s)                                                           
    --- PASS: podman.workflow/run (306.45s)                                                   
            cluster.go:151: Trying to pull quay.io/fedora/fedora:latest...                    
            cluster.go:151: Getting image source signatures                                   
            cluster.go:151: Copying blob sha256:2d1766c96a03a5c0d88cb51417d01b1a11e0245c6c8a5dfe48a8a1629d64e8fc
            cluster.go:151: Copying config sha256:818c0c393dd42bdb323b3344c8a3db27597e00d8dc342e8253aa2838b1d5b570
            cluster.go:151: Writing manifest to image destination                             
    --- PASS: podman.workflow/exec (0.37s)                                                    
    --- PASS: podman.workflow/stop (10.57s)                                                   
    --- PASS: podman.workflow/remove (0.34s)                                                  
    --- PASS: podman.workflow/delete (0.42s)                                                  
            cluster.go:151: grep: quay.io/fedora/fedora:latest: No such file or directory     
            cluster.go:151: bash: line 2: Deleted:: command not found

Basically the code isn't parsing the outupt of podman rmi correctly any longer (podman must have changed).

[dustymabe@media ~]$ podman rmi quay.io/fedora-testing/fedora-bootc:rawhide-minimal
Untagged: quay.io/fedora-testing/fedora-bootc:rawhide-minimal
Deleted: 34871ba538d55e6c5f9e5e932c8810546f01fdaca9a6e41e84fda0c99fc00ce2

dustymabe avatar May 07 '25 20:05 dustymabe

I will take this on and look over it in the next few days.

nbspsemicolon avatar May 09 '25 02:05 nbspsemicolon

Is there any particular steps I'm missing to get pytests set up, outside of satisfying test-requirements.txt? I didn't see anything regarding a local venv in makefile/jenkinsfile/etc

make pycheck is dumping on:

************* Module cosalib.cmdlib
src/cosalib/cmdlib.py:31:0: E0611: No name 'RpmOstree' in module 'gi.repository' (no-name-in-module)
************* Module cosalib.fedora_messaging_request
src/cosalib/fedora_messaging_request.py:18:0: E0401: Unable to import 'fedora_messaging' (import-error)
src/cosalib/fedora_messaging_request.py:19:0: E0401: Unable to import 'fedora_messaging.api' (import-error)
src/cosalib/fedora_messaging_request.py:20:0: E0401: Unable to import 'fedora_messaging.config' (import-error)
src/cosalib/fedora_messaging_request.py:22:0: E0401: Unable to import 'twisted.internet' (import-error)
************* Module cmd-basearch
src/cmd-basearch:6:0: E0611: No name 'RpmOstree' in module 'gi.repository' (no-name-in-module)
************* Module kola-junit
src/kola-junit:14:0: E0401: Unable to import 'junit_xml' (import-error)
************* Module manifest_graph
src/manifest_graph:13:0: E0401: Unable to import 'anytree' (import-error)
************* Module resultsdb-report
src/resultsdb-report:11:0: E0401: Unable to import 'resultsdb_api' (import-error)
src/resultsdb-report:12:0: E0401: Unable to import 'resultsdb_conventions.fedora' (import-error)
make: *** [Makefile:58: pycheck] Error 2

and make unittest is not entirely pleased with:

COSA_TEST_META_PATH=`pwd`/fixtures \
        PYTHONPATH=`pwd`/src python3 -m pytest tests/
==================================================== test session starts ====================================================
platform linux -- Python 3.13.3, pytest-8.3.4, pluggy-1.5.0
rootdir: /home/neil/src/coreos/coreos-assembler
configfile: pytest.ini
plugins: cov-5.0.0
collected 0 items / 3 errors                                                                                                

========================================================== ERRORS ===========================================================
____________________________________________ ERROR collecting tests/test_cli.py _____________________________________________
tests/test_cli.py:7: in <module>
    from cosalib.cli import Cli, BuildCli
src/cosalib/cli.py:8: in <module>
    from cosalib import (
src/cosalib/aliyun.py:5: in <module>
    from cosalib.cmdlib import runcmd
src/cosalib/cmdlib.py:30: in <module>
    gi.require_version("RpmOstree", "1.0")
/usr/lib64/python3.13/site-packages/gi/__init__.py:122: in require_version
    raise ValueError('Namespace %s not available' % namespace)
E   ValueError: Namespace RpmOstree not available
_______________________________________ ERROR collecting tests/test_cosalib_cmdlib.py _______________________________________
tests/test_cosalib_cmdlib.py:11: in <module>
    from cosalib import cmdlib
src/cosalib/cmdlib.py:30: in <module>
    gi.require_version("RpmOstree", "1.0")
/usr/lib64/python3.13/site-packages/gi/__init__.py:122: in require_version
    raise ValueError('Namespace %s not available' % namespace)
E   ValueError: Namespace RpmOstree not available
________________________________________ ERROR collecting tests/test_cosalib_meta.py ________________________________________
tests/test_cosalib_meta.py:11: in <module>
    from cosalib import meta
src/cosalib/meta.py:6: in <module>
    from cosalib.builds import Builds
src/cosalib/builds.py:13: in <module>
    from cosalib.cmdlib import (
src/cosalib/cmdlib.py:30: in <module>
    gi.require_version("RpmOstree", "1.0")
/usr/lib64/python3.13/site-packages/gi/__init__.py:122: in require_version
    raise ValueError('Namespace %s not available' % namespace)
E   ValueError: Namespace RpmOstree not available

---------- coverage: platform linux, python 3.13.3-final-0 -----------
Name                    Stmts   Miss  Cover
-------------------------------------------
src/cosalib/cli.py         41     37    10%
src/cosalib/cmdlib.py     262    245     6%
src/cosalib/meta.py       124    119     4%
-------------------------------------------
TOTAL                     427    401     6%

================================================== short test summary info ==================================================
ERROR tests/test_cli.py - ValueError: Namespace RpmOstree not available
ERROR tests/test_cosalib_cmdlib.py - ValueError: Namespace RpmOstree not available
ERROR tests/test_cosalib_meta.py - ValueError: Namespace RpmOstree not available
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 3 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
===================================================== 3 errors in 0.35s =====================================================
make: *** [Makefile:68: unittest] Error 2

nbspsemicolon avatar May 13 '25 18:05 nbspsemicolon

I think the tests are usually run inside the COSA container after it's been built: i.e.

podman build -t localhost/coreos-assembler:latest .

Then:

podman run -it --rm --userns keep-id:uid=1000,gid=1000 --entrypoint /bin/bash -v ./:/src:Z --workdir /src/ localhost/coreos-assembler:latest
make flake8 unittest pycheck

dustymabe avatar May 13 '25 19:05 dustymabe

#4104 has the pull request. I will figure out github's nuances at some point.

nbspsemicolon avatar May 14 '25 01:05 nbspsemicolon