Skip to content

Commit

Permalink
Merge pull request #661 from sivanzcw/bugfix
Browse files Browse the repository at this point in the history
Change queue update in cli and e2e test to patch
  • Loading branch information
volcano-sh-bot authored Jan 8, 2020
2 parents 194c441 + 597aaf1 commit 0998b6d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
12 changes: 3 additions & 9 deletions pkg/cli/queue/operate.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (

"github.com/spf13/cobra"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
)

const (
Expand Down Expand Up @@ -84,14 +84,8 @@ func OperateQueue() error {
}

queueClient := versioned.NewForConfigOrDie(config)
queue, err := queueClient.SchedulingV1alpha2().Queues().Get(operateQueueFlags.Name, metav1.GetOptions{})
if err != nil {
return err
}

queue.Spec.Weight = int32(operateQueueFlags.Weight)

_, err = queueClient.SchedulingV1alpha2().Queues().Update(queue)
patchBytes := []byte(fmt.Sprintf(`{"spec":{"weight":%d}}`, operateQueueFlags.Weight))
_, err := queueClient.SchedulingV1alpha2().Queues().Patch(operateQueueFlags.Name, types.MergePatchType, patchBytes)

return err
case "":
Expand Down
10 changes: 3 additions & 7 deletions test/e2e/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,14 +229,10 @@ func deleteQueues(cxt *context) {
foreground := metav1.DeletePropagationForeground

for _, q := range cxt.queues {
queue, err := cxt.vcclient.SchedulingV1alpha2().Queues().Get(q, metav1.GetOptions{})
patchBytes := []byte(fmt.Sprintf(`{"spec":{"state":"%s"}}`, schedulingv1alpha2.QueueStateClosed))
_, err := cxt.vcclient.SchedulingV1alpha2().Queues().Patch(q, types.MergePatchType, patchBytes)
Expect(err).NotTo(HaveOccurred())

queue.Spec.State = schedulingv1alpha2.QueueStateClosed
_, err = cxt.vcclient.SchedulingV1alpha2().Queues().Update(queue)
Expect(err).NotTo(HaveOccurred())

err = wait.Poll(100*time.Millisecond, oneMinute, queueClosed(cxt, queue.Name))
err = wait.Poll(100*time.Millisecond, oneMinute, queueClosed(cxt, q))
Expect(err).NotTo(HaveOccurred())

err = cxt.vcclient.SchedulingV1alpha2().Queues().Delete(q, &metav1.DeleteOptions{
Expand Down

0 comments on commit 0998b6d

Please sign in to comment.