@@ -28,7 +28,7 @@ import (
2828 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2929 "k8s.io/apimachinery/pkg/types"
3030 "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 "
3232)
3333
3434// ClaimInfo test cases
@@ -48,13 +48,13 @@ const (
4848)
4949
5050var (
51- device = state .Device {
51+ device = v1alpha1 .Device {
5252 PoolName : poolName ,
5353 DeviceName : deviceName ,
5454 RequestNames : []string {requestName },
5555 CDIDeviceIDs : []string {cdiID },
5656 }
57- devices = []state .Device {device }
57+ devices = []v1alpha1 .Device {device }
5858)
5959
6060func TestNewClaimInfoFromClaim (t * testing.T ) {
@@ -97,12 +97,12 @@ func TestNewClaimInfoFromClaim(t *testing.T) {
9797 },
9898 },
9999 expectedResult : & ClaimInfo {
100- ClaimInfoState : state .ClaimInfoState {
100+ ClaimInfoState : v1alpha1 .ClaimInfoState {
101101 ClaimUID : claimUID ,
102102 ClaimName : claimName ,
103103 Namespace : namespace ,
104104 PodUIDs : sets .New [string ](),
105- DriverState : map [string ]state .DriverState {
105+ DriverState : map [string ]v1alpha1 .DriverState {
106106 driverName : {},
107107 },
108108 },
@@ -123,12 +123,12 @@ func TestNewClaimInfoFromClaim(t *testing.T) {
123123 Spec : resourceapi.ResourceClaimSpec {},
124124 },
125125 expectedResult : & ClaimInfo {
126- ClaimInfoState : state .ClaimInfoState {
126+ ClaimInfoState : v1alpha1 .ClaimInfoState {
127127 ClaimUID : claimUID ,
128128 ClaimName : claimName ,
129129 Namespace : namespace ,
130130 PodUIDs : sets .New [string ](),
131- DriverState : map [string ]state .DriverState {},
131+ DriverState : map [string ]v1alpha1 .DriverState {},
132132 },
133133 prepared : false ,
134134 },
@@ -149,29 +149,29 @@ func TestNewClaimInfoFromClaim(t *testing.T) {
149149func TestNewClaimInfoFromState (t * testing.T ) {
150150 for _ , test := range []struct {
151151 description string
152- state * state .ClaimInfoState
152+ state * v1alpha1 .ClaimInfoState
153153 expectedResult * ClaimInfo
154154 }{
155155 {
156156 description : "successfully created object" ,
157- state : & state .ClaimInfoState {
157+ state : & v1alpha1 .ClaimInfoState {
158158 ClaimUID : claimUID ,
159159 ClaimName : claimName ,
160160 Namespace : namespace ,
161161 PodUIDs : sets.New [string ](podUID ),
162- DriverState : map [string ]state .DriverState {
162+ DriverState : map [string ]v1alpha1 .DriverState {
163163 driverName : {
164164 Devices : devices ,
165165 },
166166 },
167167 },
168168 expectedResult : & ClaimInfo {
169- ClaimInfoState : state .ClaimInfoState {
169+ ClaimInfoState : v1alpha1 .ClaimInfoState {
170170 ClaimUID : claimUID ,
171171 ClaimName : claimName ,
172172 Namespace : namespace ,
173173 PodUIDs : sets.New [string ](podUID ),
174- DriverState : map [string ]state .DriverState {
174+ DriverState : map [string ]v1alpha1 .DriverState {
175175 driverName : {
176176 Devices : devices ,
177177 },
@@ -194,12 +194,12 @@ func TestClaimInfoAddDevice(t *testing.T) {
194194 for _ , test := range []struct {
195195 description string
196196 claimInfo * ClaimInfo
197- device state .Device
197+ device v1alpha1 .Device
198198 }{
199199 {
200200 description : "add new device" ,
201201 claimInfo : & ClaimInfo {
202- ClaimInfoState : state .ClaimInfoState {
202+ ClaimInfoState : v1alpha1 .ClaimInfoState {
203203 ClaimUID : claimUID ,
204204 ClaimName : claimName ,
205205 Namespace : namespace ,
@@ -212,14 +212,14 @@ func TestClaimInfoAddDevice(t *testing.T) {
212212 {
213213 description : "other new device" ,
214214 claimInfo : & ClaimInfo {
215- ClaimInfoState : state .ClaimInfoState {
215+ ClaimInfoState : v1alpha1 .ClaimInfoState {
216216 ClaimUID : claimUID ,
217217 ClaimName : claimName ,
218218 Namespace : namespace ,
219219 PodUIDs : sets.New [string ](podUID ),
220220 },
221221 },
222- device : func () state .Device {
222+ device : func () v1alpha1 .Device {
223223 device := device
224224 device .PoolName += "-2"
225225 device .DeviceName += "-2"
@@ -231,7 +231,7 @@ func TestClaimInfoAddDevice(t *testing.T) {
231231 } {
232232 t .Run (test .description , func (t * testing.T ) {
233233 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 )
235235 })
236236 }
237237}
@@ -245,7 +245,7 @@ func TestClaimInfoAddPodReference(t *testing.T) {
245245 {
246246 description : "empty PodUIDs list" ,
247247 claimInfo : & ClaimInfo {
248- ClaimInfoState : state .ClaimInfoState {
248+ ClaimInfoState : v1alpha1 .ClaimInfoState {
249249 PodUIDs : sets .New [string ](),
250250 },
251251 },
@@ -254,7 +254,7 @@ func TestClaimInfoAddPodReference(t *testing.T) {
254254 {
255255 description : "first pod reference" ,
256256 claimInfo : & ClaimInfo {
257- ClaimInfoState : state .ClaimInfoState {
257+ ClaimInfoState : v1alpha1 .ClaimInfoState {
258258 PodUIDs : sets.New [string ](podUID ),
259259 },
260260 },
@@ -263,7 +263,7 @@ func TestClaimInfoAddPodReference(t *testing.T) {
263263 {
264264 description : "second pod reference" ,
265265 claimInfo : & ClaimInfo {
266- ClaimInfoState : state .ClaimInfoState {
266+ ClaimInfoState : v1alpha1 .ClaimInfoState {
267267 PodUIDs : sets.New [string ]("pod-uid1" ),
268268 },
269269 },
@@ -287,15 +287,15 @@ func TestClaimInfoHasPodReference(t *testing.T) {
287287 {
288288 description : "claim doesn't reference pod" ,
289289 claimInfo : & ClaimInfo {
290- ClaimInfoState : state .ClaimInfoState {
290+ ClaimInfoState : v1alpha1 .ClaimInfoState {
291291 PodUIDs : sets .New [string ](),
292292 },
293293 },
294294 },
295295 {
296296 description : "claim references pod" ,
297297 claimInfo : & ClaimInfo {
298- ClaimInfoState : state .ClaimInfoState {
298+ ClaimInfoState : v1alpha1 .ClaimInfoState {
299299 PodUIDs : sets.New [string ](podUID ),
300300 },
301301 },
@@ -320,15 +320,15 @@ func TestClaimInfoDeletePodReference(t *testing.T) {
320320 {
321321 description : "claim doesn't reference pod" ,
322322 claimInfo : & ClaimInfo {
323- ClaimInfoState : state .ClaimInfoState {
323+ ClaimInfoState : v1alpha1 .ClaimInfoState {
324324 PodUIDs : sets .New [string ](),
325325 },
326326 },
327327 },
328328 {
329329 description : "claim references pod" ,
330330 claimInfo : & ClaimInfo {
331- ClaimInfoState : state .ClaimInfoState {
331+ ClaimInfoState : v1alpha1 .ClaimInfoState {
332332 PodUIDs : sets.New [string ](podUID ),
333333 },
334334 },
@@ -574,7 +574,7 @@ func TestClaimInfoCacheAdd(t *testing.T) {
574574 {
575575 description : "claimInfo successfully added" ,
576576 claimInfo : & ClaimInfo {
577- ClaimInfoState : state .ClaimInfoState {
577+ ClaimInfoState : v1alpha1 .ClaimInfoState {
578578 ClaimName : claimName ,
579579 Namespace : namespace ,
580580 },
@@ -603,15 +603,15 @@ func TestClaimInfoCacheContains(t *testing.T) {
603603 claimInfoCache : & claimInfoCache {
604604 claimInfo : map [string ]* ClaimInfo {
605605 namespace + "/" + claimName : {
606- ClaimInfoState : state .ClaimInfoState {
606+ ClaimInfoState : v1alpha1 .ClaimInfoState {
607607 ClaimName : claimName ,
608608 Namespace : namespace ,
609609 },
610610 },
611611 },
612612 },
613613 claimInfo : & ClaimInfo {
614- ClaimInfoState : state .ClaimInfoState {
614+ ClaimInfoState : v1alpha1 .ClaimInfoState {
615615 ClaimName : claimName ,
616616 Namespace : namespace ,
617617 },
@@ -622,7 +622,7 @@ func TestClaimInfoCacheContains(t *testing.T) {
622622 description : "cache miss" ,
623623 claimInfoCache : & claimInfoCache {},
624624 claimInfo : & ClaimInfo {
625- ClaimInfoState : state .ClaimInfoState {
625+ ClaimInfoState : v1alpha1 .ClaimInfoState {
626626 ClaimName : claimName ,
627627 Namespace : namespace ,
628628 },
@@ -632,7 +632,7 @@ func TestClaimInfoCacheContains(t *testing.T) {
632632 description : "cache miss: empty cache and empty claim info" ,
633633 claimInfoCache : & claimInfoCache {},
634634 claimInfo : & ClaimInfo {
635- ClaimInfoState : state .ClaimInfoState {},
635+ ClaimInfoState : v1alpha1 .ClaimInfoState {},
636636 },
637637 },
638638 } {
@@ -654,7 +654,7 @@ func TestClaimInfoCacheGet(t *testing.T) {
654654 claimInfoCache : & claimInfoCache {
655655 claimInfo : map [string ]* ClaimInfo {
656656 namespace + "/" + claimName : {
657- ClaimInfoState : state .ClaimInfoState {
657+ ClaimInfoState : v1alpha1 .ClaimInfoState {
658658 ClaimName : claimName ,
659659 Namespace : namespace ,
660660 },
@@ -687,7 +687,7 @@ func TestClaimInfoCacheDelete(t *testing.T) {
687687 claimInfoCache : & claimInfoCache {
688688 claimInfo : map [string ]* ClaimInfo {
689689 claimName + namespace : {
690- ClaimInfoState : state .ClaimInfoState {
690+ ClaimInfoState : v1alpha1 .ClaimInfoState {
691691 ClaimName : claimName ,
692692 Namespace : namespace ,
693693 },
@@ -718,7 +718,7 @@ func TestClaimInfoCacheHasPodReference(t *testing.T) {
718718 claimInfoCache : & claimInfoCache {
719719 claimInfo : map [string ]* ClaimInfo {
720720 claimName + namespace : {
721- ClaimInfoState : state .ClaimInfoState {
721+ ClaimInfoState : v1alpha1 .ClaimInfoState {
722722 ClaimName : claimName ,
723723 Namespace : namespace ,
724724 PodUIDs : sets.New [string ](podUID ),
0 commit comments