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

fix: If the PodList contains extra Pods, the judgment will fail. #229

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/lint-golang.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ jobs:
# ============= upload coverage report
- name: Upload to Codecov
if: ${{ steps.unitest.outcome != 'failure' }}
uses: codecov/codecov-action@v3.1.4
uses: codecov/codecov-action@v4
with:
directory: './'
files: 'coverage.out'
Expand Down
2 changes: 1 addition & 1 deletion framework/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@
if err != nil {
return err
}
_, err = f.DeletePodListUntilReady(podList, timeOut, opts...)
_, err = f.DeletePodListUntilReady(podList, int(*deployment.Spec.Replicas), timeOut, opts...)

Check warning on line 273 in framework/deployment.go

View check run for this annotation

Codecov / codecov/patch

framework/deployment.go#L273

Added line #L273 was not covered by tests
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions framework/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@
}
}

func (f *Framework) DeletePodListUntilReady(podList *corev1.PodList, timeOut time.Duration, opts ...client.DeleteOption) (*corev1.PodList, error) {
func (f *Framework) DeletePodListUntilReady(podList *corev1.PodList, expectedPodNum int, timeOut time.Duration, opts ...client.DeleteOption) (*corev1.PodList, error) {

Check warning on line 295 in framework/pod.go

View check run for this annotation

Codecov / codecov/patch

framework/pod.go#L295

Added line #L295 was not covered by tests
if podList == nil {
return nil, ErrWrongInput
}
Expand Down Expand Up @@ -321,7 +321,7 @@
continue
}

if len(podListWithLabel.Items) != len(podList.Items) {
if len(podListWithLabel.Items) == 0 || len(podListWithLabel.Items) != expectedPodNum {

Check warning on line 324 in framework/pod.go

View check run for this annotation

Codecov / codecov/patch

framework/pod.go#L324

Added line #L324 was not covered by tests
continue
}

Expand Down
Loading