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

Mock for resource.ClientApplicator #178

Closed
muvaf opened this issue May 8, 2020 · 3 comments
Closed

Mock for resource.ClientApplicator #178

muvaf opened this issue May 8, 2020 · 3 comments
Labels
enhancement New feature or request stale wontfix This will not be worked on

Comments

@muvaf
Copy link
Member

muvaf commented May 8, 2020

What problem are you facing?

Currently, we're able to use fake.MockClient and its functions to mock the controller-runtime client. However, there is no mock ClientApplicator, which makes it hard to replace Apply with a function that returns given error.

How could Crossplane help solve your problem?

Expand MockClient or implement a MockClientApplicator.

@muvaf muvaf added the enhancement New feature or request label May 8, 2020
@negz
Copy link
Member

negz commented May 8, 2020

iirc ClientApplicator is a struct that embeds the Client and Applicator interfaces, so I usually just write something like:

ca := resource.ClientApplicator{
    Client: &test.MockClient{
        MockGetFn: func(...) error { return nil }
    },
    Applicator: resource.ApplyFn(func(...) error { return nil }),
}

Would a mock make this much easier? I imagine you'd end up needing about the same amount of typing to get it all setup.

@stale
Copy link

stale bot commented Aug 13, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Aug 13, 2022
Copy link

github-actions bot commented Sep 5, 2024

Crossplane does not currently have enough maintainers to address every issue and pull request. This issue has been automatically marked as stale because it has had no activity in the last 90 days. It will be closed in 14 days if no further activity occurs. Leaving a comment starting with /fresh will mark this issue as not stale.

@github-actions github-actions bot added the stale label Sep 5, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request stale wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants