Unflatten features directory tree
This commit is contained in:
21
features/tests/dir.feature
Normal file
21
features/tests/dir.feature
Normal file
@@ -0,0 +1,21 @@
|
||||
@sshd
|
||||
Feature: `dir?' condition keyword
|
||||
|
||||
Background:
|
||||
Given a recipe with:
|
||||
"""
|
||||
task :dir_test do
|
||||
condition { dir? 'some_directory' }
|
||||
|
||||
echo 'evaluated'
|
||||
end
|
||||
"""
|
||||
|
||||
Scenario: succeeds when directory exists
|
||||
Given a remote directory named "some_directory"
|
||||
When I successfully execute the recipe on remote target
|
||||
Then the output must contain "evaluated"
|
||||
|
||||
Scenario: fails when directory does not exist
|
||||
When I successfully execute the recipe on remote target
|
||||
Then the output must not contain "evaluated"
|
46
features/tests/env.feature
Normal file
46
features/tests/env.feature
Normal file
@@ -0,0 +1,46 @@
|
||||
@sshd
|
||||
Feature: `env?' condition keyword
|
||||
|
||||
Background:
|
||||
Given a recipe with:
|
||||
"""
|
||||
task :env_test_definition_ok do
|
||||
condition { env? :shell }
|
||||
|
||||
echo 'definition_ok'
|
||||
end
|
||||
|
||||
task :env_test_definition_ko do
|
||||
condition { env? :non_existent_var }
|
||||
|
||||
echo 'definition_ko'
|
||||
end
|
||||
|
||||
task :env_test_value do
|
||||
condition { env? :shell, '/bin/sh' }
|
||||
|
||||
echo 'value_ok'
|
||||
end
|
||||
|
||||
task :env_test_value do
|
||||
condition { env? :shell, 'non_existent_shell' }
|
||||
|
||||
echo 'value_ko'
|
||||
end
|
||||
"""
|
||||
|
||||
Scenario: succeeds when remote environment variable is defined
|
||||
When I successfully execute the recipe on remote target
|
||||
Then the output must contain "definition_ok"
|
||||
|
||||
Scenario: fails when remote environment variable is not defined
|
||||
When I successfully execute the recipe on remote target
|
||||
Then the output must not contain "definition_ko"
|
||||
|
||||
Scenario: succeeds when remote environment variable value match
|
||||
When I successfully execute the recipe on remote target
|
||||
Then the output must contain "value_ok"
|
||||
|
||||
Scenario: fails when remote environment variable value does not match
|
||||
When I successfully execute the recipe on remote target
|
||||
Then the output must not contain "value_ko"
|
26
features/tests/executable.feature
Normal file
26
features/tests/executable.feature
Normal file
@@ -0,0 +1,26 @@
|
||||
@sshd
|
||||
Feature: `executable?' condition keyword
|
||||
|
||||
Background:
|
||||
Given a recipe with:
|
||||
"""
|
||||
task :executable_test_ok do
|
||||
condition { executable? 'true' }
|
||||
|
||||
echo 'test_ok'
|
||||
end
|
||||
|
||||
task :executable_test_ok do
|
||||
condition { executable? 'some_non_existent_executable' }
|
||||
|
||||
echo 'test_ko'
|
||||
end
|
||||
"""
|
||||
|
||||
Scenario: succeeds when remote executable is available
|
||||
When I successfully execute the recipe on remote target
|
||||
Then the output must contain "test_ok"
|
||||
|
||||
Scenario: fails when remote executable is not available
|
||||
When I successfully execute the recipe on remote target
|
||||
Then the output must not contain "test_ko"
|
21
features/tests/file.feature
Normal file
21
features/tests/file.feature
Normal file
@@ -0,0 +1,21 @@
|
||||
@sshd
|
||||
Feature: `file?' condition keyword
|
||||
|
||||
Background:
|
||||
Given a recipe with:
|
||||
"""
|
||||
task :file_test do
|
||||
condition { file? 'some_file' }
|
||||
|
||||
echo 'evaluated'
|
||||
end
|
||||
"""
|
||||
|
||||
Scenario: succeeds when file exists
|
||||
Given a remote file named "some_file"
|
||||
When I successfully execute the recipe on remote target
|
||||
Then the output must contain "evaluated"
|
||||
|
||||
Scenario: fails when file does not exist
|
||||
When I successfully execute the recipe on remote target
|
||||
Then the output must not contain "evaluated"
|
26
features/tests/file_contains.feature
Normal file
26
features/tests/file_contains.feature
Normal file
@@ -0,0 +1,26 @@
|
||||
@sshd
|
||||
Feature: `file_contains' condition keyword
|
||||
|
||||
Background:
|
||||
Given a recipe with:
|
||||
"""
|
||||
task :file_contains_test do
|
||||
condition { file_contains 'some_file', 'some_content' }
|
||||
|
||||
echo 'evaluated'
|
||||
end
|
||||
"""
|
||||
|
||||
Scenario: succeeds when file contains expected content
|
||||
Given a remote file named "some_file" with "some_content"
|
||||
When I successfully execute the recipe on remote target
|
||||
Then the output must contain "evaluated"
|
||||
|
||||
Scenario: fails when file does not contain expected content
|
||||
Given a remote file named "some_file" with "some_other_content"
|
||||
When I successfully execute the recipe on remote target
|
||||
Then the output must not contain "evaluated"
|
||||
|
||||
Scenario: fails when file does not exist
|
||||
When I successfully execute the recipe on remote target
|
||||
Then the output must not contain "evaluated"
|
26
features/tests/file_eq.feature
Normal file
26
features/tests/file_eq.feature
Normal file
@@ -0,0 +1,26 @@
|
||||
@sshd
|
||||
Feature: `file_eq' condition keyword
|
||||
|
||||
Background:
|
||||
Given a recipe with:
|
||||
"""
|
||||
task :file_eq_test do
|
||||
condition { file_eq 'some_file', 'some content' }
|
||||
|
||||
echo 'evaluated'
|
||||
end
|
||||
"""
|
||||
|
||||
Scenario: succeeds when file content is expected content
|
||||
Given a remote file named "some_file" with "some content"
|
||||
When I successfully execute the recipe on remote target
|
||||
Then the output must contain "evaluated"
|
||||
|
||||
Scenario: fails when file content is not expected content
|
||||
Given a remote file named "some_file" with "some content padded"
|
||||
When I successfully execute the recipe on remote target
|
||||
Then the output must not contain "evaluated"
|
||||
|
||||
Scenario: fails when file does not exist
|
||||
When I successfully execute the recipe on remote target
|
||||
Then the output must not contain "evaluated"
|
26
features/tests/file_match.feature
Normal file
26
features/tests/file_match.feature
Normal file
@@ -0,0 +1,26 @@
|
||||
@sshd
|
||||
Feature: `file_match' condition keyword
|
||||
|
||||
Background:
|
||||
Given a recipe with:
|
||||
"""
|
||||
task :file_match_test do
|
||||
condition { file_match 'some_file', /\Asome_content\z/ }
|
||||
|
||||
echo 'evaluated'
|
||||
end
|
||||
"""
|
||||
|
||||
Scenario: succeeds when file match pattern
|
||||
Given a remote file named "some_file" with "some_content"
|
||||
When I successfully execute the recipe on remote target
|
||||
Then the output must contain "evaluated"
|
||||
|
||||
Scenario: fails when file does not match pattern
|
||||
Given a remote file named "some_file" with "some_other_content"
|
||||
When I successfully execute the recipe on remote target
|
||||
Then the output must not contain "evaluated"
|
||||
|
||||
Scenario: fails when file does not exist
|
||||
When I successfully execute the recipe on remote target
|
||||
Then the output must not contain "evaluated"
|
46
features/tests/shell_command_status.feature
Normal file
46
features/tests/shell_command_status.feature
Normal file
@@ -0,0 +1,46 @@
|
||||
@sshd
|
||||
Feature: `sh' and `` condition keyword
|
||||
|
||||
Background:
|
||||
Given a recipe with:
|
||||
"""
|
||||
task :sh_test_ok do
|
||||
condition { sh 'true' }
|
||||
|
||||
echo 'test_ok'
|
||||
end
|
||||
|
||||
task :sh_test_ko do
|
||||
condition { sh 'false' }
|
||||
|
||||
echo 'test_ko'
|
||||
end
|
||||
|
||||
task :sh_test_backtick_ok do
|
||||
condition { `true` }
|
||||
|
||||
echo 'test_backtick_ok'
|
||||
end
|
||||
|
||||
task :sh_test_backtick_ko do
|
||||
condition { `false` }
|
||||
|
||||
echo 'test_backtick_ko'
|
||||
end
|
||||
"""
|
||||
|
||||
Scenario: succeeds when remote command execution is a success
|
||||
When I successfully execute the recipe on remote target
|
||||
Then the output must contain "test_ok"
|
||||
|
||||
Scenario: fails when remote executable is not available
|
||||
When I successfully execute the recipe on remote target
|
||||
Then the output must not contain "test_ko"
|
||||
|
||||
Scenario: `` alias, succeeds when remote executable is available
|
||||
When I successfully execute the recipe on remote target
|
||||
Then the output must contain "test_backtick_ok"
|
||||
|
||||
Scenario: `` alias, fails when remote executable is not available
|
||||
When I successfully execute the recipe on remote target
|
||||
Then the output must not contain "test_backtick_ko"
|
26
features/tests/yaml_eq.feature
Normal file
26
features/tests/yaml_eq.feature
Normal file
@@ -0,0 +1,26 @@
|
||||
@sshd
|
||||
Feature: `yaml_eq' condition keyword
|
||||
|
||||
Background:
|
||||
Given a recipe with:
|
||||
"""
|
||||
task :yaml_eq_test do
|
||||
condition { yaml_eq 'some_file', { foo: 'bar' } }
|
||||
|
||||
echo 'evaluated'
|
||||
end
|
||||
"""
|
||||
|
||||
Scenario: succeeds when YAML data is equivalent
|
||||
Given a remote file named "some_file" with ":foo: bar"
|
||||
When I successfully execute the recipe on remote target
|
||||
Then the output must contain "evaluated"
|
||||
|
||||
Scenario: fails when YAML data differs
|
||||
Given a remote file named "some_file" with ":foo: baz"
|
||||
When I successfully execute the recipe on remote target
|
||||
Then the output must not contain "evaluated"
|
||||
|
||||
Scenario: fails when YAML file does not exist
|
||||
When I successfully execute the recipe on remote target
|
||||
Then the output must not contain "evaluated"
|
Reference in New Issue
Block a user