Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ProviderManager, make provider deletion generic #3162

Merged
merged 5 commits into from
Apr 25, 2024
Merged

Conversation

dmjb
Copy link
Contributor

@dmjb dmjb commented Apr 24, 2024

Relates to #2845

Change the ProviderFactory to ProviderManager. Add new method for deleting provider instances. This hides provider-specific cleanup behind an appropriate interface, and removes some duplication of logic (with slightly different implementations) in different parts of the codebase.

Most of the code changes relate to wiring this new logic into the rest of the codebase and replacing what was there.

Summary

Provide a brief overview of the changes and the issue being addressed.
Explain the rationale and any background necessary for understanding the changes.
List dependencies required by this change, if any.

Fixes #(related issue)

Change Type

Mark the type of change your PR introduces:

  • Bug fix (resolves an issue without affecting existing features)
  • Feature (adds new functionality without breaking changes)
  • Breaking change (may impact existing functionalities or require documentation updates)
  • Documentation (updates or additions to documentation)
  • Refactoring or test improvements (no bug fixes or new functionality)

Testing

Outline how the changes were tested, including steps to reproduce and any relevant configurations.
Attach screenshots if helpful.

Review Checklist:

  • Reviewed my own code for quality and clarity.
  • Added comments to complex or tricky code sections.
  • Updated any affected documentation.
  • Included tests that validate the fix or feature.
  • Checked that related changes are merged.

Relates to #2845

Change the `ProviderFactory` to `ProviderManager`. Add new method for
deleting provider instances. This hides provider-specific cleanup behind
an appropriate interface, and removes some duplication of logic (with
slightly different implementations) in different parts of the codebase.
@@ -38,7 +38,7 @@ func CleanUpUnmanagedProjects(
proj uuid.UUID,
querier db.Querier,
authzClient authz.Client,
providerService service.GitHubProviderService,
providerManager manager.ProviderManager,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In future, I might investigate creating a ProjectService or similar - right now we end up having to pass around a bunch of dependencies through the controlplane for the project creation logic.

@coveralls
Copy link

coveralls commented Apr 24, 2024

Coverage Status

coverage: 50.119% (+0.4%) from 49.754%
when pulling 6b3d6d3 on provider-manager
into 7f25653 on main.

@eleftherias
Copy link
Contributor

This is nice! I haven't tested manually, but the code is looking good. Is there anything in particular you're looking for to take this out of draft?

@dmjb
Copy link
Contributor Author

dmjb commented Apr 24, 2024

@eleftherias I need to add some test coverage, and also do some manual verification of the changes.

@@ -22,6 +22,7 @@ import (
"github.com/google/uuid"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I decided to reuse these test cases to test the deletion codepath in GitHubProviderClassManager

@dmjb dmjb marked this pull request as ready for review April 24, 2024 15:53
@dmjb dmjb requested a review from a team as a code owner April 24, 2024 15:53
Copy link
Contributor

@eleftherias eleftherias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran some manual testing, everything is working as expected.

@dmjb dmjb merged commit cea2520 into main Apr 25, 2024
20 checks passed
@dmjb dmjb deleted the provider-manager branch April 25, 2024 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants