File tree 2 files changed +11
-8
lines changed
2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -174,17 +174,21 @@ describe('download module test suite', () => {
174
174
)
175
175
) ;
176
176
expect ( exec . logExecSync ) . toHaveBeenCalledWith (
177
- 'sudo ln -s /usr/local/bin/cri-dockerd /usr/bin/cri-dockerd'
177
+ 'sudo ln -sf /usr/local/bin/cri-dockerd /usr/bin/cri-dockerd'
178
178
) ;
179
179
} ) ;
180
180
test ( 'should install cri-dockerd service' , async ( ) => {
181
+ // Given
182
+ fs . readFileSync . mockImplementation (
183
+ ( ) =>
184
+ 'ExecStart=/usr/bin/cri-dockerd --container-runtime-endpoint fd://'
185
+ ) ;
181
186
// When
182
187
await download . installCriDockerd ( { githubToken : 'secret-token' } ) ;
183
188
// Then
184
- expect ( exec . logExecSync ) . toHaveBeenCalledWith (
185
- expect . stringMatching (
186
- / s e d - i ' s \/ c r i - d o c k e r d - - \/ c r i - d o c k e r d - - n e t w o r k - p l u g i n = c n i - - \/ g ' /
187
- )
189
+ expect ( fs . writeFileSync ) . toHaveBeenCalledWith (
190
+ '/etc/systemd/system/cri-docker.service' ,
191
+ 'ExecStart=/usr/bin/cri-dockerd --network-plugin=cni --container-runtime-endpoint fd://'
188
192
) ;
189
193
expect ( exec . logExecSync ) . toHaveBeenCalledWith (
190
194
expect . stringMatching (
Original file line number Diff line number Diff line change @@ -73,16 +73,15 @@ const installCriDockerd = async (inputs = {}) => {
73
73
const binaryDir = await tc . extractTar ( binaryTar ) ;
74
74
const binaryContent = firstDir ( binaryDir ) ;
75
75
logExecSync ( `sudo cp -a ${ binaryDir } /${ binaryContent } /cri-dockerd /usr/local/bin/` ) ;
76
- logExecSync ( `sudo ln -s /usr/local/bin/cri-dockerd /usr/bin/cri-dockerd` ) ;
76
+ logExecSync ( `sudo ln -sf /usr/local/bin/cri-dockerd /usr/bin/cri-dockerd` ) ;
77
77
// Service file
78
78
const sourceTar = await tc . downloadTool ( `https://github.com/Mirantis/cri-dockerd/archive/refs/tags/${ tag } .tar.gz` ) ;
79
79
const sourceDir = await tc . extractTar ( sourceTar ) ;
80
80
const sourceContent = firstDir ( sourceDir ) ;
81
- logExecSync ( `sed -i 's/cri-dockerd --/cri-dockerd --network-plugin=cni --/g' ${ sourceDir } /${ sourceContent } /packaging/systemd/cri-docker.service` ) ;
82
81
logExecSync ( `sudo cp -a ${ sourceDir } /${ sourceContent } /packaging/systemd/* /etc/systemd/system` ) ;
83
82
const serviceFile = '/etc/systemd/system/cri-docker.service' ;
84
83
fs . writeFileSync ( serviceFile , fs . readFileSync ( serviceFile ) . toString ( )
85
- . replace ( / \/ u s r \/ b i n \/ c r i - d o c k e r d / g, '/usr/local/bin/ cri-dockerd' )
84
+ . replace ( / c r i - d o c k e r d - - / g, 'cri-dockerd --network-plugin=cni -- ' )
86
85
) ;
87
86
const socketFile = '/etc/systemd/system/cri-docker.socket' ;
88
87
fs . writeFileSync ( socketFile , fs . readFileSync ( socketFile ) . toString ( )
You can’t perform that action at this time.
0 commit comments