Skip to content

Implement missing methods in changesetResolver and add ChangesetStats

Administrator requested to merge mrn/changesets-resolvers into main

Created by: mrnugget

Note to reviewers: sorry about the diff! I split up some files (example: resolvers/changesets.go into resolvers/changeset.go and resolvers/changeset_connection.go), removed old test data and old commented out tests. That makes it a bit hard to review, but I think this structure is much easier to manage in the future.

This PR fixes #12642, #12648 and #12646 by:

  • Reviving the old commented out resolvers.TestCampaigns test, but not in a single test, but more manageable in the form of multiple tests: TestCampaignResolver, TestChangesetResolver, TestChangesetConnectionResolver.
  • Implementing the ChangesetConnectionStats, including repository permissions (see permissions_test.go).
  • Remove all the TODOs and broken stuff in the changesetResolver that was introduced when we said that a changeset can now exist in an unpublished state.

Now we have a much more solid and extensible layer of resolver tests, IMHO, that we can expand in the future. My goal here was not to go for 100% test coverage, but to test 70-80% and leave a structure that allows filling in more test cases (for merged changesets, for Bitbucket Server/Gitlab changesets, etc.)

In order to make the tests less noisy I copied over the helpers I used in service_test.go — is there a way we can de-duplicate those without running into import cycles? cc @LawnGnome

Merge request reports

Loading