You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Export `getContainer` and `getContainerName` functions
This can be used to e.g. create the `runOCC` cypress command
* Make the container name dependent on the current app to prevent issues when reusing containers
* Allow to pass options for container creation to the `startNextcloud` function
* `forceRecreate` to not reuse any container but force creating a new one
* `mounts` to allow binding other directories to the container (e.g. server config)
* Allow to expose a port
Signed-off-by: Ferdinand Thiessen <[email protected]>
// Store the container name, different names are used to prevent conflicts when testing multiple apps locally
46
+
let_containerName: string|null=null
44
47
// Store latest server branch used, will be used for vendored apps
45
48
let_serverBranch='master'
46
49
50
+
/**
51
+
* Get the container name that is currently created and/or used by dockerode
52
+
*/
53
+
exportconstgetContainerName=function(): string{
54
+
if(_containerName===null){
55
+
constapp=basename(process.cwd()).replace(' ','')
56
+
_containerName=`nextcloud-cypress-tests_${app}`
57
+
}
58
+
return_containerName
59
+
}
60
+
61
+
/**
62
+
* Get the current container used
63
+
* Throws if not found
64
+
*/
65
+
exportconstgetContainer=function(): Container{
66
+
returndocker.getContainer(getContainerName())
67
+
}
68
+
69
+
interfaceStartOptions{
70
+
/**
71
+
* Force recreate the container even if an old one is found
72
+
* @default false
73
+
*/
74
+
forceRecreate?: boolean
75
+
76
+
/**
77
+
* Additional mounts to create on the container
78
+
* You can pass a mapping from server path (relative to Nextcloud root) to your local file system
79
+
* @example ```js
80
+
* { config: '/path/to/local/config' }
81
+
* ```
82
+
*/
83
+
mounts?: Record<string,string>
84
+
85
+
/**
86
+
* Optional port binding
87
+
* The default port (TCP 80) will be exposed to this host port
88
+
*/
89
+
exposePort?: number
90
+
}
91
+
47
92
/**
48
93
* Start the testing container
49
94
*
50
-
* @param branch server branch to use
51
-
* @param mountApp bind mount app within server (`true` for autodetect, `false` to disable, or a string to force a path)
95
+
* @param {string|undefined} branch server branch to use (default 'master')
96
+
* @param {boolean|string|undefined} mountApp bind mount app within server (`true` for autodetect, `false` to disable, or a string to force a path) (default true)
97
+
* @param {StartOptions|undefined} options Optional parameters to configre the container creation
52
98
* @return Promise resolving to the IP address of the server
53
99
* @throws {Error} If Nextcloud container could not be started
* @param {string[]} apps List of default apps to install (default is ['viewer'])
156
220
* @param {string|undefined} vendoredBranch The branch used for vendored apps, should match server (defaults to latest branch used for `startNextcloud` or fallsback to `master`)
221
+
* @param {Container|undefined} container Optional server container to use (defaults to current container)
0 commit comments