@@ -45,7 +45,8 @@ var _ = Describe("GetStatus", func() {
4545
4646 It ("failed flow, GetModulePodByKernel fails" , func () {
4747 normalizedKernel := kernel .NormalizeVersion (kernelVersion )
48- mockBuildSignPodManager .EXPECT ().GetModulePodByKernel (ctx , mbscName , mbscNamespace , normalizedKernel , PodTypeBuild , & testMBSC ).
48+ mockBuildSignPodManager .EXPECT ().GetModulePodByKernel (ctx , mbscName , mbscNamespace , normalizedKernel ,
49+ string (kmmv1beta1 .BuildImage ), & testMBSC ).
4950 Return (nil , fmt .Errorf ("some error" ))
5051
5152 status , err := mgr .GetStatus (ctx , mbscName , mbscNamespace , kernelVersion , kmmv1beta1 .BuildImage , & testMBSC )
@@ -55,7 +56,8 @@ var _ = Describe("GetStatus", func() {
5556
5657 It ("GetModulePodByKernel returns pod does not exists" , func () {
5758 normalizedKernel := kernel .NormalizeVersion (kernelVersion )
58- mockBuildSignPodManager .EXPECT ().GetModulePodByKernel (ctx , mbscName , mbscNamespace , normalizedKernel , PodTypeBuild , & testMBSC ).
59+ mockBuildSignPodManager .EXPECT ().GetModulePodByKernel (ctx , mbscName , mbscNamespace , normalizedKernel ,
60+ string (kmmv1beta1 .BuildImage ), & testMBSC ).
5961 Return (nil , ErrNoMatchingPod )
6062
6163 status , err := mgr .GetStatus (ctx , mbscName , mbscNamespace , kernelVersion , kmmv1beta1 .BuildImage , & testMBSC )
@@ -67,7 +69,8 @@ var _ = Describe("GetStatus", func() {
6769 foundPod := v1.Pod {}
6870 normalizedKernel := kernel .NormalizeVersion (kernelVersion )
6971 gomock .InOrder (
70- mockBuildSignPodManager .EXPECT ().GetModulePodByKernel (ctx , mbscName , mbscNamespace , normalizedKernel , PodTypeBuild , & testMBSC ).
72+ mockBuildSignPodManager .EXPECT ().GetModulePodByKernel (ctx , mbscName , mbscNamespace , normalizedKernel ,
73+ string (kmmv1beta1 .BuildImage ), & testMBSC ).
7174 Return (& foundPod , nil ),
7275 mockBuildSignPodManager .EXPECT ().GetPodStatus (& foundPod ).Return (Status ("" ), fmt .Errorf ("some error" )),
7376 )
@@ -81,7 +84,8 @@ var _ = Describe("GetStatus", func() {
8184 foundPod := v1.Pod {}
8285 normalizedKernel := kernel .NormalizeVersion (kernelVersion )
8386 gomock .InOrder (
84- mockBuildSignPodManager .EXPECT ().GetModulePodByKernel (ctx , mbscName , mbscNamespace , normalizedKernel , PodTypeBuild , & testMBSC ).
87+ mockBuildSignPodManager .EXPECT ().GetModulePodByKernel (ctx , mbscName , mbscNamespace , normalizedKernel ,
88+ string (kmmv1beta1 .BuildImage ), & testMBSC ).
8589 Return (& foundPod , nil ),
8690 mockBuildSignPodManager .EXPECT ().GetPodStatus (& foundPod ).Return (podStatus , nil ),
8791 )
@@ -143,7 +147,8 @@ var _ = Describe("Sync", func() {
143147 It ("GetModulePodByKernel failed" , func () {
144148 gomock .InOrder (
145149 mockBuildSignPodManager .EXPECT ().MakeBuildResourceTemplate (ctx , testMLD , & testMBSC , true ).Return (nil , nil ),
146- mockBuildSignPodManager .EXPECT ().GetModulePodByKernel (ctx , mbscName , mbscNamespace , kernelVersion , PodTypeBuild , & testMBSC ).
150+ mockBuildSignPodManager .EXPECT ().GetModulePodByKernel (ctx , mbscName , mbscNamespace , kernelVersion ,
151+ string (kmmv1beta1 .BuildImage ), & testMBSC ).
147152 Return (nil , fmt .Errorf ("some error" )),
148153 )
149154 err := mgr .Sync (ctx , testMLD , true , kmmv1beta1 .BuildImage , & testMBSC )
@@ -154,7 +159,8 @@ var _ = Describe("Sync", func() {
154159 testTemplate := v1.Pod {}
155160 gomock .InOrder (
156161 mockBuildSignPodManager .EXPECT ().MakeBuildResourceTemplate (ctx , testMLD , & testMBSC , true ).Return (& testTemplate , nil ),
157- mockBuildSignPodManager .EXPECT ().GetModulePodByKernel (ctx , mbscName , mbscNamespace , kernelVersion , PodTypeBuild , & testMBSC ).
162+ mockBuildSignPodManager .EXPECT ().GetModulePodByKernel (ctx , mbscName , mbscNamespace , kernelVersion ,
163+ string (kmmv1beta1 .BuildImage ), & testMBSC ).
158164 Return (nil , ErrNoMatchingPod ),
159165 mockBuildSignPodManager .EXPECT ().CreatePod (ctx , & testTemplate ).Return (fmt .Errorf ("some error" )),
160166 )
@@ -167,7 +173,8 @@ var _ = Describe("Sync", func() {
167173 testPod := v1.Pod {}
168174 gomock .InOrder (
169175 mockBuildSignPodManager .EXPECT ().MakeBuildResourceTemplate (ctx , testMLD , & testMBSC , true ).Return (& testTemplate , nil ),
170- mockBuildSignPodManager .EXPECT ().GetModulePodByKernel (ctx , mbscName , mbscNamespace , kernelVersion , PodTypeBuild , & testMBSC ).
176+ mockBuildSignPodManager .EXPECT ().GetModulePodByKernel (ctx , mbscName , mbscNamespace , kernelVersion ,
177+ string (kmmv1beta1 .BuildImage ), & testMBSC ).
171178 Return (& testPod , nil ),
172179 mockBuildSignPodManager .EXPECT ().IsPodChanged (& testPod , & testTemplate ).Return (false , fmt .Errorf ("some error" )),
173180 )
@@ -180,7 +187,8 @@ var _ = Describe("Sync", func() {
180187 testPod := v1.Pod {}
181188 gomock .InOrder (
182189 mockBuildSignPodManager .EXPECT ().MakeBuildResourceTemplate (ctx , testMLD , & testMBSC , true ).Return (& testTemplate , nil ),
183- mockBuildSignPodManager .EXPECT ().GetModulePodByKernel (ctx , mbscName , mbscNamespace , kernelVersion , PodTypeBuild , & testMBSC ).
190+ mockBuildSignPodManager .EXPECT ().GetModulePodByKernel (ctx , mbscName , mbscNamespace , kernelVersion ,
191+ string (kmmv1beta1 .BuildImage ), & testMBSC ).
184192 Return (& testPod , nil ),
185193 mockBuildSignPodManager .EXPECT ().IsPodChanged (& testPod , & testTemplate ).Return (true , nil ),
186194 mockBuildSignPodManager .EXPECT ().DeletePod (ctx , & testPod ).Return (fmt .Errorf ("some error" )),
@@ -190,12 +198,10 @@ var _ = Describe("Sync", func() {
190198 })
191199
192200 DescribeTable ("check good flow" , func (buildAction , podExists , podChanged , pushImage bool ) {
193- testAction := kmmv1beta1 .BuildImage
194201 testPodTemplate := v1.Pod {}
195202 existingTestPod := v1.Pod {}
196- podType := PodTypeBuild
203+ testAction := kmmv1beta1 . BuildImage
197204 if ! buildAction {
198- podType = PodTypeSign
199205 testAction = kmmv1beta1 .SignImage
200206 }
201207
@@ -208,7 +214,8 @@ var _ = Describe("Sync", func() {
208214 if ! podExists {
209215 getPodError = ErrNoMatchingPod
210216 }
211- mockBuildSignPodManager .EXPECT ().GetModulePodByKernel (ctx , mbscName , mbscNamespace , kernelVersion , podType , & testMBSC ).Return (& existingTestPod , getPodError )
217+ mockBuildSignPodManager .EXPECT ().GetModulePodByKernel (ctx , mbscName , mbscNamespace , kernelVersion ,
218+ string (testAction ), & testMBSC ).Return (& existingTestPod , getPodError )
212219 if ! podExists {
213220 mockBuildSignPodManager .EXPECT ().CreatePod (ctx , & testPodTemplate ).Return (nil )
214221 goto executeTestFunction
@@ -259,7 +266,8 @@ var _ = Describe("GarbageCollect", func() {
259266 testMBSC := kmmv1beta1.ModuleBuildSignConfig {}
260267
261268 It ("failed to get module pods" , func () {
262- mockBuildSignPodManager .EXPECT ().GetModulePods (ctx , mbscName , mbscNamespace , PodTypeBuild , & testMBSC ).Return (nil , fmt .Errorf ("some error" ))
269+ mockBuildSignPodManager .EXPECT ().GetModulePods (ctx , mbscName , mbscNamespace ,
270+ string (kmmv1beta1 .BuildImage ), & testMBSC ).Return (nil , fmt .Errorf ("some error" ))
263271
264272 _ , err := mgr .GarbageCollect (ctx , mbscName , mbscNamespace , kmmv1beta1 .BuildImage , & testMBSC )
265273 Expect (err ).To (HaveOccurred ())
@@ -272,7 +280,7 @@ var _ = Describe("GarbageCollect", func() {
272280 },
273281 }
274282 gomock .InOrder (
275- mockBuildSignPodManager .EXPECT ().GetModulePods (ctx , mbscName , mbscNamespace , PodTypeSign , & testMBSC ).
283+ mockBuildSignPodManager .EXPECT ().GetModulePods (ctx , mbscName , mbscNamespace , string ( kmmv1beta1 . SignImage ) , & testMBSC ).
276284 Return ([]v1.Pod {testPod }, nil ),
277285 mockBuildSignPodManager .EXPECT ().DeletePod (ctx , & testPod ).Return (fmt .Errorf ("some error" )),
278286 )
@@ -304,7 +312,7 @@ var _ = Describe("GarbageCollect", func() {
304312 }
305313 returnedPods := []v1.Pod {testPodSuccess , testPodFailure , testPodRunning , testPodUnknown , testPodPending }
306314 gomock .InOrder (
307- mockBuildSignPodManager .EXPECT ().GetModulePods (ctx , mbscName , mbscNamespace , PodTypeBuild , & testMBSC ).
315+ mockBuildSignPodManager .EXPECT ().GetModulePods (ctx , mbscName , mbscNamespace , string ( kmmv1beta1 . BuildImage ) , & testMBSC ).
308316 Return (returnedPods , nil ),
309317 mockBuildSignPodManager .EXPECT ().DeletePod (ctx , & testPodSuccess ).Return (nil ),
310318 )
0 commit comments