@@ -22,55 +22,34 @@ describe('run.ts', () => {
22
22
23
23
test ( 'getHelmDownloadURL() - return the URL to download helm for Linux' , ( ) => {
24
24
jest . spyOn ( os , 'type' ) . mockReturnValue ( 'Linux' ) ;
25
- const kubectlLinuxUrl = 'https://get.helm.sh/helm-v3.2.1 -linux-amd64.zip'
25
+ const kubectlLinuxUrl = 'https://get.helm.sh/helm-v3.8.0 -linux-amd64.zip'
26
26
27
- expect ( run . getHelmDownloadURL ( 'v3.2.1 ' ) ) . toBe ( kubectlLinuxUrl ) ;
27
+ expect ( run . getHelmDownloadURL ( 'v3.8.0 ' ) ) . toBe ( kubectlLinuxUrl ) ;
28
28
expect ( os . type ) . toBeCalled ( ) ;
29
29
} ) ;
30
30
31
31
test ( 'getHelmDownloadURL() - return the URL to download helm for Darwin' , ( ) => {
32
32
jest . spyOn ( os , 'type' ) . mockReturnValue ( 'Darwin' ) ;
33
- const kubectlDarwinUrl = 'https://get.helm.sh/helm-v3.2.1 -darwin-amd64.zip'
33
+ const kubectlDarwinUrl = 'https://get.helm.sh/helm-v3.8.0 -darwin-amd64.zip'
34
34
35
- expect ( run . getHelmDownloadURL ( 'v3.2.1 ' ) ) . toBe ( kubectlDarwinUrl ) ;
35
+ expect ( run . getHelmDownloadURL ( 'v3.8.0 ' ) ) . toBe ( kubectlDarwinUrl ) ;
36
36
expect ( os . type ) . toBeCalled ( ) ;
37
37
} ) ;
38
38
39
39
test ( 'getHelmDownloadURL() - return the URL to download helm for Windows' , ( ) => {
40
40
jest . spyOn ( os , 'type' ) . mockReturnValue ( 'Windows_NT' ) ;
41
41
42
- const kubectlWindowsUrl = 'https://get.helm.sh/helm-v3.2.1 -windows-amd64.zip'
43
- expect ( run . getHelmDownloadURL ( 'v3.2.1 ' ) ) . toBe ( kubectlWindowsUrl ) ;
42
+ const kubectlWindowsUrl = 'https://get.helm.sh/helm-v3.8.0 -windows-amd64.zip'
43
+ expect ( run . getHelmDownloadURL ( 'v3.8.0 ' ) ) . toBe ( kubectlWindowsUrl ) ;
44
44
expect ( os . type ) . toBeCalled ( ) ;
45
45
} ) ;
46
46
47
- test ( 'getStableHelmVersion() - download stable version file, read version and return it' , async ( ) => {
48
- jest . spyOn ( toolCache , 'downloadTool' ) . mockResolvedValue ( 'pathToTool' ) ;
49
- const response = JSON . stringify (
50
- [
51
- {
52
- 'tag_name' : 'v4.0.0'
53
- } , {
54
- 'tag_name' : 'v3.0.0'
55
- } , {
56
- 'tag_name' : 'v2.0.0'
57
- }
58
- ]
59
- ) ;
60
- jest . spyOn ( fs , 'readFileSync' ) . mockReturnValue ( response ) ;
61
-
62
- expect ( await run . getStableHelmVersion ( ) ) . toBe ( 'v4.0.0' ) ;
63
- expect ( toolCache . downloadTool ) . toBeCalled ( ) ;
64
- expect ( fs . readFileSync ) . toBeCalledWith ( 'pathToTool' , 'utf8' ) ;
65
- } ) ;
66
-
67
- test ( 'getStableHelmVersion() - return default version if error occurs while getting latest version' , async ( ) => {
68
- jest . spyOn ( toolCache , 'downloadTool' ) . mockRejectedValue ( 'Unable to download' ) ;
69
- jest . spyOn ( core , 'warning' ) . mockImplementation ( ) ;
70
-
71
- expect ( await run . getStableHelmVersion ( ) ) . toBe ( 'v3.2.1' ) ;
72
- expect ( toolCache . downloadTool ) . toBeCalled ( ) ;
73
- expect ( core . warning ) . toBeCalledWith ( "Cannot get the latest Helm info from https://api.github.com/repos/helm/helm/releases. Error Unable to download. Using default Helm version v3.2.1." ) ;
47
+ test ( 'getLatestHelmVersion() - return the latest version of HELM' , async ( ) => {
48
+ try {
49
+ expect ( await run . getLatestHelmVersion ( ) ) . toBe ( "v3.8.0" ) ;
50
+ } catch ( e ) {
51
+ return e ;
52
+ }
74
53
} ) ;
75
54
76
55
test ( 'walkSync() - return path to the all files matching fileToFind in dir' , ( ) => {
@@ -146,7 +125,7 @@ describe('run.ts', () => {
146
125
return { isDirectory : ( ) => isDirectory } as fs . Stats ;
147
126
} ) ;
148
127
149
- expect ( await run . downloadHelm ( null ) ) . toBe ( path . join ( 'pathToCachedDir' , 'helm.exe' ) ) ;
128
+ expect ( await run . downloadHelm ( "v4.0.0" ) ) . toBe ( path . join ( 'pathToCachedDir' , 'helm.exe' ) ) ;
150
129
expect ( toolCache . find ) . toBeCalledWith ( 'helm' , 'v4.0.0' ) ;
151
130
expect ( toolCache . downloadTool ) . toBeCalledWith ( 'https://get.helm.sh/helm-v4.0.0-windows-amd64.zip' ) ;
152
131
expect ( fs . chmodSync ) . toBeCalledWith ( 'pathToTool' , '777' ) ;
0 commit comments