producer-core 0.5.8 → 0.5.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/producer/core/version.rb +1 -1
- metadata +21 -202
- data/.gitignore +0 -3
- data/.travis.yml +0 -14
- data/Gemfile +0 -5
- data/Guardfile +0 -14
- data/LICENSE +0 -30
- data/Rakefile +0 -19
- data/config/cucumber.yaml +0 -2
- data/features/actions/echo.feature +0 -11
- data/features/actions/file_append.feature +0 -15
- data/features/actions/file_replace_content.feature +0 -24
- data/features/actions/file_write.feature +0 -21
- data/features/actions/mkdir.feature +0 -31
- data/features/actions/sh.feature +0 -43
- data/features/actions/yaml_write.feature +0 -14
- data/features/cli/debug.feature +0 -19
- data/features/cli/dry_run.feature +0 -22
- data/features/cli/error_reporting.feature +0 -32
- data/features/cli/target.feature +0 -15
- data/features/cli/usage.feature +0 -13
- data/features/cli/verbose.feature +0 -48
- data/features/condition/negated_test.feature +0 -47
- data/features/condition/target.feature +0 -15
- data/features/recipe/compose_macro.feature +0 -29
- data/features/recipe/errors.feature +0 -9
- data/features/recipe/macro.feature +0 -50
- data/features/recipe/registry.feature +0 -82
- data/features/recipe/source.feature +0 -17
- data/features/recipe/target.feature +0 -23
- data/features/recipe/test_macro.feature +0 -50
- data/features/ssh/config.feature +0 -25
- data/features/steps/environment_steps.rb +0 -3
- data/features/support/env.rb +0 -1
- data/features/task/ask.feature +0 -23
- data/features/task/condition.feature +0 -13
- data/features/task/nested_tasks.feature +0 -20
- data/features/task/recipe_argv.feature +0 -13
- data/features/task/target.feature +0 -11
- data/features/task/template.feature +0 -49
- data/features/tests/dir.feature +0 -21
- data/features/tests/env.feature +0 -47
- data/features/tests/executable.feature +0 -26
- data/features/tests/file.feature +0 -21
- data/features/tests/file_contains.feature +0 -26
- data/features/tests/file_eq.feature +0 -26
- data/features/tests/file_match.feature +0 -26
- data/features/tests/shell_command_status.feature +0 -46
- data/features/tests/yaml_eq.feature +0 -26
- data/producer-core.gemspec +0 -28
- data/spec/fixtures/recipes/empty.rb +0 -1
- data/spec/fixtures/recipes/raise.rb +0 -1
- data/spec/fixtures/recipes/some_recipe.rb +0 -5
- data/spec/fixtures/recipes/throw.rb +0 -1
- data/spec/fixtures/templates/basic.erb +0 -1
- data/spec/fixtures/templates/basic_yaml.yaml +0 -1
- data/spec/fixtures/templates/variables.erb +0 -1
- data/spec/producer/core/action_spec.rb +0 -46
- data/spec/producer/core/actions/echo_spec.rb +0 -20
- data/spec/producer/core/actions/file_append_spec.rb +0 -49
- data/spec/producer/core/actions/file_replace_content_spec.rb +0 -42
- data/spec/producer/core/actions/file_writer_spec.rb +0 -52
- data/spec/producer/core/actions/mkdir_spec.rb +0 -71
- data/spec/producer/core/actions/shell_command_spec.rb +0 -45
- data/spec/producer/core/actions/yaml_writer_spec.rb +0 -25
- data/spec/producer/core/cli_spec.rb +0 -211
- data/spec/producer/core/condition_spec.rb +0 -198
- data/spec/producer/core/env_spec.rb +0 -196
- data/spec/producer/core/error_formatter_spec.rb +0 -86
- data/spec/producer/core/logger_formatter_spec.rb +0 -26
- data/spec/producer/core/prompter_spec.rb +0 -40
- data/spec/producer/core/recipe/file_evaluator_spec.rb +0 -22
- data/spec/producer/core/recipe_spec.rb +0 -126
- data/spec/producer/core/remote/environment_spec.rb +0 -19
- data/spec/producer/core/remote/fs_spec.rb +0 -144
- data/spec/producer/core/remote_spec.rb +0 -168
- data/spec/producer/core/task_spec.rb +0 -198
- data/spec/producer/core/template_spec.rb +0 -41
- data/spec/producer/core/test_spec.rb +0 -7
- data/spec/producer/core/testing/mock_remote_spec.rb +0 -66
- data/spec/producer/core/tests/condition_test_spec.rb +0 -55
- data/spec/producer/core/tests/file_contains_spec.rb +0 -46
- data/spec/producer/core/tests/file_eq_spec.rb +0 -45
- data/spec/producer/core/tests/file_match_spec.rb +0 -46
- data/spec/producer/core/tests/has_dir_spec.rb +0 -25
- data/spec/producer/core/tests/has_env_spec.rb +0 -75
- data/spec/producer/core/tests/has_executable_spec.rb +0 -29
- data/spec/producer/core/tests/has_file_spec.rb +0 -25
- data/spec/producer/core/tests/shell_command_status_spec.rb +0 -34
- data/spec/producer/core/tests/yaml_eq_spec.rb +0 -47
- data/spec/producer/core/worker_spec.rb +0 -88
- data/spec/spec_helper.rb +0 -13
- data/spec/support/exit_helpers.rb +0 -6
- data/spec/support/fixtures_helpers.rb +0 -7
- data/spec/support/net_ssh_story_helpers.rb +0 -36
- data/spec/support/shared_action.rb +0 -44
- data/spec/support/shared_test.rb +0 -82
- data/spec/support/test_env_helpers.rb +0 -44
data/features/cli/target.feature
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
Feature: CLI target option
|
2
|
-
|
3
|
-
Background:
|
4
|
-
Given a recipe with:
|
5
|
-
"""
|
6
|
-
target 'some_host.example'
|
7
|
-
|
8
|
-
task :some_task do
|
9
|
-
echo env.target
|
10
|
-
end
|
11
|
-
"""
|
12
|
-
|
13
|
-
Scenario: override the recipe target
|
14
|
-
When I successfully execute the recipe with option -t other_host.example
|
15
|
-
Then the output must contain exactly "other_host.example\n"
|
data/features/cli/usage.feature
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
Feature: CLI usage
|
2
|
-
|
3
|
-
@exec
|
4
|
-
Scenario: prints the usage when an argument is missing
|
5
|
-
When I run `producer`
|
6
|
-
Then the exit status must be 64
|
7
|
-
And the output must contain exactly the usage
|
8
|
-
|
9
|
-
@exec
|
10
|
-
Scenario: prints the usage when unknown option switch is given
|
11
|
-
When I run `producer --unknown-option`
|
12
|
-
Then the exit status must be 64
|
13
|
-
And the output must contain exactly the usage
|
@@ -1,48 +0,0 @@
|
|
1
|
-
Feature: CLI verbose option
|
2
|
-
|
3
|
-
Background:
|
4
|
-
Given a recipe with:
|
5
|
-
"""
|
6
|
-
task :task_ok do
|
7
|
-
condition { true }
|
8
|
-
|
9
|
-
echo 'some message'
|
10
|
-
end
|
11
|
-
|
12
|
-
task :task_ko do
|
13
|
-
condition { false }
|
14
|
-
end
|
15
|
-
"""
|
16
|
-
|
17
|
-
Scenario: prints tasks name
|
18
|
-
When I successfully execute the recipe with option -v
|
19
|
-
Then the output must match /Task:.+`task_ok'/
|
20
|
-
And the output must match /Task:.+`task_ko'/
|
21
|
-
|
22
|
-
Scenario: appends `applying' or `skipped' after tasks name
|
23
|
-
When I successfully execute the recipe with option -v
|
24
|
-
Then the output must match /task_ok.+applying...$/
|
25
|
-
And the output must match /task_ko.+skipped$/
|
26
|
-
|
27
|
-
Scenario: prints actions info
|
28
|
-
When I successfully execute the recipe with option -v
|
29
|
-
Then the output must match /^ action: echo/
|
30
|
-
|
31
|
-
Scenario: prints actions arguments
|
32
|
-
When I successfully execute the recipe with option -v
|
33
|
-
Then the output must match /echo \["some message"\]/
|
34
|
-
|
35
|
-
Scenario: summarizes printed actions arguments
|
36
|
-
Given a recipe with:
|
37
|
-
"""
|
38
|
-
task :some_task do
|
39
|
-
echo 'long message ' * 32
|
40
|
-
end
|
41
|
-
"""
|
42
|
-
When I successfully execute the recipe with option -v
|
43
|
-
Then the output must match /action: .{,70}$/
|
44
|
-
|
45
|
-
Scenario: enables verbose mode from the environment
|
46
|
-
Given I set the environment variable "PRODUCER_VERBOSE"
|
47
|
-
When I successfully execute the recipe
|
48
|
-
Then the output must contain "Task"
|
@@ -1,47 +0,0 @@
|
|
1
|
-
Feature: negated test prefix (no_)
|
2
|
-
|
3
|
-
Scenario: prefixed test fails when non-prefixed test is successful
|
4
|
-
Given a recipe with:
|
5
|
-
"""
|
6
|
-
test_macro :even? do |n|
|
7
|
-
n % 2 == 0
|
8
|
-
end
|
9
|
-
|
10
|
-
task :successful_test do
|
11
|
-
condition { even? 4 }
|
12
|
-
|
13
|
-
echo 'successful_test'
|
14
|
-
end
|
15
|
-
|
16
|
-
task :negated_test do
|
17
|
-
condition { no_even? 4 }
|
18
|
-
|
19
|
-
echo 'negated_test'
|
20
|
-
end
|
21
|
-
"""
|
22
|
-
When I successfully execute the recipe
|
23
|
-
Then the output must contain "successful_test"
|
24
|
-
And the output must not contain "negated_test"
|
25
|
-
|
26
|
-
Scenario: prefixed test succeed when non-prefixed test is failing
|
27
|
-
Given a recipe with:
|
28
|
-
"""
|
29
|
-
test_macro :even? do |n|
|
30
|
-
n % 2 == 0
|
31
|
-
end
|
32
|
-
|
33
|
-
task :failing_test do
|
34
|
-
condition { even? 5 }
|
35
|
-
|
36
|
-
echo 'failing_test'
|
37
|
-
end
|
38
|
-
|
39
|
-
task :negated_test do
|
40
|
-
condition { no_even? 5 }
|
41
|
-
|
42
|
-
echo 'negated_test'
|
43
|
-
end
|
44
|
-
"""
|
45
|
-
When I successfully execute the recipe
|
46
|
-
Then the output must not contain "failing_test"
|
47
|
-
And the output must contain "negated_test"
|
@@ -1,15 +0,0 @@
|
|
1
|
-
Feature: `target' condition keyword
|
2
|
-
|
3
|
-
Scenario: returns the current target
|
4
|
-
Given a recipe with:
|
5
|
-
"""
|
6
|
-
target 'some_host.example'
|
7
|
-
|
8
|
-
task :test_target do
|
9
|
-
condition { target == 'some_host.example' }
|
10
|
-
|
11
|
-
echo 'OK'
|
12
|
-
end
|
13
|
-
"""
|
14
|
-
When I execute the recipe
|
15
|
-
Then the output must contain "OK"
|
@@ -1,29 +0,0 @@
|
|
1
|
-
Feature: `compose_macro' recipe keyword
|
2
|
-
|
3
|
-
Background:
|
4
|
-
Given a recipe named "composed_macro.rb" with:
|
5
|
-
"""
|
6
|
-
macro :hello do |prefix, *args|
|
7
|
-
echo 'hello %s %s' % [prefix, args.join(', ')]
|
8
|
-
end
|
9
|
-
|
10
|
-
compose_macro :hello_composed, :hello, 'composed'
|
11
|
-
"""
|
12
|
-
|
13
|
-
Scenario: declares a composed macro as recipe keyword
|
14
|
-
Given a recipe with:
|
15
|
-
"""
|
16
|
-
source 'composed_macro'
|
17
|
-
hello_composed :foo, :bar
|
18
|
-
"""
|
19
|
-
When I successfully execute the recipe
|
20
|
-
Then the output must contain "hello composed foo, bar"
|
21
|
-
|
22
|
-
Scenario: declares a composed macro as task keyword
|
23
|
-
Given a recipe with:
|
24
|
-
"""
|
25
|
-
source 'composed_macro'
|
26
|
-
task(:some_task) { hello_composed :foo, :bar }
|
27
|
-
"""
|
28
|
-
When I successfully execute the recipe
|
29
|
-
Then the output must contain "hello composed foo, bar"
|
@@ -1,50 +0,0 @@
|
|
1
|
-
Feature: `macro' recipe keyword
|
2
|
-
|
3
|
-
Scenario: declares a new recipe keyword accepting task code
|
4
|
-
Given a recipe with:
|
5
|
-
"""
|
6
|
-
macro :hello do
|
7
|
-
echo 'hello macro'
|
8
|
-
end
|
9
|
-
|
10
|
-
hello
|
11
|
-
"""
|
12
|
-
When I successfully execute the recipe
|
13
|
-
Then the output must contain "hello macro"
|
14
|
-
|
15
|
-
Scenario: declares a new task keyword
|
16
|
-
Given a recipe with:
|
17
|
-
"""
|
18
|
-
macro(:hello) { echo 'hello macro' }
|
19
|
-
|
20
|
-
task(:some_task) { hello }
|
21
|
-
"""
|
22
|
-
When I successfully execute the recipe
|
23
|
-
Then the output must contain "hello macro"
|
24
|
-
|
25
|
-
Scenario: supports arguments
|
26
|
-
Given a recipe with:
|
27
|
-
"""
|
28
|
-
macro :my_echo do |kind, message|
|
29
|
-
echo "#{kind}: #{message}"
|
30
|
-
end
|
31
|
-
|
32
|
-
my_echo 'my', 'hello'
|
33
|
-
"""
|
34
|
-
When I successfully execute the recipe
|
35
|
-
Then the output must contain "my: hello"
|
36
|
-
|
37
|
-
Scenario: supports arguments in conditions
|
38
|
-
Given a recipe with:
|
39
|
-
"""
|
40
|
-
macro :my_echo do |message|
|
41
|
-
condition { message =~ /foo/ }
|
42
|
-
|
43
|
-
echo message
|
44
|
-
end
|
45
|
-
|
46
|
-
%w[foo bar].each { |e| my_echo e }
|
47
|
-
"""
|
48
|
-
When I successfully execute the recipe
|
49
|
-
Then the output must contain "foo"
|
50
|
-
And the output must not contain "bar"
|
@@ -1,82 +0,0 @@
|
|
1
|
-
Feature: key/value registry
|
2
|
-
|
3
|
-
Scenario: `get' keyword in a task fetches a value registered with `set'
|
4
|
-
Given a recipe with:
|
5
|
-
"""
|
6
|
-
set :some_key, 'some_value'
|
7
|
-
|
8
|
-
task :registry_testing do
|
9
|
-
echo get :some_key
|
10
|
-
end
|
11
|
-
"""
|
12
|
-
When I successfully execute the recipe
|
13
|
-
Then the output must contain "some_value"
|
14
|
-
|
15
|
-
Scenario: `get' keyword fetches a value from the recipe
|
16
|
-
Given a recipe with:
|
17
|
-
"""
|
18
|
-
set :some_key, 'some_value'
|
19
|
-
set :other_key, get(:some_key)
|
20
|
-
|
21
|
-
task :registry_testing do
|
22
|
-
echo get :other_key
|
23
|
-
end
|
24
|
-
"""
|
25
|
-
When I successfully execute the recipe
|
26
|
-
Then the output must contain "some_value"
|
27
|
-
|
28
|
-
Scenario: `get' keyword fetches a value from a condition
|
29
|
-
Given a recipe with:
|
30
|
-
"""
|
31
|
-
set :some_key, 'some_value'
|
32
|
-
|
33
|
-
task(:ok) { condition { get :some_key }; echo get :some_key }
|
34
|
-
"""
|
35
|
-
When I successfully execute the recipe
|
36
|
-
Then the output must contain "some_value"
|
37
|
-
|
38
|
-
Scenario: `get' keyword should trigger an error when given invalid key
|
39
|
-
Given a recipe with:
|
40
|
-
"""
|
41
|
-
task :some_task do
|
42
|
-
echo get :no_key
|
43
|
-
echo 'after_fail'
|
44
|
-
end
|
45
|
-
"""
|
46
|
-
When I execute the recipe
|
47
|
-
Then the output must not contain "after_fail"
|
48
|
-
And the output must match /\A\w+Error:\s+:no_key/
|
49
|
-
|
50
|
-
Scenario: `get' keyword accepts a default value
|
51
|
-
Given a recipe with:
|
52
|
-
"""
|
53
|
-
task :registry_testing do
|
54
|
-
echo get(:some_key, 'some_value')
|
55
|
-
end
|
56
|
-
"""
|
57
|
-
When I successfully execute the recipe
|
58
|
-
Then the output must contain "some_value"
|
59
|
-
|
60
|
-
Scenario: `set' keyword sets a value from a task
|
61
|
-
Given a recipe with:
|
62
|
-
"""
|
63
|
-
task :registry_testing do
|
64
|
-
set :some_key, 'some_value'
|
65
|
-
echo get :some_key
|
66
|
-
end
|
67
|
-
"""
|
68
|
-
When I successfully execute the recipe
|
69
|
-
Then the output must contain "some_value"
|
70
|
-
|
71
|
-
Scenario: `set?' keyword tests wether given key is defined
|
72
|
-
Given a recipe with:
|
73
|
-
"""
|
74
|
-
set :some_key, 'some_value'
|
75
|
-
task :registry_testing do
|
76
|
-
echo 'some_value_set' if set? :some_key
|
77
|
-
echo 'other_value' if set? :other_key
|
78
|
-
end
|
79
|
-
"""
|
80
|
-
When I execute the recipe
|
81
|
-
Then the output must contain "some_value_set"
|
82
|
-
And the output must not contain "other_value"
|
@@ -1,17 +0,0 @@
|
|
1
|
-
Feature: `source' recipe keyword
|
2
|
-
|
3
|
-
Background:
|
4
|
-
Given a recipe with:
|
5
|
-
"""
|
6
|
-
source 'sourced_recipe'
|
7
|
-
"""
|
8
|
-
|
9
|
-
Scenario: requires a recipe file
|
10
|
-
Given a file named "sourced_recipe.rb" with:
|
11
|
-
"""
|
12
|
-
task :some_task do
|
13
|
-
echo 'sourced recipe'
|
14
|
-
end
|
15
|
-
"""
|
16
|
-
When I successfully execute the recipe
|
17
|
-
Then the output must contain "sourced recipe"
|
@@ -1,23 +0,0 @@
|
|
1
|
-
Feature: `target' recipe keyword
|
2
|
-
|
3
|
-
Scenario: registers the target host on which tasks should be applied
|
4
|
-
Given a recipe with:
|
5
|
-
"""
|
6
|
-
target 'some_host.example'
|
7
|
-
|
8
|
-
task :some_task do
|
9
|
-
echo env.target
|
10
|
-
end
|
11
|
-
"""
|
12
|
-
When I successfully execute the recipe
|
13
|
-
Then the output must contain "some_host.example"
|
14
|
-
|
15
|
-
Scenario: returns current target when no arguments are provided
|
16
|
-
Given a recipe with:
|
17
|
-
"""
|
18
|
-
target 'some_host.example'
|
19
|
-
|
20
|
-
env.output.puts target
|
21
|
-
"""
|
22
|
-
When I successfully execute the recipe
|
23
|
-
Then the output must contain "some_host.example"
|
@@ -1,50 +0,0 @@
|
|
1
|
-
Feature: `test_macro' recipe keyword
|
2
|
-
|
3
|
-
Scenario: declares a new test keyword
|
4
|
-
Given a recipe with:
|
5
|
-
"""
|
6
|
-
test_macro :even? do |n|
|
7
|
-
n % 2 == 0
|
8
|
-
end
|
9
|
-
|
10
|
-
[1, 2].each do |n|
|
11
|
-
task "test_macro-even-#{n}" do
|
12
|
-
condition { even? n }
|
13
|
-
echo n
|
14
|
-
end
|
15
|
-
end
|
16
|
-
"""
|
17
|
-
When I successfully execute the recipe
|
18
|
-
Then the output must contain "2"
|
19
|
-
And the output must not contain "1"
|
20
|
-
|
21
|
-
@sshd
|
22
|
-
Scenario: has access to core tests
|
23
|
-
Given a recipe with:
|
24
|
-
"""
|
25
|
-
test_macro(:other_env?) { |k| env? k }
|
26
|
-
|
27
|
-
[:shell, :non_existent_var].each do |k|
|
28
|
-
task "test_macro-condition-#{k}" do
|
29
|
-
condition { other_env? k }
|
30
|
-
echo "#{k}_ok"
|
31
|
-
end
|
32
|
-
end
|
33
|
-
"""
|
34
|
-
When I successfully execute the recipe on remote target
|
35
|
-
Then the output must contain "shell_ok"
|
36
|
-
Then the output must not contain "non_existent_var_ok"
|
37
|
-
|
38
|
-
Scenario: has access to other tests declared with `test_macro'
|
39
|
-
Given a recipe with:
|
40
|
-
"""
|
41
|
-
test_macro(:one?) { |e| e == 1 }
|
42
|
-
test_macro(:one_alias?) { |e| one? e }
|
43
|
-
|
44
|
-
task :test_macro_macro do
|
45
|
-
condition { one_alias? 1 }
|
46
|
-
echo 'one_alias_ok'
|
47
|
-
end
|
48
|
-
"""
|
49
|
-
When I successfully execute the recipe
|
50
|
-
Then the output must contain "one_alias_ok"
|
data/features/ssh/config.feature
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
Feature: SSH settings
|
2
|
-
|
3
|
-
Background:
|
4
|
-
Given a recipe with:
|
5
|
-
"""
|
6
|
-
target 'some_host.example'
|
7
|
-
|
8
|
-
task :some_task do
|
9
|
-
echo env.remote.user_name
|
10
|
-
end
|
11
|
-
"""
|
12
|
-
|
13
|
-
Scenario: uses current user login name as SSH user name by default
|
14
|
-
When I successfully execute the recipe
|
15
|
-
Then the output must contain my current login name
|
16
|
-
|
17
|
-
@mocked-home-directory
|
18
|
-
Scenario: uses configured SSH user name for a given host
|
19
|
-
Given an SSH config with:
|
20
|
-
"""
|
21
|
-
Host some_host.example
|
22
|
-
User some_user
|
23
|
-
"""
|
24
|
-
When I successfully execute the recipe
|
25
|
-
Then the output must contain "some_user"
|
data/features/support/env.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require 'producer/core/testing/cucumber'
|
data/features/task/ask.feature
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
Feature: `ask' task keyword
|
2
|
-
|
3
|
-
@exec
|
4
|
-
Scenario: prompts user with a list of choices on standard output
|
5
|
-
Given a recipe with:
|
6
|
-
"""
|
7
|
-
task :ask_letter do
|
8
|
-
letter = ask 'Which letter?', [[:a, ?A], [:b, ?B]]
|
9
|
-
|
10
|
-
echo letter.inspect
|
11
|
-
end
|
12
|
-
"""
|
13
|
-
When I execute the recipe interactively
|
14
|
-
And I type "1"
|
15
|
-
Then the output must contain:
|
16
|
-
"""
|
17
|
-
Which letter?
|
18
|
-
0: A
|
19
|
-
1: B
|
20
|
-
Choice:
|
21
|
-
:b
|
22
|
-
"""
|
23
|
-
And the exit status must be 0
|
@@ -1,13 +0,0 @@
|
|
1
|
-
Feature: `condition' task keyword
|
2
|
-
|
3
|
-
Scenario: prevents task actions application when condition is not met
|
4
|
-
Given a recipe with:
|
5
|
-
"""
|
6
|
-
task :some_task do
|
7
|
-
condition { false }
|
8
|
-
|
9
|
-
echo 'evaluated'
|
10
|
-
end
|
11
|
-
"""
|
12
|
-
When I successfully execute the recipe
|
13
|
-
Then the output must not contain "evaluated"
|
@@ -1,20 +0,0 @@
|
|
1
|
-
Feature: nested tasks
|
2
|
-
|
3
|
-
Background:
|
4
|
-
Given a recipe with:
|
5
|
-
"""
|
6
|
-
task :outer_task do
|
7
|
-
task :inner_task do
|
8
|
-
echo 'OK'
|
9
|
-
end
|
10
|
-
end
|
11
|
-
"""
|
12
|
-
|
13
|
-
Scenario: applies nested tasks
|
14
|
-
When I successfully execute the recipe
|
15
|
-
Then the output must match /\AOK/
|
16
|
-
|
17
|
-
Scenario: indents logging from nested tasks
|
18
|
-
When I successfully execute the recipe with option -v
|
19
|
-
Then the output must match /^ Task:.+/
|
20
|
-
And the output must match /^ action:.+/
|
@@ -1,13 +0,0 @@
|
|
1
|
-
Feature: `recipe_argv' task keyword
|
2
|
-
|
3
|
-
Background:
|
4
|
-
Given a recipe with:
|
5
|
-
"""
|
6
|
-
task :echo_arguments do
|
7
|
-
echo recipe_argv
|
8
|
-
end
|
9
|
-
"""
|
10
|
-
|
11
|
-
Scenario: returns recipe arguments
|
12
|
-
When I successfully execute the recipe with arguments "foo bar"
|
13
|
-
Then the output must contain exactly "foo\nbar\n"
|
@@ -1,49 +0,0 @@
|
|
1
|
-
Feature: `template' task keyword
|
2
|
-
|
3
|
-
Scenario: renders an ERB template file
|
4
|
-
Given a file named "templates/basic.erb" with:
|
5
|
-
"""
|
6
|
-
basic template
|
7
|
-
"""
|
8
|
-
And a recipe with:
|
9
|
-
"""
|
10
|
-
task(:echo_template) { echo template 'basic' }
|
11
|
-
"""
|
12
|
-
When I execute the recipe
|
13
|
-
Then the output must contain "basic template"
|
14
|
-
|
15
|
-
Scenario: renders ERB with given attributes as member data
|
16
|
-
Given a file named "templates/variables.erb" with:
|
17
|
-
"""
|
18
|
-
<%= @foo %>
|
19
|
-
"""
|
20
|
-
And a recipe with:
|
21
|
-
"""
|
22
|
-
task(:echo_template) { echo template('variables', foo: 'bar') }
|
23
|
-
"""
|
24
|
-
When I execute the recipe
|
25
|
-
Then the output must contain "bar"
|
26
|
-
|
27
|
-
Scenario: renders without `templates' search path
|
28
|
-
Given a file named "templates/basic.erb" with:
|
29
|
-
"""
|
30
|
-
basic template
|
31
|
-
"""
|
32
|
-
And a recipe with:
|
33
|
-
"""
|
34
|
-
task(:echo_template) { echo template './templates/basic' }
|
35
|
-
"""
|
36
|
-
When I execute the recipe
|
37
|
-
Then the output must contain "basic template"
|
38
|
-
|
39
|
-
Scenario: parses a yaml file
|
40
|
-
Given a file named "templates/basic.yaml" with:
|
41
|
-
"""
|
42
|
-
foo: bar
|
43
|
-
"""
|
44
|
-
And a recipe with:
|
45
|
-
"""
|
46
|
-
task(:echo_template) { echo template('basic')['foo'] }
|
47
|
-
"""
|
48
|
-
When I execute the recipe
|
49
|
-
Then the output must match /^bar$/
|
data/features/tests/dir.feature
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
@sshd
|
2
|
-
Feature: `dir?' condition keyword
|
3
|
-
|
4
|
-
Background:
|
5
|
-
Given a recipe with:
|
6
|
-
"""
|
7
|
-
task :dir_test do
|
8
|
-
condition { dir? 'some_directory' }
|
9
|
-
|
10
|
-
echo 'evaluated'
|
11
|
-
end
|
12
|
-
"""
|
13
|
-
|
14
|
-
Scenario: succeeds when directory exists
|
15
|
-
Given a remote directory named "some_directory"
|
16
|
-
When I successfully execute the recipe on remote target
|
17
|
-
Then the output must contain "evaluated"
|
18
|
-
|
19
|
-
Scenario: fails when directory does not exist
|
20
|
-
When I successfully execute the recipe on remote target
|
21
|
-
Then the output must not contain "evaluated"
|
data/features/tests/env.feature
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
@sshd
|
2
|
-
Feature: `env?' condition keyword
|
3
|
-
|
4
|
-
Background:
|
5
|
-
Given a recipe with:
|
6
|
-
"""
|
7
|
-
task :env_test_definition_ok do
|
8
|
-
condition { env? :shell }
|
9
|
-
|
10
|
-
echo 'definition_ok'
|
11
|
-
end
|
12
|
-
|
13
|
-
task :env_test_definition_ko do
|
14
|
-
condition { env? :non_existent_var }
|
15
|
-
|
16
|
-
echo 'definition_ko'
|
17
|
-
end
|
18
|
-
|
19
|
-
task :env_test_value do
|
20
|
-
condition { env? :shell, '/bin/sh' }
|
21
|
-
|
22
|
-
echo 'value_ok'
|
23
|
-
end
|
24
|
-
|
25
|
-
task :env_test_value do
|
26
|
-
condition { env? :shell, 'non_existent_shell' }
|
27
|
-
|
28
|
-
echo 'value_ko'
|
29
|
-
end
|
30
|
-
"""
|
31
|
-
|
32
|
-
Scenario: succeeds when remote environment variable is defined
|
33
|
-
When I successfully execute the recipe on remote target
|
34
|
-
Then the output must contain "definition_ok"
|
35
|
-
|
36
|
-
Scenario: fails when remote environment variable is not defined
|
37
|
-
When I successfully execute the recipe on remote target
|
38
|
-
Then the output must not contain "definition_ko"
|
39
|
-
|
40
|
-
@ci_skip
|
41
|
-
Scenario: succeeds when remote environment variable value match
|
42
|
-
When I successfully execute the recipe on remote target
|
43
|
-
Then the output must contain "value_ok"
|
44
|
-
|
45
|
-
Scenario: fails when remote environment variable value does not match
|
46
|
-
When I successfully execute the recipe on remote target
|
47
|
-
Then the output must not contain "value_ko"
|
@@ -1,26 +0,0 @@
|
|
1
|
-
@sshd
|
2
|
-
Feature: `executable?' condition keyword
|
3
|
-
|
4
|
-
Background:
|
5
|
-
Given a recipe with:
|
6
|
-
"""
|
7
|
-
task :executable_test_ok do
|
8
|
-
condition { executable? 'true' }
|
9
|
-
|
10
|
-
echo 'test_ok'
|
11
|
-
end
|
12
|
-
|
13
|
-
task :executable_test_ok do
|
14
|
-
condition { executable? 'some_non_existent_executable' }
|
15
|
-
|
16
|
-
echo 'test_ko'
|
17
|
-
end
|
18
|
-
"""
|
19
|
-
|
20
|
-
Scenario: succeeds when remote executable is available
|
21
|
-
When I successfully execute the recipe on remote target
|
22
|
-
Then the output must contain "test_ok"
|
23
|
-
|
24
|
-
Scenario: fails when remote executable is not available
|
25
|
-
When I successfully execute the recipe on remote target
|
26
|
-
Then the output must not contain "test_ko"
|