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

Unit Tests for podchaos #337

Merged
merged 14 commits into from
Mar 16, 2020
Merged

Unit Tests for podchaos #337

merged 14 commits into from
Mar 16, 2020

Conversation

oraluben
Copy link
Contributor

UCP #264

What problem does this PR solve?

#264

What is changed and how does it work?

Check List

Tests

  • Unit test

Code changes

  • Has Go code change

Side effects

Related changes

Does this PR introduce a user-facing change?:

NONE

@sre-bot
Copy link
Contributor

sre-bot commented Mar 12, 2020

Thanks for your contribution. If your PR get merged, you will be rewarded 50 points.

@codecov-io
Copy link

codecov-io commented Mar 12, 2020

Codecov Report

Merging #337 into master will not change coverage by %.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #337   +/-   ##
=======================================
  Coverage   57.91%   57.91%           
=======================================
  Files          58       58           
  Lines        3236     3236           
=======================================
  Hits         1874     1874           
  Misses       1218     1218           
  Partials      144      144           

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 90afc53...44d2857. Read the comment docs.

@oraluben
Copy link
Contributor Author

@fewdan PTAL

Copy link
Member

@fewdan fewdan left a comment

Choose a reason for hiding this comment

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

rest LGTM

// It returns all pods that match the configured label, annotation and namespace selectors.
// If pods are specifically specified by `selector.Pods`, it just returns the selector.Pods.
func SelectPods(ctx context.Context, c client.Client, selector v1alpha1.SelectorSpec) ([]v1.Pod, error) {
func selectPods(ctx context.Context, c client.Client, selector v1alpha1.SelectorSpec) ([]v1.Pod, error) {
Copy link
Member

Choose a reason for hiding this comment

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

'podchaos/podkill/types' and 'podchaos/containerkill/types' all reference this function. So the first letter should be capitalized.

Copy link
Contributor Author

@oraluben oraluben Mar 13, 2020

Choose a reason for hiding this comment

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

As they all share the logic of the existing SelectAndFilterPods, I've replaced the occurrence in 'podchaos/podkill/types' and 'podchaos/containerkill/types' to SelectAndFilterPods, that's why I changed those two function to local in f67765a.

// FilterPodsByMode filters pods by mode from pod list
func FilterPodsByMode(pods []v1.Pod, mode v1alpha1.PodMode, value string) ([]v1.Pod, error) {
// filterPodsByMode filters pods by mode from pod list
func filterPodsByMode(pods []v1.Pod, mode v1alpha1.PodMode, value string) ([]v1.Pod, error) {
Copy link
Member

Choose a reason for hiding this comment

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

ditto

Copy link
Contributor

@lucklove lucklove left a comment

Choose a reason for hiding this comment

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

Rest LGTM

controllers/podchaos/podfailure/podfailure_suite_test.go Outdated Show resolved Hide resolved
controllers/podchaos/podfailure/podfailure_suite_test.go Outdated Show resolved Hide resolved
controllers/podchaos/podkill/podkill_suite_test.go Outdated Show resolved Hide resolved
controllers/podchaos/podkill/podkill_suite_test.go Outdated Show resolved Hide resolved
controllers/timechaos/timechaos_suite_test.go Outdated Show resolved Hide resolved
controllers/timechaos/timechaos_suite_test.go Outdated Show resolved Hide resolved
@oraluben oraluben requested review from lucklove and fewdan March 15, 2020 23:33
Copy link
Contributor

@lucklove lucklove left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@fewdan fewdan left a comment

Choose a reason for hiding this comment

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

LGTM

@zhouqiang-cl
Copy link
Contributor

@cwen0 PTAL too

@cwen0
Copy link
Member

cwen0 commented Mar 16, 2020

/merge

@sre-bot
Copy link
Contributor

sre-bot commented Mar 16, 2020

/run-all-tests

@sre-bot sre-bot merged commit 5f4bbca into chaos-mesh:master Mar 16, 2020
@sre-bot
Copy link
Contributor

sre-bot commented Mar 16, 2020

Team oraluben complete task #264 and get 50 score, currerent score 150

@oraluben oraluben deleted the test-podchaos branch March 16, 2020 04:33
sjwsl pushed a commit to sjwsl/chaos-mesh that referenced this pull request May 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants