@@ -6,14 +6,34 @@ import {
6
6
coderdPProfPort ,
7
7
e2eFakeExperiment1 ,
8
8
e2eFakeExperiment2 ,
9
- gitAuth ,
9
+ gitAuth , requireTerraformTests ,
10
10
} from "./constants" ;
11
+ import { execSync } from "child_process" ;
12
+ import { requiresTerraform } from "./helpers" ;
11
13
12
14
export const wsEndpoint = process . env . CODER_E2E_WS_ENDPOINT ;
13
15
14
16
// This is where auth cookies are stored!
15
17
export const storageState = path . join ( __dirname , ".auth.json" ) ;
16
18
19
+ if ( requireTerraformTests ) {
20
+ try {
21
+ // If running terraform tests, verify the requirements exist in the
22
+ // environment.
23
+ //
24
+ // These execs will throw an error if the status code is non-zero.
25
+ // So if both these work, then we can launch terraform provisioners.
26
+ const terraformExec = execSync ( 'terraform --version' )
27
+ const dockerExec = execSync ( 'dockser --version' )
28
+ } catch ( e ) {
29
+ throw new Error ( "Terraform provisioners require docker & terraform. " +
30
+ "At least one of these is not present in the runtime environment. To check yourself:\n" +
31
+ "\tterraform --version\n" +
32
+ "\tdocker --version" )
33
+ }
34
+ }
35
+
36
+
17
37
const localURL = ( port : number , path : string ) : string => {
18
38
return `http://localhost:${ port } ${ path } ` ;
19
39
} ;
@@ -60,7 +80,8 @@ export default defineConfig({
60
80
"--dangerous-disable-rate-limits" ,
61
81
"--provisioner-daemons 10" ,
62
82
// TODO: Enable some terraform provisioners
63
- "--provisioner-types=echo" ,
83
+ `--provisioner-types=echo${ requireTerraformTests ? ",terraform" : "" } ` ,
84
+ `--provisioner-daemons=10` ,
64
85
"--web-terminal-renderer=dom" ,
65
86
"--pprof-enable" ,
66
87
]
0 commit comments