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

fakeClient Delete and DeleteAllOf functions do not check for dry run options #1871

Closed
everettraven opened this issue Apr 20, 2022 · 0 comments · Fixed by #1873
Closed

fakeClient Delete and DeleteAllOf functions do not check for dry run options #1871

everettraven opened this issue Apr 20, 2022 · 0 comments · Fixed by #1873

Comments

@everettraven
Copy link
Contributor

Problem

When using a fakeClient returned via fake.NewClientBuilder().Build() as a parameter to NewDryRunClient() I noticed that calls to the resulting dryRunClient's Delete() still deleted the resources instead of honoring the metav1.DryRunAll option.

A brief example of what my setup looks like:

fakeClient := fake.NewClientBuilder().Build()
dryRunClient := client.NewDryRunClient(fakeClient)

// This still deletes the objects passed in
dryRunClient.Delete(ctx, object)

This lead me to take a look at the source code for the fakeClient CRUD functions. I noticed that this snippet (or ones similar to it):

for _, dryRunOpt := range createOptions.DryRun {
	if dryRunOpt == metav1.DryRunAll {
		return nil
	}
}

are present in the following functions:

Proposed Solution

I am proposing that code is added to the fakeClient Delete() and DeleteAllOf() functions similar to the ones that exist in the above mentioned functions.

I am happy to take on the development work for this if the proposed solution is accepted.

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 a pull request may close this issue.

1 participant