@@ -28,7 +28,7 @@ import (
28
28
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
29
29
"k8s.io/apimachinery/pkg/types"
30
30
"k8s.io/apimachinery/pkg/util/sets"
31
- "k8s.io/kubernetes/pkg/kubelet/cm/dra/state"
31
+ "k8s.io/kubernetes/pkg/kubelet/cm/dra/state/checkpoint/v1alpha1 "
32
32
)
33
33
34
34
// ClaimInfo test cases
@@ -48,13 +48,13 @@ const (
48
48
)
49
49
50
50
var (
51
- device = state .Device {
51
+ device = v1alpha1 .Device {
52
52
PoolName : poolName ,
53
53
DeviceName : deviceName ,
54
54
RequestNames : []string {requestName },
55
55
CDIDeviceIDs : []string {cdiID },
56
56
}
57
- devices = []state .Device {device }
57
+ devices = []v1alpha1 .Device {device }
58
58
)
59
59
60
60
func TestNewClaimInfoFromClaim (t * testing.T ) {
@@ -97,12 +97,12 @@ func TestNewClaimInfoFromClaim(t *testing.T) {
97
97
},
98
98
},
99
99
expectedResult : & ClaimInfo {
100
- ClaimInfoState : state .ClaimInfoState {
100
+ ClaimInfoState : v1alpha1 .ClaimInfoState {
101
101
ClaimUID : claimUID ,
102
102
ClaimName : claimName ,
103
103
Namespace : namespace ,
104
104
PodUIDs : sets .New [string ](),
105
- DriverState : map [string ]state .DriverState {
105
+ DriverState : map [string ]v1alpha1 .DriverState {
106
106
driverName : {},
107
107
},
108
108
},
@@ -123,12 +123,12 @@ func TestNewClaimInfoFromClaim(t *testing.T) {
123
123
Spec : resourceapi.ResourceClaimSpec {},
124
124
},
125
125
expectedResult : & ClaimInfo {
126
- ClaimInfoState : state .ClaimInfoState {
126
+ ClaimInfoState : v1alpha1 .ClaimInfoState {
127
127
ClaimUID : claimUID ,
128
128
ClaimName : claimName ,
129
129
Namespace : namespace ,
130
130
PodUIDs : sets .New [string ](),
131
- DriverState : map [string ]state .DriverState {},
131
+ DriverState : map [string ]v1alpha1 .DriverState {},
132
132
},
133
133
prepared : false ,
134
134
},
@@ -149,29 +149,29 @@ func TestNewClaimInfoFromClaim(t *testing.T) {
149
149
func TestNewClaimInfoFromState (t * testing.T ) {
150
150
for _ , test := range []struct {
151
151
description string
152
- state * state .ClaimInfoState
152
+ state * v1alpha1 .ClaimInfoState
153
153
expectedResult * ClaimInfo
154
154
}{
155
155
{
156
156
description : "successfully created object" ,
157
- state : & state .ClaimInfoState {
157
+ state : & v1alpha1 .ClaimInfoState {
158
158
ClaimUID : claimUID ,
159
159
ClaimName : claimName ,
160
160
Namespace : namespace ,
161
161
PodUIDs : sets.New [string ](podUID ),
162
- DriverState : map [string ]state .DriverState {
162
+ DriverState : map [string ]v1alpha1 .DriverState {
163
163
driverName : {
164
164
Devices : devices ,
165
165
},
166
166
},
167
167
},
168
168
expectedResult : & ClaimInfo {
169
- ClaimInfoState : state .ClaimInfoState {
169
+ ClaimInfoState : v1alpha1 .ClaimInfoState {
170
170
ClaimUID : claimUID ,
171
171
ClaimName : claimName ,
172
172
Namespace : namespace ,
173
173
PodUIDs : sets.New [string ](podUID ),
174
- DriverState : map [string ]state .DriverState {
174
+ DriverState : map [string ]v1alpha1 .DriverState {
175
175
driverName : {
176
176
Devices : devices ,
177
177
},
@@ -194,12 +194,12 @@ func TestClaimInfoAddDevice(t *testing.T) {
194
194
for _ , test := range []struct {
195
195
description string
196
196
claimInfo * ClaimInfo
197
- device state .Device
197
+ device v1alpha1 .Device
198
198
}{
199
199
{
200
200
description : "add new device" ,
201
201
claimInfo : & ClaimInfo {
202
- ClaimInfoState : state .ClaimInfoState {
202
+ ClaimInfoState : v1alpha1 .ClaimInfoState {
203
203
ClaimUID : claimUID ,
204
204
ClaimName : claimName ,
205
205
Namespace : namespace ,
@@ -212,14 +212,14 @@ func TestClaimInfoAddDevice(t *testing.T) {
212
212
{
213
213
description : "other new device" ,
214
214
claimInfo : & ClaimInfo {
215
- ClaimInfoState : state .ClaimInfoState {
215
+ ClaimInfoState : v1alpha1 .ClaimInfoState {
216
216
ClaimUID : claimUID ,
217
217
ClaimName : claimName ,
218
218
Namespace : namespace ,
219
219
PodUIDs : sets.New [string ](podUID ),
220
220
},
221
221
},
222
- device : func () state .Device {
222
+ device : func () v1alpha1 .Device {
223
223
device := device
224
224
device .PoolName += "-2"
225
225
device .DeviceName += "-2"
@@ -231,7 +231,7 @@ func TestClaimInfoAddDevice(t *testing.T) {
231
231
} {
232
232
t .Run (test .description , func (t * testing.T ) {
233
233
test .claimInfo .addDevice (driverName , test .device )
234
- assert .Equal (t , []state .Device {test .device }, test .claimInfo .DriverState [driverName ].Devices )
234
+ assert .Equal (t , []v1alpha1 .Device {test .device }, test .claimInfo .DriverState [driverName ].Devices )
235
235
})
236
236
}
237
237
}
@@ -245,7 +245,7 @@ func TestClaimInfoAddPodReference(t *testing.T) {
245
245
{
246
246
description : "empty PodUIDs list" ,
247
247
claimInfo : & ClaimInfo {
248
- ClaimInfoState : state .ClaimInfoState {
248
+ ClaimInfoState : v1alpha1 .ClaimInfoState {
249
249
PodUIDs : sets .New [string ](),
250
250
},
251
251
},
@@ -254,7 +254,7 @@ func TestClaimInfoAddPodReference(t *testing.T) {
254
254
{
255
255
description : "first pod reference" ,
256
256
claimInfo : & ClaimInfo {
257
- ClaimInfoState : state .ClaimInfoState {
257
+ ClaimInfoState : v1alpha1 .ClaimInfoState {
258
258
PodUIDs : sets.New [string ](podUID ),
259
259
},
260
260
},
@@ -263,7 +263,7 @@ func TestClaimInfoAddPodReference(t *testing.T) {
263
263
{
264
264
description : "second pod reference" ,
265
265
claimInfo : & ClaimInfo {
266
- ClaimInfoState : state .ClaimInfoState {
266
+ ClaimInfoState : v1alpha1 .ClaimInfoState {
267
267
PodUIDs : sets.New [string ]("pod-uid1" ),
268
268
},
269
269
},
@@ -287,15 +287,15 @@ func TestClaimInfoHasPodReference(t *testing.T) {
287
287
{
288
288
description : "claim doesn't reference pod" ,
289
289
claimInfo : & ClaimInfo {
290
- ClaimInfoState : state .ClaimInfoState {
290
+ ClaimInfoState : v1alpha1 .ClaimInfoState {
291
291
PodUIDs : sets .New [string ](),
292
292
},
293
293
},
294
294
},
295
295
{
296
296
description : "claim references pod" ,
297
297
claimInfo : & ClaimInfo {
298
- ClaimInfoState : state .ClaimInfoState {
298
+ ClaimInfoState : v1alpha1 .ClaimInfoState {
299
299
PodUIDs : sets.New [string ](podUID ),
300
300
},
301
301
},
@@ -320,15 +320,15 @@ func TestClaimInfoDeletePodReference(t *testing.T) {
320
320
{
321
321
description : "claim doesn't reference pod" ,
322
322
claimInfo : & ClaimInfo {
323
- ClaimInfoState : state .ClaimInfoState {
323
+ ClaimInfoState : v1alpha1 .ClaimInfoState {
324
324
PodUIDs : sets .New [string ](),
325
325
},
326
326
},
327
327
},
328
328
{
329
329
description : "claim references pod" ,
330
330
claimInfo : & ClaimInfo {
331
- ClaimInfoState : state .ClaimInfoState {
331
+ ClaimInfoState : v1alpha1 .ClaimInfoState {
332
332
PodUIDs : sets.New [string ](podUID ),
333
333
},
334
334
},
@@ -574,7 +574,7 @@ func TestClaimInfoCacheAdd(t *testing.T) {
574
574
{
575
575
description : "claimInfo successfully added" ,
576
576
claimInfo : & ClaimInfo {
577
- ClaimInfoState : state .ClaimInfoState {
577
+ ClaimInfoState : v1alpha1 .ClaimInfoState {
578
578
ClaimName : claimName ,
579
579
Namespace : namespace ,
580
580
},
@@ -603,15 +603,15 @@ func TestClaimInfoCacheContains(t *testing.T) {
603
603
claimInfoCache : & claimInfoCache {
604
604
claimInfo : map [string ]* ClaimInfo {
605
605
namespace + "/" + claimName : {
606
- ClaimInfoState : state .ClaimInfoState {
606
+ ClaimInfoState : v1alpha1 .ClaimInfoState {
607
607
ClaimName : claimName ,
608
608
Namespace : namespace ,
609
609
},
610
610
},
611
611
},
612
612
},
613
613
claimInfo : & ClaimInfo {
614
- ClaimInfoState : state .ClaimInfoState {
614
+ ClaimInfoState : v1alpha1 .ClaimInfoState {
615
615
ClaimName : claimName ,
616
616
Namespace : namespace ,
617
617
},
@@ -622,7 +622,7 @@ func TestClaimInfoCacheContains(t *testing.T) {
622
622
description : "cache miss" ,
623
623
claimInfoCache : & claimInfoCache {},
624
624
claimInfo : & ClaimInfo {
625
- ClaimInfoState : state .ClaimInfoState {
625
+ ClaimInfoState : v1alpha1 .ClaimInfoState {
626
626
ClaimName : claimName ,
627
627
Namespace : namespace ,
628
628
},
@@ -632,7 +632,7 @@ func TestClaimInfoCacheContains(t *testing.T) {
632
632
description : "cache miss: empty cache and empty claim info" ,
633
633
claimInfoCache : & claimInfoCache {},
634
634
claimInfo : & ClaimInfo {
635
- ClaimInfoState : state .ClaimInfoState {},
635
+ ClaimInfoState : v1alpha1 .ClaimInfoState {},
636
636
},
637
637
},
638
638
} {
@@ -654,7 +654,7 @@ func TestClaimInfoCacheGet(t *testing.T) {
654
654
claimInfoCache : & claimInfoCache {
655
655
claimInfo : map [string ]* ClaimInfo {
656
656
namespace + "/" + claimName : {
657
- ClaimInfoState : state .ClaimInfoState {
657
+ ClaimInfoState : v1alpha1 .ClaimInfoState {
658
658
ClaimName : claimName ,
659
659
Namespace : namespace ,
660
660
},
@@ -687,7 +687,7 @@ func TestClaimInfoCacheDelete(t *testing.T) {
687
687
claimInfoCache : & claimInfoCache {
688
688
claimInfo : map [string ]* ClaimInfo {
689
689
claimName + namespace : {
690
- ClaimInfoState : state .ClaimInfoState {
690
+ ClaimInfoState : v1alpha1 .ClaimInfoState {
691
691
ClaimName : claimName ,
692
692
Namespace : namespace ,
693
693
},
@@ -718,7 +718,7 @@ func TestClaimInfoCacheHasPodReference(t *testing.T) {
718
718
claimInfoCache : & claimInfoCache {
719
719
claimInfo : map [string ]* ClaimInfo {
720
720
claimName + namespace : {
721
- ClaimInfoState : state .ClaimInfoState {
721
+ ClaimInfoState : v1alpha1 .ClaimInfoState {
722
722
ClaimName : claimName ,
723
723
Namespace : namespace ,
724
724
PodUIDs : sets.New [string ](podUID ),
0 commit comments