Logo: Relish

  1. Sign in

Project: Rebuild

rbld run

As a CLI user
I want to be able to run existing environments with rbld run

Background
Given
existing environments:
test-env:initial
test-env:v001
Scenarios
run help succeeds and usage is printed
Given
I successfully request help for rbld run
Then
help output should contain "rbld run [OPTIONS] [ENVIRONMENT[:TAG]]"
And
help output should contain "Interactive mode: opens shell in the specified enviroment"
And
help output should contain "rbld run [OPTIONS] [ENVIRONMENT[:TAG]] -- COMMANDS"
And
help output should contain "Scripting mode: runs COMMANDS in the specified environment"
And
help output should contain "Run command in a local environment"
And
help output should match "-p, --privileged.*Run environment with superuser privileges"
And
help output should match "-h, --help.*Print usage"
error printed for non-existing environments
When
I run rbld run non-existing environment name
Then
it should fail with:
ERROR: Unknown environment full environment name
Examples:
non-existing environment name full environment name
nonexisting nonexisting:initial
nonexisting:sometag nonexisting:sometag
non-interactive running of environments
When
I successfully run rbld run environment name -- echo Hello world!
Then
it should pass with exactly:
>>> rebuild env environment host name
>>> echo Hello world!
Hello world!
 rebuild env environment host name
Examples:
environment name environment host name
test-env:v001 test-env-v001
test-env test-env-initial
non-interactive run without command line options separator
When
I successfully run rbld run test-env:v001 echo Hello world!
Then
it should pass with exactly:
>>> rebuild env test-env-v001
>>> echo Hello world!
Hello world!
<<< rebuild env test-env-v001
interactive running of environment
When
I run rbld run environment name interactively
And
I type "echo Hello interactive world!"
And
I close the stdin stream
Then
it should pass with exactly:
>>> rebuild env environment host name interactive
>>> Press CTRL-D do leave
Hello interactive world!

 rebuild env environment host name
Examples:
environment name environment host name
test-env:v001 test-env-v001
test-env test-env-initial
warning printed when running modified environment
Given
environment test-env:v001 is modified
When
I run rbld run test-env:v001 -- echo Hello world!
Then
the output should contain "WARNING: Environment is modified, running original version"
And
the output should contain ">>> rebuild env test-env-v001"
And
the output should contain ">>> echo Hello world!"
And
the output should contain "Hello world!"
And
the output should contain "<<< rebuild env test-env-v001"
hostname of environment set to the environment name
When
I run rbld run test-env:v001 -- hostname
Then
it should pass with exactly:
>>> rebuild env test-env-v001
>>> hostname
test-env-v001
<<< rebuild env test-env-v001
rbld run propagates exit code
When
I run rbld run test-env:v001 -- exit status
Then
the exit status should be status
Examples:
status
0
5
bootstrap tracing is disabled by default
When
I run rbld run test-env:v001 -- echo Hi
Then
the output should not contain "Bootstrap tracing enabled"
bootstrap tracing is enabled by RBLD_BOOTSTRAP_TRACE environment variable
Given
I set the environment variables to:
variable value
RBLD_BOOTSTRAP_TRACE 1
When
I run rbld run test-env:v001 -- echo Hi
Then
the output should contain "Bootstrap tracing enabled"
environments do not have superuser privileges by default
Given
a file named "test.ko" with "DUMMY"
When
I run rbld run test-env -- sudo insmod test.ko
Then
it should fail with "Operation not permitted"
environments may be run with superuser priviledges
Given
a file named "test.ko" with "DUMMY"
When
I run rbld run privileged flag test-env -- sudo insmod test.ko
Then
it should fail with "invalid module format"
Examples:
privileged flag
--privileged
-p

Last published almost 5 years ago by Rebuild.