@@ -20,8 +20,8 @@ jest.mock('src/common/k8s', () => ({
2020} ) )
2121
2222jest . mock ( 'src/common/values' , ( ) => ( {
23- getCurrentVersion : jest . fn ( ) ,
24- getImageTag : jest . fn ( ) ,
23+ getImageTagFromValues : jest . fn ( ) ,
24+ getPackageVersion : jest . fn ( ) ,
2525} ) )
2626
2727jest . mock ( 'zx' , ( ) => ( {
@@ -40,10 +40,6 @@ jest.mock('./commit', () => ({
4040 commit : jest . fn ( ) ,
4141} ) )
4242
43- jest . mock ( './upgrade' , ( ) => ( {
44- upgrade : jest . fn ( ) ,
45- } ) )
46-
4743jest . mock ( 'src/common/runtime-upgrade' , ( ) => ( {
4844 runtimeUpgrade : jest . fn ( ) ,
4945} ) )
@@ -92,23 +88,21 @@ describe('Apply command', () => {
9288 mockDeps = {
9389 getDeploymentState : require ( 'src/common/k8s' ) . getDeploymentState ,
9490 setDeploymentState : require ( 'src/common/k8s' ) . setDeploymentState ,
95- getCurrentVersion : require ( 'src/common/values' ) . getCurrentVersion ,
96- getImageTag : require ( 'src/common/values' ) . getImageTag ,
91+ getImageTagFromValues : require ( 'src/common/values' ) . getImageTagFromValues ,
92+ getPackageVersion : require ( 'src/common/values' ) . getPackageVersion ,
9793 applyAsApps : require ( './apply-as-apps' ) . applyAsApps ,
9894 commit : require ( './commit' ) . commit ,
99- upgrade : require ( './upgrade' ) . upgrade ,
10095 runtimeUpgrade : require ( 'src/common/runtime-upgrade' ) . runtimeUpgrade ,
10196 cd : require ( 'zx' ) . cd ,
10297 getParsedArgs : require ( 'src/common/yargs' ) . getParsedArgs ,
10398 }
10499
105100 // Set up default mock return values
106101 mockDeps . getDeploymentState . mockResolvedValue ( { status : 'deployed' } )
107- mockDeps . getCurrentVersion . mockResolvedValue ( '1 .0.0' )
108- mockDeps . getImageTag . mockResolvedValue ( 'v1 .0.0')
102+ mockDeps . getImageTagFromValues . mockResolvedValue ( 'v1 .0.0' )
103+ mockDeps . getPackageVersion . mockReturnValue ( '1 .0.0')
109104 mockDeps . applyAsApps . mockResolvedValue ( true )
110105 mockDeps . commit . mockResolvedValue ( undefined )
111- mockDeps . upgrade . mockResolvedValue ( undefined )
112106 mockDeps . runtimeUpgrade . mockResolvedValue ( undefined )
113107 mockDeps . getParsedArgs . mockReturnValue ( { } )
114108 } )
@@ -151,13 +145,11 @@ describe('Apply command', () => {
151145 await applyAll ( )
152146
153147 // Verify pre-upgrade steps
154- expect ( mockDeps . upgrade ) . toHaveBeenCalledWith ( { when : 'pre' } )
155148 expect ( mockDeps . runtimeUpgrade ) . toHaveBeenCalledWith ( { when : 'pre' } )
156149
157150 // Verify deployment state management
158151 expect ( mockDeps . getDeploymentState ) . toHaveBeenCalled ( )
159- expect ( mockDeps . getImageTag ) . toHaveBeenCalled ( )
160- expect ( mockDeps . getCurrentVersion ) . toHaveBeenCalled ( )
152+ expect ( mockDeps . getImageTagFromValues ) . toHaveBeenCalled ( )
161153 expect ( mockDeps . setDeploymentState ) . toHaveBeenCalledWith ( {
162154 status : 'deploying' ,
163155 deployingTag : 'v1.0.0' ,
@@ -168,7 +160,6 @@ describe('Apply command', () => {
168160 expect ( mockDeps . applyAsApps ) . toHaveBeenCalled ( )
169161
170162 // Verify post-upgrade steps
171- expect ( mockDeps . upgrade ) . toHaveBeenCalledWith ( { when : 'post' } )
172163 expect ( mockDeps . runtimeUpgrade ) . toHaveBeenCalledWith ( { when : 'post' } )
173164
174165 // Verify final state
@@ -260,7 +251,6 @@ describe('Apply command', () => {
260251
261252 expect ( mockDeps . applyAsApps ) . toHaveBeenCalledWith ( testArgs )
262253 // Should not go through the full applyAll flow
263- expect ( mockDeps . upgrade ) . not . toHaveBeenCalled ( )
264254 } )
265255
266256 test ( 'should call applyAsApps directly when file specified' , async ( ) => {
@@ -271,7 +261,6 @@ describe('Apply command', () => {
271261
272262 expect ( mockDeps . applyAsApps ) . toHaveBeenCalledWith ( testArgs )
273263 // Should not go through the full applyAll flow
274- expect ( mockDeps . upgrade ) . not . toHaveBeenCalled ( )
275264 } )
276265
277266 test ( 'should call applyAsApps directly when both label and file specified' , async ( ) => {
@@ -282,7 +271,6 @@ describe('Apply command', () => {
282271
283272 expect ( mockDeps . applyAsApps ) . toHaveBeenCalledWith ( testArgs )
284273 // Should not go through the full applyAll flow
285- expect ( mockDeps . upgrade ) . not . toHaveBeenCalled ( )
286274 } )
287275
288276 test ( 'should handle retry logic when applyAll fails' , async ( ) => {
@@ -310,7 +298,7 @@ describe('Apply command', () => {
310298
311299 test ( 'should handle image tag retrieval errors' , async ( ) => {
312300 const error = new Error ( 'Failed to get image tag' )
313- mockDeps . getImageTag . mockRejectedValueOnce ( error )
301+ mockDeps . getImageTagFromValues . mockRejectedValueOnce ( error )
314302
315303 await expect ( applyAll ( ) ) . rejects . toThrow ( 'Failed to get image tag' )
316304 } )
@@ -322,13 +310,6 @@ describe('Apply command', () => {
322310 await expect ( applyAll ( ) ) . rejects . toThrow ( 'ApplyAsApps failed' )
323311 } )
324312
325- test ( 'should handle upgrade errors' , async ( ) => {
326- const error = new Error ( 'Pre-upgrade failed' )
327- mockDeps . upgrade . mockRejectedValueOnce ( error )
328-
329- await expect ( applyAll ( ) ) . rejects . toThrow ( 'Pre-upgrade failed' )
330- } )
331-
332313 test ( 'should handle runtime upgrade errors' , async ( ) => {
333314 const error = new Error ( 'Runtime upgrade failed' )
334315 mockDeps . runtimeUpgrade . mockRejectedValueOnce ( error )
0 commit comments