ronantakizawa/codereview-bench huggingface dataset:
Repository: kubernetes/kubernetes
File: test/integration/scheduler_perf/scheduler_perf_test.go (Go)

Code before:

// init does nothing.
func (mc *mockDataCollector) init() error {
	return nil
}

// run does nothing.
func (mc *mockDataCollector) run(_ ktesting.TContext) {}

// collect always returns DataItems defined in the collector.
func (mc *mockDataCollector) collect() []DataItem {
	return mc.dataItems
}

func TestMetricThreshold(t *testing.T) {
	testCases := []struct {
		name                                  string
		thresholdValue                        float64
		dataItems                             []DataItem
		thresholdMetricSelector               *thresholdMetricSelector
		expectCollectionFailure               bool
		expectedDataItemsWithThresholdIndices []int
		expectedThresholdName                 string
	}{
		{
			name:           "value is below threshold",
			thresholdValue: 100,
			dataItems: []DataItem{
				{
					Data: map[string]float64{
						"Average": 150,
					},
					Labels: map[string]string{
						"Metric": "throughput",
					},
				},
			},
			thresholdMetricSelector: &thresholdMetricSelector{
				Name:       "throughput",
				DataBucket: "Average",
			},
			expectedDataItemsWithThresholdIndices: []int{0},
			expectedThresholdName:                 "AverageThreshold",
		},
		{
			name:           "value is above threshold",
			thresholdValue: 100,
			dataItems: []DataItem{
				{
					Data: map[string]float64{
						"Average": 70,

Review comment (suggestion):
```suggestion
			name:           "value is above threshold",
```

Code after:
			name: "multiple items failing threshold (ExpectLower=true), should return joined error",
			items: []DataItem{
				{
					Labels: map[string]string{"Metric": "Throughput", "ID": "1"},
					Data:   map[string]float64{"Average": 65},
				},
				{
					Labels: map[string]string{"Metric": "Throughput", "ID": "2"},
					Data:   map[string]float64{"Average": 75},
				},
			},
			threshold: 50,
			selector: thresholdMetricSelector{
				Name:        "Throughput",
				DataBucket:  "Average",
				ExpectLower: true,
			},
			wantErr:  true,
			errCount: 2,
		},
	}

	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			err := applyThreshold(tt.items, tt.threshold, tt.selector)
			if err != nil {
				if !tt.wantErr {
					t.Errorf("Expected no error in applyThreshold, but got: %v", err)
				}
				if tt.errCount > 0 {
					if u, ok := err.(interface{ Unwrap() []error }); ok {
						if len(u.Unwrap()) != tt.errCount {
							t.Errorf("Expected %d errors, got %d", tt.errCount, len(u.Unwrap()))
						}
					} else {
						t.Errorf("Expected joined error with %d errors, got type %T: %v", tt.errCount, err, err)
					}
				}
			} else {
				if tt.wantErr {
					t.Errorf("Expected error %v in applyThreshold, but got nil", tt.wantErr)
				}
			}
		})
	}
}

// mockDataCollector always returns the same data items, to be used for mocking data collector in unit tests.
type mockDataCollector struct {
	dataItems []DataItem
}
Repository: kubernetes/kubernetes
File: test/integration/scheduler_perf/scheduler_perf_test.go (Go)

