@@ -45,22 +45,21 @@ for (const [base, arch, channel] of [
4545 [ 'core20' , 's390x' , 'stable' ]
4646] ) {
4747 test ( `SnapcraftBuilder.build runs a snap build with base: ${ base } ; and arch: ${ arch } ` , async ( ) => {
48- expect . assertions ( 4 )
48+ expect . assertions ( 3 )
4949
50- const ensureDisabledAppArmorRulesMock = jest
51- . spyOn ( tools , 'ensureDisabledAppArmorRules' )
52- . mockImplementation ( async ( ) : Promise < void > => { } )
5350 const ensureDockerExperimentalMock = jest
5451 . spyOn ( tools , 'ensureDockerExperimental' )
55- . mockImplementation ( async ( ) : Promise < void > => { } )
52+ . mockImplementation ( async ( ) : Promise < void > => Promise . resolve ( ) )
5653 const detectBaseMock = jest
5754 . spyOn ( tools , 'detectBase' )
58- . mockImplementation ( async ( projectRoot : string ) : Promise < string > => base )
59- const execMock = jest . spyOn ( exec , 'exec' ) . mockImplementation (
60- async ( program : string , args ?: string [ ] ) : Promise < number > => {
61- return 0
62- }
63- )
55+ . mockImplementation (
56+ async ( projectRoot : string ) : Promise < string > => Promise . resolve ( base )
57+ )
58+ const execMock = jest
59+ . spyOn ( exec , 'exec' )
60+ . mockImplementation (
61+ async ( program : string , args ?: string [ ] ) : Promise < number > => 0
62+ )
6463 process . env [ 'GITHUB_REPOSITORY' ] = 'user/repo'
6564 process . env [ 'GITHUB_RUN_ID' ] = '42'
6665
@@ -80,7 +79,6 @@ for (const [base, arch, channel] of [
8079 platform = [ '--platform' , build . platforms [ arch ] ]
8180 }
8281
83- expect ( ensureDisabledAppArmorRulesMock ) . toHaveBeenCalled ( )
8482 expect ( ensureDockerExperimentalMock ) . toHaveBeenCalled ( )
8583 expect ( detectBaseMock ) . toHaveBeenCalled ( )
8684 expect ( execMock ) . toHaveBeenCalledWith (
@@ -90,8 +88,6 @@ for (const [base, arch, channel] of [
9088 '--rm' ,
9189 '--tty' ,
9290 '--privileged' ,
93- '--security-opt' ,
94- 'apparmor=:docker-snapcraft:unconfined' ,
9591 '--volume' ,
9692 `${ process . cwd ( ) } /${ projectDir } :/data` ,
9793 '--workdir' ,
@@ -118,22 +114,19 @@ for (const [base, arch, channel] of [
118114test ( 'SnapcraftBuilder.build can disable build info' , async ( ) => {
119115 expect . assertions ( 1 )
120116
121- const ensureDisabledAppArmorRulesMock = jest
122- . spyOn ( tools , 'ensureDisabledAppArmorRules' )
123- . mockImplementation ( async ( ) : Promise < void > => { } )
124117 const ensureDockerExperimentalMock = jest
125118 . spyOn ( tools , 'ensureDockerExperimental' )
126- . mockImplementation ( async ( ) : Promise < void > => { } )
119+ . mockImplementation ( async ( ) : Promise < void > => Promise . resolve ( ) )
127120 const detectBaseMock = jest
128121 . spyOn ( tools , 'detectBase' )
129122 . mockImplementation (
130123 async ( projectRoot : string ) : Promise < string > => default_base
131124 )
132- const execMock = jest . spyOn ( exec , 'exec' ) . mockImplementation (
133- async ( program : string , args ?: string [ ] ) : Promise < number > => {
134- return 0
135- }
136- )
125+ const execMock = jest
126+ . spyOn ( exec , 'exec' )
127+ . mockImplementation (
128+ async ( program : string , args ?: string [ ] ) : Promise < number > => 0
129+ )
137130
138131 const builder = new build . SnapcraftBuilder ( '.' , false , 'stable' , '' , '' , '' )
139132 await builder . build ( )
@@ -145,8 +138,6 @@ test('SnapcraftBuilder.build can disable build info', async () => {
145138 '--rm' ,
146139 '--tty' ,
147140 '--privileged' ,
148- '--security-opt' ,
149- 'apparmor=:docker-snapcraft:unconfined' ,
150141 '--volume' ,
151142 `${ process . cwd ( ) } :/data` ,
152143 '--workdir' ,
@@ -169,22 +160,19 @@ test('SnapcraftBuilder.build can disable build info', async () => {
169160test ( 'SnapcraftBuilder.build can pass additional arguments' , async ( ) => {
170161 expect . assertions ( 1 )
171162
172- const ensureDisabledAppArmorRulesMock = jest
173- . spyOn ( tools , 'ensureDisabledAppArmorRules' )
174- . mockImplementation ( async ( ) : Promise < void > => { } )
175163 const ensureDockerExperimentalMock = jest
176164 . spyOn ( tools , 'ensureDockerExperimental' )
177- . mockImplementation ( async ( ) : Promise < void > => { } )
165+ . mockImplementation ( async ( ) : Promise < void > => Promise . resolve ( ) )
178166 const detectBaseMock = jest
179167 . spyOn ( tools , 'detectBase' )
180168 . mockImplementation (
181169 async ( projectRoot : string ) : Promise < string > => default_base
182170 )
183- const execMock = jest . spyOn ( exec , 'exec' ) . mockImplementation (
184- async ( program : string , args ?: string [ ] ) : Promise < number > => {
185- return 0
186- }
187- )
171+ const execMock = jest
172+ . spyOn ( exec , 'exec' )
173+ . mockImplementation (
174+ async ( program : string , args ?: string [ ] ) : Promise < number > => 0
175+ )
188176
189177 const builder = new build . SnapcraftBuilder (
190178 '.' ,
@@ -203,8 +191,6 @@ test('SnapcraftBuilder.build can pass additional arguments', async () => {
203191 '--rm' ,
204192 '--tty' ,
205193 '--privileged' ,
206- '--security-opt' ,
207- 'apparmor=:docker-snapcraft:unconfined' ,
208194 '--volume' ,
209195 `${ process . cwd ( ) } :/data` ,
210196 '--workdir' ,
0 commit comments