oamg / leapp-repository

Leapp repositories containing actors for the Leapp framework (https://github.com/oamg/leapp). Currently provides leapp repositories for in-place upgrades of RHEL systems.
Apache License 2.0
52 stars 146 forks source link

Unit tests for Left over packages actors and move to common repo #1199

Closed tomasfratrik closed 2 months ago

tomasfratrik commented 6 months ago

Add unit tests for leftover packages actors Actors:

Jira: OAMG-1254

github-actions[bot] commented 6 months ago

Thank you for contributing to the Leapp project!

Please note that every PR needs to comply with the Leapp Guidelines and must pass all tests in order to be mergeable. If you want to request a review or rebuild a package in copr, you can use following commands as a comment:

Packit will automatically schedule regression tests for this PR's build and latest upstream leapp build. If you need a different version of leapp, e.g. from PR#42, use /packit test oamg/leapp#42 Note that first time contributors cannot run tests automatically - they will be started by a reviewer.

It is possible to schedule specific on-demand tests as well. Currently 2 test sets are supported, beaker-minimal and kernel-rt, both can be used to be run on all upgrade paths or just a couple of specific ones. To launch on-demand tests with packit:

See other labels for particular jobs defined in the .packit.yaml file.

Please open ticket in case you experience technical problem with the CI. (RH internal only)

Note: In case there are problems with tests not being triggered automatically on new PR/commit or pending for a long time, please contact leapp-infra.

tomasfratrik commented 4 months ago

/packit test

matejmatuska commented 3 months ago

/packit retest-failed

tomasfratrik commented 2 months ago

I removed ExperimentalTag from remove_leftover_packages actor, otherwise the actor wouldn't be called. Now to testing upgrade with the actors: When upgrading kernel is automatically leftover package, Correct remove: (only snippets, can provide full logs) check_leftover_packages and remove_leftoverpackages(1 item from list):

       {
            "arch": "x86_64",
            "epoch": "0",
            "module": null,
            "name": "kernel",
            "packager": "Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>",
            "pgpsig": "RSA/SHA256, Sat 11 May 2024 03:46:09 PM UTC, Key ID 199e2f91fd431d51",
            "release": "553.el8_10",
            "repository": null,
            "stream": null,
            "version": "4.18.0"
        },

report_leftover_packages:

{
    "report": "{\"audience\": \"sysadmin\", \"detail\": {\"related_resources\": [{\"scheme\": \"package\", \"title\": \"kernel-core\"}, {\"scheme\": \"package\", \"title\": \"aspell\"}, {\"scheme\": \"package\", \"title\": \"libmodman\"}, {\"scheme\": \"package\", \"title\": \"kernel-modules\"}, {\"scheme\": \"package\", \"title\": \"kernel\"}]}, \"groups\": [\"sanity\"], \"key\": \"5afbad560709afa4e40a160e40dfd44788ba9c3b\", \"severity\": \"high\", \"summary\": \"Following packages have been removed:\\n    - kernel-core-4.18.0-553.el8_10\\n    - aspell-0.60.6.1-22.el8\\n    - libmodman-2.0.1-17.el8\\n    - kernel-modules-4.18.0-553.el8_10\\n    - kernel-4.18.0-553.el8_10\\nDependent packages may have been removed as well, please check that you are not missing any packages.\", \"title\": \"Leftover RHEL packages have been removed\"}"
}

while this remove command run:

2024-08-12 14:49:20.410 DEBUG    PID: 43734 leapp.workflow.RPMUpgrade.remove_leftover_packages: External command has started: ['dnf', 'remove', '-y', '--noautoremove', 'kernel-4.18.0-553.el8_10', 'aspell-0.60.6.1-22.el8', 'kernel-modules-4.18.0-553.el8_10', 'libmodman-2.0.1-17.el8', 'kernel-core-4.18.0-553.el8_10', '--disableplugin', 'subscription-manager']
2024-08-12 14:49:24.328 DEBUG    PID: 43734 leapp.workflow.RPMUpgrade.remove_leftover_packages: External command has finished: ['dnf', 'remove', '-y', '--noautoremove', 'kernel-4.18.0-553.el8_10', 'aspell-0.60.6.1-22.el8', 'kernel-modules-4.18.0-553.el8_10', 'libmodman-2.0.1-17.el8', 'kernel-core-4.18.0-553.el8_10', '--disableplugin', 'subscription-manager']

Upgrade with dnf command failing This was done by forcefully raising CalledProcessError() before run dnf command. check_leftover_packages is the same as before, remove_leftover_packages has no message produced. report_leftover_packages:

{
    "report": "{\"audience\": \"sysadmin\", \"detail\": {\"related_resources\": [{\"scheme\": \"package\", \"title\": \"kernel\"}, {\"scheme\": \"package\", \"title\": \"aspell\"}, {\"scheme\": \"package\", \"title\": \"kernel-modules\"}, {\"scheme\": \"package\", \"title\": \"libmodman\"}, {\"scheme\": \"package\", \"title\": \"kernel-core\"}]}, \"groups\": [\"sanity\"], \"key\": \"d424c3132ed78a8632b5c73d919909e453107c06\", \"severity\": \"high\", \"summary\": \"Following RHEL packages have not been upgraded:\\n    - kernel-4.18.0-553.el8_10\\n    - aspell-0.60.6.1-22.el8\\n    - kernel-modules-4.18.0-553.el8_10\\n    - libmodman-2.0.1-17.el8\\n    - kernel-core-4.18.0-553.el8_10Please remove these packages to keep your system in supported state.\", \"title\": \"Some RHEL packages have not been upgraded\"}"
}
pirat89 commented 2 months ago

@tomasfratrik I removed ExperimentalTag from remove_leftover_packages actor, otherwise the actor wouldn't be called.

it can be used --whitelist-experimental option to allow particular experimental actors. In this case e.g.:

# LEAPP_UNSUPPORTED=1 leapp upgrade --whitelist-experimental=remove_leftover_packages
tomasfratrik commented 2 months ago

@tomasfratrik I removed ExperimentalTag from remove_leftover_packages actor, otherwise the actor wouldn't be called.

it can be used --whitelist-experimental option to allow particular experimental actors. In this case e.g.:

# LEAPP_UNSUPPORTED=1 leapp upgrade --whitelist-experimental=remove_leftover_packages

Ah thanks!. So I get it that it is right without it.

tomasfratrik commented 2 months ago

I also tested latest changes with upgrade and outputs don't differ to previous ones.

tomasfratrik commented 2 months ago

/packit test

tomasfratrik commented 2 months ago

The latest push just squashed commits.

pirat89 commented 2 months ago

/packit copr-build

pirat89 commented 2 months ago

@tomasfratrik I removed ExperimentalTag from remove_leftover_packages actor, otherwise the actor wouldn't be called.

it can be used --whitelist-experimental option to allow particular experimental actors. In this case e.g.:

# LEAPP_UNSUPPORTED=1 leapp upgrade --whitelist-experimental=remove_leftover_packages

Ah thanks!. So I get it that it is right without it.

I think we had a misunderstanding here. it must not be executed without the flag.

tomasfratrik commented 2 months ago

The last push is squash of commits.

pirat89 commented 2 months ago

/packit copr-build

pirat89 commented 2 months ago

merged! good job!