@@ -6,9 +6,86 @@ import {
6
6
testRequiredVariables ,
7
7
} from "../test" ;
8
8
9
- describe ( "azure-region " , async ( ) => {
9
+ describe ( "filebrowser " , async ( ) => {
10
10
await runTerraformInit ( import . meta. dir ) ;
11
11
12
- testRequiredVariables ( import . meta. dir , { } ) ;
12
+ testRequiredVariables ( import . meta. dir , {
13
+ agent_id : "foo" ,
14
+ } ) ;
13
15
16
+ it ( "fails with wrong database_path" , async ( ) => {
17
+ const state = await runTerraformApply ( import . meta. dir , {
18
+ agent_id : "foo" ,
19
+ database_path : "nofb" ,
20
+ } ) . catch ( ( e ) => {
21
+ if ( ! e . message . startsWith ( "\nError: Invalid value for variable" ) ) {
22
+ throw e ;
23
+ }
24
+ } ) ;
25
+ } ) ;
26
+
27
+ it ( "runs with default" , async ( ) => {
28
+ const state = await runTerraformApply ( import . meta. dir , {
29
+ agent_id : "foo" ,
30
+ } ) ;
31
+ const output = await executeScriptInContainer ( state , "alpine" ) ;
32
+ expect ( output . exitCode ) . toBe ( 0 ) ;
33
+ expect ( output . stdout ) . toEqual ( [
34
+ "\u001b[0;1mInstalling filebrowser " ,
35
+ "" ,
36
+ "🥳 Installation comlete! " ,
37
+ "" ,
38
+ "👷 Starting filebrowser in background... " ,
39
+ "" ,
40
+ "📂 Serving /root at http://localhost:13339 " ,
41
+ "" ,
42
+ "Running 'filebrowser --noauth --root /root --port 13339' " ,
43
+ "" ,
44
+ "📝 Logs at /tmp/filebrowser.log" ,
45
+ ] ) ;
46
+ } ) ;
47
+
48
+ it ( "runs with database_path var" , async ( ) => {
49
+ const state = await runTerraformApply ( import . meta. dir , {
50
+ agent_id : "foo" ,
51
+ database_path : ".config/filebrowser.db" ,
52
+ } ) ;
53
+ const output = await executeScriptInContainer ( state , "alpine" ) ;
54
+ expect ( output . exitCode ) . toBe ( 0 ) ;
55
+ expect ( output . stdout ) . toEqual ( [
56
+ "\u001b[0;1mInstalling filebrowser " ,
57
+ "" ,
58
+ "🥳 Installation comlete! " ,
59
+ "" ,
60
+ "👷 Starting filebrowser in background... " ,
61
+ "" ,
62
+ "📂 Serving /root at http://localhost:13339 " ,
63
+ "" ,
64
+ "Running 'filebrowser --noauth --root /root --port 13339 -d .config/filebrowser.db' " ,
65
+ "" ,
66
+ "📝 Logs at /tmp/filebrowser.log" ,
67
+ ] ) ;
68
+ } ) ;
69
+
70
+ it ( "runs with folder var" , async ( ) => {
71
+ const state = await runTerraformApply ( import . meta. dir , {
72
+ agent_id : "foo" ,
73
+ folder : "/home/coder/project" ,
74
+ } ) ;
75
+ const output = await executeScriptInContainer ( state , "alpine" ) ;
76
+ expect ( output . exitCode ) . toBe ( 0 ) ;
77
+ expect ( output . stdout ) . toEqual ( [
78
+ "\u001B[0;1mInstalling filebrowser " ,
79
+ "" ,
80
+ "🥳 Installation comlete! " ,
81
+ "" ,
82
+ "👷 Starting filebrowser in background... " ,
83
+ "" ,
84
+ "📂 Serving /home/coder/project at http://localhost:13339 " ,
85
+ "" ,
86
+ "Running 'filebrowser --noauth --root /home/coder/project --port 13339' " ,
87
+ "" ,
88
+ "📝 Logs at /tmp/filebrowser.log" ,
89
+ ] ) ;
90
+ } ) ;
14
91
} ) ;
0 commit comments