ui/server/src/testSeams
the CONSTRUCT_E2E_* test seams: environment variables that exist only so the e2e suite can start the Cockpit with a project already open, clone from a local directory, or point the GitHub connection at a mock.
Cockpit server, next. Source: ui/server/src/testSeams.mjs.
Variables#
TEST_SEAM_VARS#
constTEST_SEAM_VARS:string[]
Defined in: ui/server/src/testSeams.mjs:33
Every variable named by a seam.
TEST_SEAMS#
constTEST_SEAMS:object
Defined in: ui/server/src/testSeams.mjs:17
key -> the variables of one seam and what it would let through.
Type Declaration#
cloneLocalRoot
cloneLocalRoot:
object
cloneLocalRoot.vars
vars:
string[]
cloneLocalRoot.why
why:
string='It lets file:// URLs under a directory be cloned; the production clone path is https-only.'
githubRepoBases
githubRepoBases:
object
githubRepoBases.vars
vars:
string[]
githubRepoBases.why
why:
string='They point the GitHub connection at a stand-in for github.com and api.github.com, so a login would go somewhere that is not GitHub.'
projectDir
projectDir:
object
projectDir.vars
vars:
string[]
projectDir.why
why:
string='It opens a project at start-up without anyone choosing it, which the Cockpit otherwise never does.'
Functions#
isProduction()#
isProduction(
env):boolean
Defined in: ui/server/src/testSeams.mjs:14
Case-insensitive on purpose, exactly as CONSTRUCT_AUTH_TEST_USER: NODE_ENV=Production is production.
Parameters#
env
any
Returns#
boolean
refuseTestSeam()#
refuseTestSeam(
env,host,key):object
Defined in: ui/server/src/testSeams.mjs:44
Throw AuthConfigError when key's seam is set in env and the process is a production one or is exposed beyond loopback.
-> the seam's non-empty variables (name -> raw value) for the caller to use when it is allowed.
Parameters#
env
Record<string, string>
host
string
the address the server binds
key
"projectDir" | "cloneLocalRoot" | "githubRepoBases"
Returns#
object
resolveHarnessSeams()#
resolveHarnessSeams(
env?,__namedParameters?):object
Defined in: ui/server/src/testSeams.mjs:65
The seams index.mjs itself consumes, checked as one: any CONSTRUCT_E2E_* variable at all in a production environment is refused (so a seam added later without a registry entry is still stopped), then each registered seam is checked for production and loopback. -> { projectDir: string|null, cloneLocalRoot: string|null }
Parameters#
env?
any = process.env
__namedParameters?
host?
string = '127.0.0.1'
Returns#
object
cloneLocalRoot
cloneLocalRoot:
any
projectDir
projectDir:
string