Code before:
		expectCollectionFailure               bool
		expectedDataItemsWithThresholdIndices []int
		expectedThresholdName                 string
	}{
		{
			name:           "value is below threshold",
			thresholdValue: 100,
			dataItems: []DataItem{
				{
					Data: map[string]float64{
						"Average": 150,
					},
					Labels: map[string]string{
						"Metric": "throughput",
					},
				},
			},
			thresholdMetricSelector: &thresholdMetricSelector{
				Name:       "throughput",
				DataBucket: "Average",
			},
			expectedDataItemsWithThresholdIndices: []int{0},
			expectedThresholdName:                 "AverageThreshold",
		},
		{
			name:           "value is above threshold",
			thresholdValue: 100,
			dataItems: []DataItem{
				{
					Data: map[string]float64{
						"Average": 70,
						"Max":     90,
					},
					Labels: map[string]string{
						"Metric": "throughput",
					},
				},
			},
			thresholdMetricSelector: &thresholdMetricSelector{
				Name:       "throughput",
				DataBucket: "Max",
			},
			expectCollectionFailure:               true,
			expectedDataItemsWithThresholdIndices: []int{0},
			expectedThresholdName:                 "MaxThreshold",
		},
		{
			name:           "no error if the labels do not match",
			thresholdValue: 100,
			dataItems: []DataItem{
				{

Review comment (suggestion):
```suggestion
			name:           "value is below threshold",
```

Code after:
	}

	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			err := applyThreshold(tt.items, tt.threshold, tt.selector)
			if err != nil {
				if !tt.wantErr {
					t.Errorf("Expected no error in applyThreshold, but got: %v", err)
				}
				if tt.errCount > 0 {
					if u, ok := err.(interface{ Unwrap() []error }); ok {
						if len(u.Unwrap()) != tt.errCount {
							t.Errorf("Expected %d errors, got %d", tt.errCount, len(u.Unwrap()))
						}
					} else {
						t.Errorf("Expected joined error with %d errors, got type %T: %v", tt.errCount, err, err)
					}
				}
			} else {
				if tt.wantErr {
					t.Errorf("Expected error %v in applyThreshold, but got nil", tt.wantErr)
				}
			}
		})
	}
}

// mockDataCollector always returns the same data items, to be used for mocking data collector in unit tests.
type mockDataCollector struct {
	dataItems []DataItem
}

// init does nothing.
func (mc *mockDataCollector) init() error {
	return nil
}

// run does nothing.
func (mc *mockDataCollector) run(_ ktesting.TContext) {}

// collect always returns DataItems defined in the collector.
func (mc *mockDataCollector) collect() []DataItem {
	return mc.dataItems
}

func TestMetricThreshold(t *testing.T) {
	testCases := []struct {
		name                                  string
		thresholdValue                        float64
		dataItems                             []DataItem
		thresholdMetricSelector               *thresholdMetricSelector
Repository: kubernetes/kubernetes
File: staging/src/k8s.io/kubectl/pkg/cmd/wait/wait_test.go (Go)

Code before:
`
)

func newUnstructuredList(items ...*unstructured.Unstructured) *unstructured.UnstructuredList {
	list := &unstructured.UnstructuredList{}
	for i := range items {
		list.Items = append(list.Items, *items[i])
	}
	return list
}

func newUnstructured(apiVersion, kind, namespace, name string) *unstructured.Unstructured {
	return &unstructured.Unstructured{
		Object: map[string]interface{}{
			"apiVersion": apiVersion,
			"kind":       kind,
			"metadata": map[string]interface{}{
				"namespace": namespace,
				"name":      name,
				"uid":       "some-UID-value",
			},
		},
	}
}

func newUnstructuredWithGeneration(apiVersion, kind, namespace, name string, generation int64) *unstructured.Unstructured {
	return &unstructured.Unstructured{
		Object: map[string]interface{}{
			"apiVersion": apiVersion,
			"kind":       kind,
			"metadata": map[string]interface{}{
				"namespace":  namespace,
				"name":       name,
				"uid":        "some-UID-value",
				"generation": generation,
			},
		},
	}
}

func newUnstructuredStatus(status *metav1.Status) runtime.Unstructured {
	obj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(status)
	if err != nil {
		panic(err)
	}
	return &unstructured.Unstructured{
		Object: obj,
	}
}

func addCondition(in *unstructured.Unstructured, name, status string) *unstructured.Unstructured {

Review comment (suggestion):
Nit: 
```suggestion
func newUnstructuredWithUID(apiVersion, kind, namespace, name string) *unstructured.Unstructured {
```
might be a better name.

Code after:
`
)

func newUnstructuredList(items ...*unstructured.Unstructured) *unstructured.UnstructuredList {
	list := &unstructured.UnstructuredList{}
	for i := range items {
		list.Items = append(list.Items, *items[i])
	}
	return list
}

func newUnstructured(apiVersion, kind, namespace, name string) *unstructured.Unstructured {
	return &unstructured.Unstructured{
		Object: map[string]interface{}{
			"apiVersion": apiVersion,
			"kind":       kind,
			"metadata": map[string]interface{}{
				"namespace": namespace,
				"name":      name,
				"uid":       "some-UID-value",
			},
		},
	}
}

func newUnstructuredWithNewID(apiVersion, kind, namespace, name string) *unstructured.Unstructured {
	return &unstructured.Unstructured{
		Object: map[string]interface{}{
			"apiVersion": apiVersion,
			"kind":       kind,
			"metadata": map[string]interface{}{
				"namespace": namespace,
				"name":      name,
				"uid":       "some-UID-value-new",
			},
		},
	}
}

func newUnstructuredWithGeneration(apiVersion, kind, namespace, name string, generation int64) *unstructured.Unstructured {
	return &unstructured.Unstructured{
		Object: map[string]interface{}{
			"apiVersion": apiVersion,
			"kind":       kind,
			"metadata": map[string]interface{}{
				"namespace":  namespace,
				"name":       name,
				"uid":        "some-UID-value",
				"generation": generation,
			},
		},
Repository: kubernetes/kubernetes
File: staging/src/k8s.io/kubectl/pkg/describe/describe.go (Go)

Code before:
					printUnstructuredContent(w, level+1, typedChild, skipExpr, skip...)
				default:
					w.Write(level+1, "%v\n", typedChild)
				}
			}

		default:
			skipExpr := fmt.Sprintf("%s.%s", skipPrefix, field)
			if slice.Contains[string](skip, skipExpr, nil) {
				continue
			}
			w.Write(level, "%s:\t%v\n", smartLabelFor(field), typedValue)
		}
	}
}

