@@ -21,30 +21,49 @@ import path from 'path';
2121import * as rimraf from 'rimraf' ;
2222import osm = require( 'os' ) ;
2323
24- import { Install } from '../../src/docker/install' ;
24+ import { Install , InstallSource , InstallSourceArchive , InstallSourceImage } from '../../src/docker/install' ;
2525
2626const tmpDir = fs . mkdtempSync ( path . join ( process . env . TEMP || os . tmpdir ( ) , 'docker-install-' ) ) ;
2727
2828afterEach ( function ( ) {
2929 rimraf . sync ( tmpDir ) ;
3030} ) ;
3131
32+ const archive = ( version : string , channel : string ) : InstallSourceArchive => {
33+ return {
34+ type : 'archive' ,
35+ version : version ,
36+ channel : channel
37+ } ;
38+ } ;
39+
40+ const image = ( tag : string ) : InstallSourceImage => {
41+ return {
42+ type : 'image' ,
43+ tag : tag
44+ } ;
45+ } ;
46+
3247describe ( 'download' , ( ) => {
3348 // prettier-ignore
3449 test . each ( [
35- [ 'v19.03.14' , 'linux' ] ,
36- [ 'v20.10.22' , 'linux' ] ,
37- [ 'v20.10.22' , 'darwin' ] ,
38- [ 'v20.10.22' , 'win32' ] ,
50+ [ archive ( 'v19.03.14' , 'stable' ) , 'linux' ] ,
51+ [ archive ( 'v20.10.22' , 'stable' ) , 'linux' ] ,
52+ [ archive ( 'v20.10.22' , 'stable' ) , 'darwin' ] ,
53+ [ archive ( 'v20.10.22' , 'stable' ) , 'win32' ] ,
54+
55+ [ image ( 'master' ) , 'linux' ] ,
56+ [ image ( 'master' ) , 'darwin' ] ,
57+ [ image ( 'master' ) , 'win32' ] ,
58+
59+ [ image ( 'v27.3.1' ) , 'linux' ] ,
60+ [ image ( 'v27.3.1' ) , 'darwin' ] ,
61+ [ image ( 'v27.3.1' ) , 'win32' ] ,
3962 ] ) (
40- 'acquires %p of docker (%s)' , async ( version , platformOS ) => {
63+ 'acquires %p of docker (%s)' , async ( source , platformOS ) => {
4164 jest . spyOn ( osm , 'platform' ) . mockImplementation ( ( ) => platformOS as NodeJS . Platform ) ;
4265 const install = new Install ( {
43- source : {
44- type : 'archive' ,
45- version : version ,
46- channel : 'stable' ,
47- } ,
66+ source : source ,
4867 runDir : tmpDir ,
4968 } ) ;
5069 const toolPath = await install . download ( ) ;
0 commit comments