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

Genericize and consolidate kubectl delete operations #198

Merged

Conversation

jinnovation
Copy link
Collaborator

Relates to #69.

Currently, we define one function for delete-ing all entities of a given resource type, for each of a finite set of resources, e.g. k8s-kubectl-delete-{pods, nodes, ...}. All of these functions are identical save for the resource type that they retrieve.

As such, we generalize to a single implementation—k8s-kubectl-delete—that accepts the resource type name and performs the delete accordingly.

We additionally clean up unit tests and, finally, remove the granular, per-type get functions.

In particular, with regards to unit tests, we observe that, once the resource type name is abstracted away, there's no practical reason to have one test case for each resource type. As such, rather than consolidate all per-type test cases into a single test function, we simply keep one case for each of the two scenarios "delete success" and "delete fail," and remove the rest of the test functions as superfluous.

@codecov-commenter
Copy link

codecov-commenter commented Aug 26, 2021

Codecov Report

Merging #198 (23a0c75) into master (96d9a6f) will decrease coverage by 0.66%.
The diff coverage is 16.12%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #198      +/-   ##
==========================================
- Coverage   43.60%   42.94%   -0.67%     
==========================================
  Files          28       28              
  Lines        1509     1474      -35     
==========================================
- Hits          658      633      -25     
+ Misses        851      841      -10     
Impacted Files Coverage Δ
kubernetes-configmaps.el 0.00% <0.00%> (ø)
kubernetes-deployments.el 0.00% <0.00%> (ø)
kubernetes-ingress.el 0.00% <0.00%> (ø)
kubernetes-jobs.el 19.35% <0.00%> (ø)
kubernetes-pods.el 10.71% <0.00%> (ø)
kubernetes-secrets.el 0.00% <0.00%> (ø)
kubernetes-services.el 0.00% <0.00%> (ø)
kubernetes-statefulsets.el 0.00% <0.00%> (ø)
kubernetes-kubectl.el 87.85% <100.00%> (+4.04%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 96d9a6f...23a0c75. Read the comment docs.

Copy link
Collaborator

@noorul noorul left a comment

Choose a reason for hiding this comment

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

Great!

@jinnovation jinnovation merged commit 87e6de1 into kubernetes-el:master Aug 26, 2021
@jinnovation jinnovation deleted the jjin/genericize-kubectl-delete branch August 26, 2021 19:00
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.

None yet

3 participants