File tree Expand file tree Collapse file tree 1 file changed +28
-3
lines changed
Expand file tree Collapse file tree 1 file changed +28
-3
lines changed Original file line number Diff line number Diff line change @@ -369,9 +369,21 @@ $ test -d /etc/nonexistant || true
369369
370370## Environment
371371
372- To set envrionment variables for this test run, add an ` envrionment ` key to the
373- frontmatter. ` $VARIABLES ` and ` ${VARIABLES} ` are interpreted within the values
374- of these entries using the shell environment of the controller.
372+ Shellinspector works with the environment like any other shell session.
373+ Variables stay within one session, i.e. ` $ ` and ` % ` lines do not share the same
374+ environment. They are cleared after the ispec file ends. Variables from file
375+ scoped fixtures are not cleared before the actual tests. Variables from global
376+ fixtures are cleared. The ` SI_USER ` variable is always passed from fixtures to
377+ the actual tests to all sessions. The value is taken from the first available
378+ session that has a value set.
379+
380+ There are multiple ways to set environment variables.
381+
382+ ### Frontmatter
383+
384+ Set the desired values in the ` environment ` key inside the frontmatter.
385+ ` $VARIABLES ` and ` ${VARIABLES} ` are interpreted within the values of these
386+ entries using the shell environment of the controller.
375387
376388` test.ispec ` :
377389
@@ -387,6 +399,19 @@ $ echo $OUTSIDE_PAGER
387399less
388400```
389401
402+ ### Shell
403+
404+ Use the ` export ` command like any shell session to set variables dynamically.
405+ To clear a variable, use the ` unset ` command.
406+
407+ ``` yaml
408+ $ export DNS_SERVER=1.1.1.1
409+ $ echo $DNS_SERVER
410+ 1.1.1.1
411+ $ unset DNS_SERVER
412+ $ echo $DNS_SERVER
413+ ```
414+
390415## Parametrized tests
391416
392417To run many similar tests, add an ` examples ` key to the frontmatter:
You can’t perform that action at this time.
0 commit comments