func smartLabelFor(field string) string {
	// skip creating smart label if field name contains
	// special characters other than '-'
	if strings.IndexFunc(field, func(r rune) bool {
		return !unicode.IsLetter(r) && r != '-'
	}) != -1 {
		return field
	}

	commonAcronyms := []string{"API", "URL", "UID", "OSB", "GUID", "PDB"}
	parts := camelcase.Split(field)

	mergedParts := make([]string, 0, len(parts))
	for i := 0; i < len(parts); i++ {
		part := parts[i]
		if i < len(parts)-1 {
			nextPart := parts[i+1]
			// Merge if current part is 2+ uppercase letters and next starts with uppercase
			allUpper := true
			for _, r := range part {
				if unicode.IsLetter(r) && !unicode.IsUpper(r) {
					allUpper = false
					break
				}
			}
			if len(part) >= 2 && allUpper && len(nextPart) > 0 && unicode.IsUpper(rune(nextPart[0])) {
				mergedParts = append(mergedParts, part+nextPart)
				i++
				continue
			}
		}
		mergedParts = append(mergedParts, part)
	}

	result := make([]string, 0, len(mergedParts))

Review comment (suggestion):
I believe that with your changes to the algorithm below, it's not necessary to expand this list with `PDB` anymore, since you're inspecting and catching two and more consecutive uppercase letters. Ideally, I think this list should contain as little as possible. So let's drop that and it should be good to go. 

Code after:
					printUnstructuredContent(w, level+1, typedChild, skipExpr, skip...)
				default:
					w.Write(level+1, "%v\n", typedChild)
				}
			}

		default:
			skipExpr := fmt.Sprintf("%s.%s", skipPrefix, field)
			if slice.Contains[string](skip, skipExpr, nil) {
				continue
			}
			w.Write(level, "%s:\t%v\n", smartLabelFor(field), typedValue)
		}
	}
}

func smartLabelFor(field string) string {
	// skip creating smart label if field name contains
	// special characters other than '-'
	if strings.IndexFunc(field, func(r rune) bool {
		return !unicode.IsLetter(r) && r != '-'
	}) != -1 {
		return field
	}

	commonAcronyms := []string{"API", "URL", "UID", "OSB", "GUID"}
	parts := camelcase.Split(field)

	mergedParts := make([]string, 0, len(parts))
	for i := 0; i < len(parts); i++ {
		part := parts[i]
		if i < len(parts)-1 {
			nextPart := parts[i+1]
			// Merge if current part is 2+ uppercase letters and next starts with uppercase
			allUpper := true
			for _, r := range part {
				if unicode.IsLetter(r) && !unicode.IsUpper(r) {
					allUpper = false
					break
				}
			}
			if len(part) >= 2 && allUpper && len(nextPart) > 0 && unicode.IsUpper(rune(nextPart[0])) {
				mergedParts = append(mergedParts, part+nextPart)
				i++
				continue
			}
		}
		mergedParts = append(mergedParts, part)
	}

	result := make([]string, 0, len(mergedParts))
Repository: kubernetes/kubernetes
File: pkg/scheduler/framework/runtime/waiting_pods_map.go (Go)

Code before:
	w.mu.RLock()
	defer w.mu.RUnlock()
	for _, timer := range w.pendingPlugins {
		timer.Stop()
	}

	// The select clause works as a non-blocking send.
	// If there is no receiver, it's a no-op (default case).
	select {
	case w.s <- fwk.NewStatus(fwk.Unschedulable, msg).WithPlugin(pluginName):
		return true
	default:
		return false
	}
}

