@@ -19,21 +19,15 @@ import fs from 'fs';
1919import os from 'os' ;
2020import path from 'path' ;
2121
22- import { Install , InstallSourceArchive , InstallSourceImage } from '../../src/docker/install' ;
22+ import { Install , InstallSource , InstallSourceArchive , InstallSourceImage } from '../../src/docker/install' ;
2323import { Docker } from '../../src/docker/docker' ;
2424import { Exec } from '../../src/exec' ;
2525
2626const tmpDir = ( ) => fs . mkdtempSync ( path . join ( process . env . TEMP || os . tmpdir ( ) , 'docker-install-itg-' ) ) ;
2727
28- describe ( 'install ' , ( ) => {
28+ describe ( 'root ' , ( ) => {
2929 // prettier-ignore
30- test . each ( [
31- { type : 'image' , tag : '27.3.1' } as InstallSourceImage ,
32- { type : 'image' , tag : 'master' } as InstallSourceImage ,
33- { type : 'image' , tag : 'latest' } as InstallSourceImage ,
34- { type : 'archive' , version : 'v26.1.4' , channel : 'stable' } as InstallSourceArchive ,
35- { type : 'archive' , version : 'latest' , channel : 'stable' } as InstallSourceArchive ,
36- ] ) (
30+ test . each ( getSources ( true ) ) (
3731 'install docker %s' , async ( source ) => {
3832 await ensureNoSystemContainerd ( ) ;
3933 const install = new Install ( {
@@ -48,16 +42,12 @@ describe('install', () => {
4842
4943describe ( 'rootless' , ( ) => {
5044 // prettier-ignore
51- test . each ( [
52- { type : 'image' , tag : 'latest' } as InstallSourceImage ,
53- { type : 'archive' , version : 'latest' , channel : 'stable' } as InstallSourceArchive ,
54- ] ) (
45+ test . each ( getSources ( false ) ) (
5546 'install %s' , async ( source ) => {
5647 // Skip on non linux
5748 if ( os . platform ( ) !== 'linux' ) {
5849 return ;
5950 }
60-
6151 await ensureNoSystemContainerd ( ) ;
6252 const install = new Install ( {
6353 source : source ,
@@ -109,3 +99,37 @@ async function ensureNoSystemContainerd() {
10999 } ) ;
110100 }
111101}
102+
103+ function getSources ( root : boolean ) : Array < InstallSource > {
104+ const dockerInstallType = process . env . DOCKER_INSTALL_TYPE ;
105+ const dockerInstallVersion = process . env . DOCKER_INSTALL_VERSION ;
106+ if ( dockerInstallType && dockerInstallVersion ) {
107+ if ( dockerInstallType === 'archive' ) {
108+ // prettier-ignore
109+ return [
110+ { type : dockerInstallType , version : dockerInstallVersion , channel : 'stable' } as InstallSourceArchive
111+ ] ;
112+ } else {
113+ // prettier-ignore
114+ return [
115+ { type : dockerInstallType , tag : dockerInstallVersion } as InstallSourceImage
116+ ] ;
117+ }
118+ }
119+ if ( root ) {
120+ // prettier-ignore
121+ return [
122+ { type : 'image' , tag : '27.3.1' } as InstallSourceImage ,
123+ { type : 'image' , tag : 'master' } as InstallSourceImage ,
124+ { type : 'image' , tag : 'latest' } as InstallSourceImage ,
125+ { type : 'archive' , version : 'v26.1.4' , channel : 'stable' } as InstallSourceArchive ,
126+ { type : 'archive' , version : 'latest' , channel : 'stable' } as InstallSourceArchive
127+ ] ;
128+ } else {
129+ // prettier-ignore
130+ return [
131+ { type : 'image' , tag : 'latest' } as InstallSourceImage ,
132+ { type : 'archive' , version : 'latest' , channel : 'stable' } as InstallSourceArchive
133+ ] ;
134+ }
135+ }
0 commit comments