mirror of
https://github.com/kubernetes/kubernetes.git
synced 2026-05-22 01:48:16 -04:00
apply review comment
This commit is contained in:
parent
bc5302ec93
commit
54fa811dfd
2 changed files with 10 additions and 7 deletions
|
|
@ -491,7 +491,7 @@ func TestDeleteOrEvictWithDryRunServer(t *testing.T) {
|
|||
var allPods []runtime.Object
|
||||
var podsToDelete []corev1.Pod
|
||||
|
||||
for i := 1; i <= 4; i++ {
|
||||
for i := 1; i <= 2; i++ {
|
||||
pod := corev1.Pod{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: fmt.Sprintf("mypod-%d", i),
|
||||
|
|
@ -499,20 +499,19 @@ func TestDeleteOrEvictWithDryRunServer(t *testing.T) {
|
|||
},
|
||||
}
|
||||
allPods = append(allPods, &pod)
|
||||
if i <= 2 {
|
||||
podsToDelete = append(podsToDelete, pod)
|
||||
}
|
||||
podsToDelete = append(podsToDelete, pod)
|
||||
}
|
||||
|
||||
k := fake.NewSimpleClientset(allPods...)
|
||||
|
||||
// fake clientset will actually delete objects from the in-memory store.
|
||||
// This reactor intercepts delete requests with DryRun set and returns success without
|
||||
// removing the object, simulating real API server dry-run behavior.
|
||||
k.PrependReactor("delete", "pods", func(actions ktest.Action) (bool, runtime.Object, error) {
|
||||
deleteAction := actions.(ktest.DeleteAction)
|
||||
if len(deleteAction.GetDeleteOptions().DryRun) > 0 {
|
||||
return true, nil, nil
|
||||
for _, v := range deleteAction.GetDeleteOptions().DryRun {
|
||||
if v == metav1.DryRunAll {
|
||||
return true, nil, nil
|
||||
}
|
||||
}
|
||||
return false, nil, nil
|
||||
})
|
||||
|
|
|
|||
|
|
@ -193,6 +193,10 @@ run_cluster_management_tests() {
|
|||
kube::test::if_has_string "${output_message}" '"Response" verb="GET" url=".*/v1/nodes?labelSelector=test%3Dlabel&limit=500" status="200 OK"'
|
||||
kube::test::if_has_string "${output_message}" '"Response" verb="GET" url=".*/v1/pods?fieldSelector=spec.nodeName%3D127.0.0.1&limit=500" status="200 OK"'
|
||||
|
||||
### kubectl drain with --disable-eviction --dry-run=server completes successfully
|
||||
kubectl drain "127.0.0.1" --force --disable-eviction --dry-run=server
|
||||
kube::test::get_object_assert "pods" "{{range .items}}{{.metadata.name}},{{end}}" 'test-pod-1,test-pod-2,'
|
||||
|
||||
### kubectl cordon command fails when no arguments are passed
|
||||
# Pre-condition: node exists
|
||||
response=$(! kubectl cordon 2>&1)
|
||||
|
|
|
|||
Loading…
Reference in a new issue