// Preempt declares the waiting pod is preempted. Compared to reject it does not mark the pod as unschedulable,
// allowing it to be rescheduled.
func (w *waitingPod) Preempt(pluginName, msg string) bool {
	w.mu.RLock()
	defer w.mu.RUnlock()
	for _, timer := range w.pendingPlugins {
		timer.Stop()
	}

	// The select clause works as a non-blocking send.
	// If there is no receiver, it's a no-op (default case).
	select {
	case w.s <- fwk.NewStatus(fwk.Error, msg).WithPlugin(pluginName):
		return true
	default:
		return false
	}
}


Review comment (bug):
I'm not sure if this will work as expected. `w.s` is a buffered channel. If the pod is allowed/rejected by some plugin, WaitOnPermit func consumes that message and then Preempt can enqueue the next one and return true (when it should return false). Probably we need an additional field to say whether the Allow/Reject/Permit was called or not.

Code after:
// Reject declares the waiting pod unschedulable.
func (w *waitingPod) Reject(pluginName, msg string) bool {
	return w.stopWithStatus(fwk.Unschedulable, pluginName, msg)
}

// Preempt declares the waiting pod is preempted. Compared to reject it does not mark the pod as unschedulable,
// allowing it to be rescheduled.
func (w *waitingPod) Preempt(pluginName, msg string) bool {
	return w.stopWithStatus(fwk.Error, pluginName, msg)
}

func (w *waitingPod) stopWithStatus(status fwk.Code, pluginName, msg string) bool {
	w.mu.RLock()
	defer w.mu.RUnlock()
	for _, timer := range w.pendingPlugins {
		timer.Stop()
	}

	// The select clause works as a non-blocking send.
	// If there is no place in the buffer, it's a no-op (default case).
	select {
	case w.s <- fwk.NewStatus(status, msg).WithPlugin(pluginName):
	default:
	}
	if w.done {
		return false
	}
	w.done = true
	return true
}
Repository: kubernetes/kubernetes
File: pkg/scheduler/framework/runtime/waiting_pods_map.go (Go)

Code before:
		timer.Stop()
		delete(w.pendingPlugins, pluginName)
	}

	// Only signal success status after all plugins have allowed
	if len(w.pendingPlugins) != 0 {
		return
	}

	// The select clause works as a non-blocking send.
	// If there is no place in the buffer, it's a no-op (default case).
	select {
	case w.s <- fwk.NewStatus(fwk.Success, ""):
	default:
	}
	w.done = true
}

// Reject declares the waiting pod unschedulable.
func (w *waitingPod) Reject(pluginName, msg string) bool {
	w.mu.RLock()
	defer w.mu.RUnlock()
	for _, timer := range w.pendingPlugins {
		timer.Stop()
	}

	// The select clause works as a non-blocking send.
	// If there is no place in the buffer, it's a no-op (default case).
	select {
	case w.s <- fwk.NewStatus(fwk.Unschedulable, msg).WithPlugin(pluginName):
	default:
	}
	if w.done {
		return false
	}
	w.done = true
	return true
}

// Preempt declares the waiting pod is preempted. Compared to reject it does not mark the pod as unschedulable,
// allowing it to be rescheduled.
func (w *waitingPod) Preempt(pluginName, msg string) bool {
	w.mu.RLock()
	defer w.mu.RUnlock()
	for _, timer := range w.pendingPlugins {
		timer.Stop()
	}

	// The select clause works as a non-blocking send.
	// If there is no place in the buffer, it's a no-op (default case).
	select {

Review comment (refactor):
`Preempt` and `Reject` differ in only one line. Could we abstract an auxiliary method that would be leveraged in both of these receiver methods to get rid of code repetition here?

Code after:
		timer.Stop()
		delete(w.pendingPlugins, pluginName)
	}

	// Only signal success status after all plugins have allowed
	if len(w.pendingPlugins) != 0 {
		return
	}

	// The select clause works as a non-blocking send.
	// If there is no place in the buffer, it's a no-op (default case).
	select {
	case w.s <- fwk.NewStatus(fwk.Success, ""):
	default:
	}
	w.done = true
}

// Reject declares the waiting pod unschedulable.
func (w *waitingPod) Reject(pluginName, msg string) bool {
	return w.stopWithStatus(fwk.Unschedulable, pluginName, msg)
}

// Preempt declares the waiting pod is preempted. Compared to reject it does not mark the pod as unschedulable,
// allowing it to be rescheduled.
func (w *waitingPod) Preempt(pluginName, msg string) bool {
	return w.stopWithStatus(fwk.Error, pluginName, msg)
}

func (w *waitingPod) stopWithStatus(status fwk.Code, pluginName, msg string) bool {
	w.mu.RLock()
	defer w.mu.RUnlock()
	for _, timer := range w.pendingPlugins {
		timer.Stop()
	}

	// The select clause works as a non-blocking send.
	// If there is no place in the buffer, it's a no-op (default case).
	select {
	case w.s <- fwk.NewStatus(status, msg).WithPlugin(pluginName):
	default:
	}
	if w.done {
		return false
	}
	w.done = true
	return true
}
Repository: kubernetes/kubernetes
File: pkg/scheduler/framework/runtime/waiting_pods_map_test.go (Go)

Code before:
	}{
		{
			name: "Preempt returns false on allowed pod",
			action: func(wp *waitingPod) bool {
				return wp.Preempt("preemption-plugin", "preempted")
			},
			actionName: "Preempt",
		},
		{
			name: "Reject returns false on allowed pod",
			action: func(wp *waitingPod) bool {
				return wp.Reject("reject-plugin", "rejected")
			},
			actionName: "Reject",
		},
	}

	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			pod := &v1.Pod{
				ObjectMeta: metav1.ObjectMeta{
					Name: "test-pod",
					UID:  "test-uid",
				},
			}
			wp := newWaitingPod(pod, map[string]time.Duration{"plugin1": 10 * time.Second})

			// 1. Simulate Allow from Plugin
			wp.Allow("plugin1")

			// 2. Perform Action
			if success := tt.action(wp); success {
				t.Errorf("Expected %s to return false (failed), but it returned true (success)", tt.actionName)
			}

			// 3. Check what signal the pod received (should be Success from Allow)
			select {
			case status := <-wp.s:
				if !status.IsSuccess() {
					t.Errorf("Expected Pod to stay Allowed (Success), but got status: %v", status)
				}
			default:
				t.Fatal("No status received")
			}
		})
	}
}

func TestWaitingPod_MultipleActions(t *testing.T) {
	pod := &v1.Pod{
		ObjectMeta: metav1.ObjectMeta{

Review comment (suggestion):
Nit - since we don't use `success` below:
```suggestion
			if tt.action(wp) {
```

Code after:
		{
			name: "Preempt returns false on allowed pod",
			action: func(wp *waitingPod) bool {
				return wp.Preempt("preemption-plugin", "preempted")
			},
			actionName: "Preempt",
		},
		{
			name: "Reject returns false on allowed pod",
			action: func(wp *waitingPod) bool {
				return wp.Reject("reject-plugin", "rejected")
			},
			actionName: "Reject",
		},
	}

	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			pod := st.MakePod().Name("test-pod").UID("test-uid").Obj()
			wp := newWaitingPod(pod, map[string]time.Duration{"plugin1": 10 * time.Second})

			// 1. Simulate Allow from Plugin
			wp.Allow("plugin1")

			// 2. Perform Action
			if success := tt.action(wp); success {
				t.Errorf("Expected %s to return false (failed), but it returned true (success)", tt.actionName)
			}

			// 3. Check what signal the pod received (should be Success from Allow)
			select {
			case status := <-wp.s:
				if !status.IsSuccess() {
					t.Errorf("Expected Pod to stay Allowed (Success), but got status: %v", status)
				}
			default:
				t.Fatal("No status received")
			}
		})
	}
}

