Skip to content

Commit 1f9cf4b

Browse files
Remove test that duplicates logic
Signed-off-by: Rajath Agasthya <ragasthya@nvidia.com>
1 parent b0249cf commit 1f9cf4b

1 file changed

Lines changed: 0 additions & 68 deletions

File tree

controllers/state_manager_test.go

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ package controllers
1919
import (
2020
"testing"
2121

22-
upgrade_v1alpha1 "github.com/NVIDIA/k8s-operator-libs/api/upgrade/v1alpha1"
2322
corev1 "k8s.io/api/core/v1"
2423

2524
gpuv1 "github.com/NVIDIA/gpu-operator/api/nvidia/v1"
@@ -187,70 +186,3 @@ func TestHasMIGCapableGPU(t *testing.T) {
187186
}
188187
}
189188
}
190-
191-
func TestShouldApplyDriverAutoUpgradeAnnotation(t *testing.T) {
192-
tests := []struct {
193-
name string
194-
driverEnabled bool
195-
autoUpgradeEnabled bool
196-
sandboxEnabled bool
197-
wantAnnotation bool
198-
}{
199-
{
200-
name: "driver enabled with auto-upgrade",
201-
driverEnabled: true,
202-
autoUpgradeEnabled: true,
203-
sandboxEnabled: false,
204-
wantAnnotation: true,
205-
},
206-
{
207-
name: "driver disabled with auto-upgrade enabled - should NOT apply annotation",
208-
driverEnabled: false,
209-
autoUpgradeEnabled: true,
210-
sandboxEnabled: false,
211-
wantAnnotation: false,
212-
},
213-
{
214-
name: "driver enabled but auto-upgrade disabled",
215-
driverEnabled: true,
216-
autoUpgradeEnabled: false,
217-
sandboxEnabled: false,
218-
wantAnnotation: false,
219-
},
220-
{
221-
name: "driver enabled with auto-upgrade but sandbox enabled",
222-
driverEnabled: true,
223-
autoUpgradeEnabled: true,
224-
sandboxEnabled: true,
225-
wantAnnotation: false,
226-
},
227-
{
228-
name: "all disabled",
229-
driverEnabled: false,
230-
autoUpgradeEnabled: false,
231-
sandboxEnabled: false,
232-
wantAnnotation: false,
233-
},
234-
}
235-
236-
for _, tc := range tests {
237-
t.Run(tc.name, func(t *testing.T) {
238-
// Create a mock ClusterPolicy
239-
clusterPolicy := &gpuv1.ClusterPolicy{}
240-
clusterPolicy.Spec.Driver.Enabled = &tc.driverEnabled
241-
clusterPolicy.Spec.Driver.UpgradePolicy = &upgrade_v1alpha1.DriverUpgradePolicySpec{
242-
AutoUpgrade: tc.autoUpgradeEnabled,
243-
}
244-
245-
// Simulate the logic from applyDriverAutoUpgradeAnnotation
246-
shouldApply := clusterPolicy.Spec.Driver.IsEnabled() &&
247-
clusterPolicy.Spec.Driver.UpgradePolicy != nil &&
248-
clusterPolicy.Spec.Driver.UpgradePolicy.AutoUpgrade &&
249-
!tc.sandboxEnabled
250-
251-
if shouldApply != tc.wantAnnotation {
252-
t.Errorf("Expected annotation to be applied: %v, but got: %v", tc.wantAnnotation, shouldApply)
253-
}
254-
})
255-
}
256-
}

0 commit comments

Comments
 (0)