Skip to content

Commit

Permalink
fix: If the PodList contains extra Pods, the judgment will fail.
Browse files Browse the repository at this point in the history
Signed-off-by: tao.yang <[email protected]>
  • Loading branch information
ty-dc committed Aug 5, 2024
1 parent 71bf7b1 commit 27794c4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
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 @@ func (f *Framework) RestartDeploymentPodUntilReady(deployName, namespace string,
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) DeletePodListRepeatedly(label map[string]string, interval ti
}
}

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 @@ OUTER:
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

0 comments on commit 27794c4

Please sign in to comment.