func TestWaitingPodMultipleActions(t *testing.T) {
	pod := st.MakePod().Name("test-pod").UID("test-uid").Obj()
	wp := newWaitingPod(pod, map[string]time.Duration{"plugin1": 10 * time.Second})
	startWaitOnPermit := make(chan struct{})
	endWaitOnPermit := make(chan struct{})

	// Simulate WaitOnPermit
	go func() {
		close(startWaitOnPermit)
Repository: kubernetes/kubernetes
File: test/integration/scheduler/preemption/preemption_test.go (Go)

Code before:
		if err != nil {
			if apierrors.IsNotFound(err) {
				return false, fmt.Errorf("preemptor pod was deleted")
			}
			return false, err
		}
		_, cond := podutil.GetPodCondition(&p.Status, v1.PodScheduled)
		if cond != nil && cond.Status == v1.ConditionTrue {
			return true, nil
		}
		return false, nil
	})
	if err != nil {
		t.Fatalf("Failed waiting for preemptor validation: %v", err)
	}

	t.Logf("waiting for victim to be rescheduled")
	err = wait.PollUntilContextTimeout(testCtx.Ctx, 100*time.Millisecond, 15*time.Second, false, func(ctx context.Context) (bool, error) {
		v, err := cs.CoreV1().Pods(testCtx.NS.Name).Get(ctx, victim.Name, metav1.GetOptions{})
		if err != nil {
			return false, err
		}
		if v.Spec.NodeName != "" {
			return true, nil
		}
		return false, nil
	})
	if err != nil {
		t.Fatalf("Failed waiting for victim validation: %v", err)
	}

	// Check that preemptor and victim are scheduled on expected nodes: victim on a small node and preemptor on a big node.
	v, err := cs.CoreV1().Pods(testCtx.NS.Name).Get(testCtx.Ctx, victim.Name, metav1.GetOptions{})
	if err != nil {
		t.Fatalf("Error getting victim: %v", err)
	}
	if v.Spec.NodeName != "small-node" {
		t.Fatalf("Victim should be scheduled on small-node, but was scheduled on %s", v.Spec.NodeName)
	}

	p, err := cs.CoreV1().Pods(testCtx.NS.Name).Get(testCtx.Ctx, preemptor.Name, metav1.GetOptions{})
	if err != nil {
		t.Fatalf("Error getting preemptor: %v", err)
	}
	if p.Spec.NodeName != "big-node" {
		t.Fatalf("Preemptor should be scheduled on big-node, but was scheduled on %s", v.Spec.NodeName)
	}
}


Review comment (suggestion):
nit:
```suggestion
		return v.Spec.NodeName != "", nil
```

Code after:
				return false, fmt.Errorf("preemptor pod was deleted")
			}
			return false, err
		}
		return p.Spec.NodeName != "", nil
	})
	if err != nil {
		t.Fatalf("Failed waiting for preemptor validation: %v", err)
	}

	t.Logf("waiting for victim to be rescheduled")
	err = wait.PollUntilContextTimeout(testCtx.Ctx, 100*time.Millisecond, 15*time.Second, false, func(ctx context.Context) (bool, error) {
		v, err := cs.CoreV1().Pods(testCtx.NS.Name).Get(ctx, victim.Name, metav1.GetOptions{})
		if err != nil {
			return false, err
		}
		return v.Spec.NodeName != "", nil
	})
	if err != nil {
		t.Fatalf("Failed waiting for victim validation: %v", err)
	}

	// Check that preemptor and victim are scheduled on expected nodes: victim on a small node and preemptor on a big node.
	v, err := cs.CoreV1().Pods(testCtx.NS.Name).Get(testCtx.Ctx, victim.Name, metav1.GetOptions{})
	if err != nil {
		t.Fatalf("Error getting victim: %v", err)
	}
	if v.Spec.NodeName != "small-node" {
		t.Fatalf("Victim should be scheduled on small-node, but was scheduled on %s", v.Spec.NodeName)
	}

	p, err := cs.CoreV1().Pods(testCtx.NS.Name).Get(testCtx.Ctx, preemptor.Name, metav1.GetOptions{})
	if err != nil {
		t.Fatalf("Error getting preemptor: %v", err)
	}
	if p.Spec.NodeName != "big-node" {
		t.Fatalf("Preemptor should be scheduled on big-node, but was scheduled on %s", p.Spec.NodeName)
	}
}