Skip to content

Fix MRTarget equality comparison #3173

Description

@rgetz

What happened? What is the problem?

Not when using things, but when I was looking at the code base, I noticed the MRTarget.__eq__() implementation in packit_service/config.py appears to contain a typo (copy/paste issue?) that causes the branch comparison to always evaluate as true.

The current implementation is:

return self.repo == other.repo and self.branch == self.branch

The second comparison should presumably compare against other.branch (or be removed since it's always true).

Either tests of:

def test_mr_target_equality():
    target = MRTarget("packit-service/src/.+", "rawhide")

    assert target == MRTarget("packit-service/src/.+", "rawhide")
    assert target != MRTarget("packit-service/src/.+", "c9s")
    assert target != MRTarget("other/src/.+", "rawhide")

or by augmenting the existing tests to add something like:

assert MRTarget("packit-service/src/.+", "not-c9s") not in config.gitlab_mr_targets_handled

I think both would fail with the current broken implementation and pass after the fix.

What did you expect to happen?

No response

Example URL(s)

No response

Steps to reproduce

What is the impacted category (job)?

General

Workaround

  • There is an existing workaround that can be used until this issue is fixed.

Participation

  • I am willing to submit a pull request for this issue. (Packit team is happy to help!)

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/configRelated to the configurationarea/gitlabGitLab-forge relatedcomplexity/single-taskRegular task; should be done within daysgain/lowDoesn't bring much value to usersimpact/lowAffects only few of the userskind/bugAn unexpected problem or behavior

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions