Unflatten features directory tree
This commit is contained in:
11
features/cli/debug.feature
Normal file
11
features/cli/debug.feature
Normal file
@@ -0,0 +1,11 @@
|
||||
Feature: CLI debug option
|
||||
|
||||
Background:
|
||||
Given a recipe with:
|
||||
"""
|
||||
task(:trigger_error) { fail 'some error' }
|
||||
"""
|
||||
|
||||
Scenario: reports recipe errors
|
||||
When I execute the recipe with option -d
|
||||
Then the output must match /\ARuntimeError:.*\n\ncause:\nRuntimeError:/
|
17
features/cli/dry_run.feature
Normal file
17
features/cli/dry_run.feature
Normal file
@@ -0,0 +1,17 @@
|
||||
Feature: CLI dry run option
|
||||
|
||||
Background:
|
||||
Given a recipe with:
|
||||
"""
|
||||
task :say_hello do
|
||||
echo 'hello'
|
||||
end
|
||||
"""
|
||||
|
||||
Scenario: perfoms a trial run without applying actions
|
||||
When I successfully execute the recipe with option -n
|
||||
Then the output must not contain "hello"
|
||||
|
||||
Scenario: prints a warning before any output
|
||||
When I successfully execute the recipe with option -n
|
||||
Then the output must match /\AWarning: running in dry run mode, actions will NOT be applied/
|
20
features/cli/error_reporting.feature
Normal file
20
features/cli/error_reporting.feature
Normal file
@@ -0,0 +1,20 @@
|
||||
Feature: CLI error reporting
|
||||
|
||||
Background:
|
||||
Given a recipe with:
|
||||
"""
|
||||
task(:trigger_error) { fail 'some error' }
|
||||
"""
|
||||
|
||||
Scenario: reports recipe errors
|
||||
When I execute the recipe
|
||||
Then the exit status must be 70
|
||||
And the output must match /\ARuntimeError: some error\n/
|
||||
|
||||
Scenario: reports errors with a backtrace
|
||||
When I execute the recipe
|
||||
Then the output must match /^\s+recipe\.rb:\d+:in /
|
||||
|
||||
Scenario: prepends recipe file path in the backtrace
|
||||
When I execute the recipe
|
||||
Then the output must match /^\s+recipe\.rb \(recipe\)\n\s+recipe\.rb:/
|
15
features/cli/target.feature
Normal file
15
features/cli/target.feature
Normal file
@@ -0,0 +1,15 @@
|
||||
Feature: CLI target option
|
||||
|
||||
Background:
|
||||
Given a recipe with:
|
||||
"""
|
||||
target 'some_host.example'
|
||||
|
||||
task :some_task do
|
||||
echo env.target
|
||||
end
|
||||
"""
|
||||
|
||||
Scenario: override the recipe target
|
||||
When I successfully execute the recipe with option -t other_host.example
|
||||
Then the output must contain exactly "other_host.example\n"
|
16
features/cli/usage.feature
Normal file
16
features/cli/usage.feature
Normal file
@@ -0,0 +1,16 @@
|
||||
Feature: CLI usage
|
||||
|
||||
@exec
|
||||
Scenario: prints the usage when an argument is missing
|
||||
When I run `producer`
|
||||
Then the exit status must be 64
|
||||
And the output must contain exactly:
|
||||
"""
|
||||
Usage: producer [options] [recipes]
|
||||
|
||||
options:
|
||||
-v, --verbose enable verbose mode
|
||||
-d, --debug enable debug mode
|
||||
-n, --dry-run enable dry run mode
|
||||
-t, --target HOST target host
|
||||
"""
|
43
features/cli/verbose.feature
Normal file
43
features/cli/verbose.feature
Normal file
@@ -0,0 +1,43 @@
|
||||
Feature: CLI verbose option
|
||||
|
||||
Background:
|
||||
Given a recipe with:
|
||||
"""
|
||||
task :task_ok do
|
||||
condition { true }
|
||||
|
||||
echo 'some message'
|
||||
end
|
||||
|
||||
task :task_ko do
|
||||
condition { false }
|
||||
end
|
||||
"""
|
||||
|
||||
Scenario: prints tasks name
|
||||
When I successfully execute the recipe with option -v
|
||||
Then the output must match /Task:.+`task_ok'/
|
||||
And the output must match /Task:.+`task_ko'/
|
||||
|
||||
Scenario: appends `applying' or `skipped' after tasks name
|
||||
When I successfully execute the recipe with option -v
|
||||
Then the output must match /task_ok.+applying...$/
|
||||
And the output must match /task_ko.+skipped$/
|
||||
|
||||
Scenario: prints actions info
|
||||
When I successfully execute the recipe with option -v
|
||||
Then the output must match /^ action: echo/
|
||||
|
||||
Scenario: prints actions arguments
|
||||
When I successfully execute the recipe with option -v
|
||||
Then the output must match /echo \["some message"\]/
|
||||
|
||||
Scenario: summarizes printed actions arguments
|
||||
Given a recipe with:
|
||||
"""
|
||||
task :some_task do
|
||||
echo 'long message ' * 32
|
||||
end
|
||||
"""
|
||||
When I successfully execute the recipe with option -v
|
||||
Then the output must match /action: .{,70}$/
|
Reference in New Issue
Block a user