r10k 1.4.2 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +2 -0
- data/CHANGELOG.mkd +192 -0
- data/CONTRIBUTING.mkd +3 -3
- data/Gemfile +4 -0
- data/README.mkd +13 -6
- data/doc/dynamic-environments/configuration.mkd +77 -8
- data/doc/dynamic-environments/git-environments.mkd +12 -2
- data/doc/dynamic-environments/quickstart.mkd +6 -0
- data/doc/faq.mkd +6 -6
- data/doc/git/cloning-and-mirroring.mkd +60 -0
- data/doc/git/providers.mkd +68 -0
- data/integration/Gemfile +3 -0
- data/integration/README.mkd +29 -0
- data/integration/configs/README.mkd +7 -0
- data/integration/configs/pe/centos-6-64mda +25 -0
- data/integration/configs/pe/centos-7-64mda +25 -0
- data/integration/configs/pe/debian-6-64mda +25 -0
- data/integration/configs/pe/debian-7-64mda +25 -0
- data/integration/configs/pe/redhat-6-64mda +25 -0
- data/integration/configs/pe/redhat-7-64mda +25 -0
- data/integration/configs/pe/sles-11-64mda +25 -0
- data/integration/configs/pe/ubuntu-1004-64mda +25 -0
- data/integration/configs/pe/ubuntu-1204-64mda +25 -0
- data/integration/configs/pe/ubuntu-1404-64mda +25 -0
- data/integration/files/README.mkd +4 -0
- data/integration/files/hiera.yaml +8 -0
- data/integration/files/modules/helloworld/manifests/init.pp +3 -0
- data/integration/files/modules/hieratest/manifests/init.pp +3 -0
- data/integration/files/modules/unicode/files/pretend_unicode +1 -0
- data/integration/files/modules/unicode/manifests/init.pp +6 -0
- data/integration/files/pre-suite/prod_env.config +3 -0
- data/integration/files/r10k_conf.yaml.erb +9 -0
- data/integration/lib/README.mkd +4 -0
- data/integration/lib/git_utils.rb +205 -0
- data/integration/lib/master_manipulator.rb +205 -0
- data/integration/lib/r10k_utils.rb +166 -0
- data/integration/manifests/README.mkd +4 -0
- data/integration/pre-suite/00_pe_install.rb +4 -0
- data/integration/pre-suite/01_git_config.rb +59 -0
- data/integration/pre-suite/02_pe_r10k.rb +60 -0
- data/integration/pre-suite/03_test_utils.rb +17 -0
- data/integration/pre-suite/README.mkd +5 -0
- data/integration/test_run_scripts/README.mkd +5 -0
- data/integration/test_run_scripts/all_tests-rugged-pe-centos6.sh +20 -0
- data/integration/test_run_scripts/all_tests-rugged-pe-rhel7.sh +20 -0
- data/integration/test_run_scripts/all_tests-rugged-pe-sles11.sh +20 -0
- data/integration/test_run_scripts/all_tests-rugged-pe-ubuntu1204.sh +20 -0
- data/integration/test_run_scripts/all_tests-rugged-pe-ubuntu1404.sh +20 -0
- data/integration/test_run_scripts/all_tests-shellgit-pe-centos6.sh +20 -0
- data/integration/test_run_scripts/all_tests-shellgit-pe-rhel7.sh +20 -0
- data/integration/test_run_scripts/all_tests-shellgit-pe-sles11.sh +20 -0
- data/integration/test_run_scripts/all_tests-shellgit-pe-ubuntu1204.sh +20 -0
- data/integration/test_run_scripts/all_tests-shellgit-pe-ubuntu1404.sh +20 -0
- data/integration/test_run_scripts/basic_functionality/all_tests-pe-centos6.sh +20 -0
- data/integration/test_run_scripts/command_line/all_tests-pe-centos6.sh +20 -0
- data/integration/test_run_scripts/git_source/all_tests-pe-centos6.sh +20 -0
- data/integration/test_run_scripts/user_scenario/basic_workflow/all_tests-pe-centos6.sh +20 -0
- data/integration/test_run_scripts/user_scenario/complex_workflow/all_tests-pe-centos6.sh +20 -0
- data/integration/tests/README.mkd +4 -0
- data/integration/tests/basic_functionality/negative/neg_deploy_with_invalid_r10k_yaml.rb +46 -0
- data/integration/tests/basic_functionality/negative/neg_deploy_with_missing_r10k_yaml.rb +27 -0
- data/integration/tests/command_line/deploy_env_without_mod_update.rb +75 -0
- data/integration/tests/command_line/negative/neg_deploy_env_with_module_update.rb +76 -0
- data/integration/tests/command_line/negative/neg_invalid_cli_dep_flag.rb +22 -0
- data/integration/tests/command_line/negative/neg_invalid_cli_env_flag.rb +22 -0
- data/integration/tests/command_line/negative/neg_invalid_cmd_line_arg.rb +24 -0
- data/integration/tests/git_source/git_source_git.rb +123 -0
- data/integration/tests/git_source/git_source_ssh.rb +84 -0
- data/integration/tests/git_source/git_source_submodule.rb +69 -0
- data/integration/tests/git_source/negative/neg_git_broken_remote.rb +37 -0
- data/integration/tests/git_source/negative/neg_git_unauthorized_https.rb +45 -0
- data/integration/tests/git_source/negative/neg_git_unauthorized_ssh.rb +72 -0
- data/integration/tests/git_source/negative/neg_git_unicode_branch.rb +34 -0
- data/integration/tests/user_scenario/basic_workflow/multi_env_1000_branches.rb +66 -0
- data/integration/tests/user_scenario/basic_workflow/multi_env_custom_forge_git_module.rb +110 -0
- data/integration/tests/user_scenario/basic_workflow/multi_env_custom_forge_git_module_static.rb +113 -0
- data/integration/tests/user_scenario/basic_workflow/multi_env_hiera.rb +93 -0
- data/integration/tests/user_scenario/basic_workflow/multi_env_multi_source.rb +132 -0
- data/integration/tests/user_scenario/basic_workflow/multi_source_custom_forge_git_module.rb +160 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_bad_basedir.rb +45 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_bad_forge_module.rb +43 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_bad_git_module.rb +40 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_bad_git_module_ref.rb +42 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_bad_git_remote.rb +44 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_branch_name_collision.rb +63 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_disk_full.rb +73 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_duplicate_module_names.rb +45 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_inaccessible_forge.rb +51 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_invalid_env_name.rb +33 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_invalid_puppet_file.rb +35 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_module_specified_at_deleted_release.rb +44 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_read_only.rb +57 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_specify_deleted_forge_module.rb +44 -0
- data/integration/tests/user_scenario/basic_workflow/single_env_10000_files.rb +73 -0
- data/integration/tests/user_scenario/basic_workflow/single_env_custom_forge_git_module.rb +103 -0
- data/integration/tests/user_scenario/basic_workflow/single_env_custom_forge_module.rb +80 -0
- data/integration/tests/user_scenario/basic_workflow/single_env_custom_module.rb +48 -0
- data/integration/tests/user_scenario/basic_workflow/single_env_large_files.rb +73 -0
- data/integration/tests/user_scenario/basic_workflow/single_env_module_already_installed.rb +81 -0
- data/integration/tests/user_scenario/basic_workflow/single_env_module_last_release_deleted.rb +67 -0
- data/integration/tests/user_scenario/basic_workflow/single_env_non-existent_base_dir.rb +93 -0
- data/integration/tests/user_scenario/basic_workflow/single_env_purge_unmanaged_modules.rb +92 -0
- data/integration/tests/user_scenario/basic_workflow/single_env_switch_forge_git_module.rb +116 -0
- data/integration/tests/user_scenario/basic_workflow/single_env_unicode_paths.rb +59 -0
- data/integration/tests/user_scenario/basic_workflow/single_env_upgrade_forge_mod_revert_change.rb +165 -0
- data/integration/tests/user_scenario/complex_workflow/multi_env_add_change_remove.rb +162 -0
- data/integration/tests/user_scenario/complex_workflow/multi_env_remove_re-add.rb +110 -0
- data/lib/r10k/action/cri_runner.rb +10 -13
- data/lib/r10k/cli.rb +3 -8
- data/lib/r10k/cli/version.rb +10 -1
- data/lib/r10k/deployment/config.rb +26 -6
- data/lib/r10k/deployment/config/loader.rb +38 -29
- data/lib/r10k/deployment/source.rb +2 -4
- data/lib/r10k/environment/git.rb +10 -19
- data/lib/r10k/environment/name.rb +86 -0
- data/lib/r10k/errors.rb +8 -5
- data/lib/r10k/feature.rb +35 -0
- data/lib/r10k/feature/collection.rb +23 -0
- data/lib/r10k/features.rb +18 -0
- data/lib/r10k/git.rb +106 -12
- data/lib/r10k/git/alternates.rb +2 -2
- data/lib/r10k/git/cache.rb +43 -26
- data/lib/r10k/git/errors.rb +12 -6
- data/lib/r10k/git/head.rb +3 -0
- data/lib/r10k/git/ref.rb +3 -0
- data/lib/r10k/git/remote_head.rb +6 -0
- data/lib/r10k/git/repository.rb +6 -0
- data/lib/r10k/git/rugged.rb +17 -0
- data/lib/r10k/git/rugged/bare_repository.rb +86 -0
- data/lib/r10k/git/rugged/base_repository.rb +90 -0
- data/lib/r10k/git/rugged/cache.rb +11 -0
- data/lib/r10k/git/rugged/thin_repository.rb +72 -0
- data/lib/r10k/git/rugged/working_repository.rb +99 -0
- data/lib/r10k/git/shellgit.rb +9 -0
- data/lib/r10k/git/shellgit/bare_repository.rb +29 -0
- data/lib/r10k/git/shellgit/base_repository.rb +102 -0
- data/lib/r10k/git/shellgit/cache.rb +11 -0
- data/lib/r10k/git/shellgit/thin_repository.rb +56 -0
- data/lib/r10k/git/shellgit/working_repository.rb +73 -0
- data/lib/r10k/git/stateful_repository.rb +80 -0
- data/lib/r10k/git/tag.rb +3 -0
- data/lib/r10k/git/working_dir.rb +15 -2
- data/lib/r10k/logging.rb +73 -36
- data/lib/r10k/logging/terminaloutputter.rb +36 -0
- data/lib/r10k/module/forge.rb +10 -9
- data/lib/r10k/module/git.rb +14 -44
- data/lib/r10k/module/metadata_file.rb +31 -0
- data/lib/r10k/module/svn.rb +0 -1
- data/lib/r10k/module_repository/forge.rb +20 -7
- data/lib/r10k/puppetfile.rb +1 -1
- data/lib/r10k/settings/container.rb +6 -0
- data/lib/r10k/settings/mixin.rb +9 -0
- data/lib/r10k/source.rb +2 -3
- data/lib/r10k/source/base.rb +5 -5
- data/lib/r10k/source/git.rb +11 -86
- data/lib/r10k/source/svn.rb +8 -52
- data/lib/r10k/util/basedir.rb +4 -4
- data/lib/r10k/util/commands.rb +31 -0
- data/lib/r10k/util/exec_env.rb +36 -0
- data/lib/r10k/util/platform.rb +4 -0
- data/lib/r10k/util/purgeable.rb +2 -2
- data/lib/r10k/util/subprocess.rb +3 -7
- data/lib/r10k/util/subprocess/runner.rb +3 -28
- data/lib/r10k/util/subprocess/runner/posix.rb +103 -0
- data/lib/r10k/util/subprocess/runner/pump.rb +59 -0
- data/lib/r10k/util/subprocess/{windows/runner.rb → runner/windows.rb} +2 -11
- data/lib/r10k/util/symbolize_keys.rb +31 -0
- data/lib/r10k/version.rb +1 -1
- data/lib/shared/puppet/module_tool/metadata.rb +197 -0
- data/r10k.gemspec +7 -5
- data/spec/fixtures/integration/git/puppet-boolean-bare.tar +0 -0
- data/spec/fixtures/module/forge/bad_module/metadata.json +1 -0
- data/spec/fixtures/unit/util/subprocess/posix/runner/no-execute.sh +3 -0
- data/spec/fixtures/vcr/cassettes/R10K_ModuleRepository_Forge/and_the_expected_version_is_latest/can_fetch_all_versions_of_a_given_module.yml +171 -26
- data/spec/fixtures/vcr/cassettes/R10K_ModuleRepository_Forge/and_the_expected_version_is_latest/can_fetch_the_latest_version_of_a_given_module.yml +171 -26
- data/spec/fixtures/vcr/cassettes/R10K_ModuleRepository_Forge/and_the_expected_version_is_latest/ignores_deleted_releases.yml +190 -0
- data/spec/fixtures/vcr/cassettes/R10K_ModuleRepository_Forge/it_handles_errors_from_forgeapi_puppetlabs_com/raises_an_error_for_a_non-existant_module.yml +34 -0
- data/spec/fixtures/vcr/cassettes/R10K_Module_Forge/and_the_expected_version_is_latest/sets_the_expected_version_based_on_the_latest_forge_version.yml +87 -26
- data/spec/integration/git/rugged/bare_repository_spec.rb +13 -0
- data/spec/integration/git/rugged/thin_repository_spec.rb +14 -0
- data/spec/integration/git/rugged/working_repository_spec.rb +13 -0
- data/spec/integration/git/shellgit/bare_repository_spec.rb +13 -0
- data/spec/integration/git/shellgit/thin_repository_spec.rb +14 -0
- data/spec/integration/git/shellgit/working_repository_spec.rb +13 -0
- data/spec/integration/git/stateful_repository_spec.rb +104 -0
- data/spec/matchers/match_realpath.rb +18 -0
- data/spec/shared-contexts/git-fixtures.rb +55 -0
- data/spec/shared-examples/git-repository.rb +38 -0
- data/spec/shared-examples/git/bare_repository.rb +70 -0
- data/spec/shared-examples/git/thin_repository.rb +26 -0
- data/spec/shared-examples/git/working_repository.rb +115 -0
- data/spec/shared-examples/subprocess-runner.rb +83 -0
- data/spec/spec_helper.rb +13 -9
- data/spec/unit/action/cri_runner_spec.rb +0 -6
- data/spec/unit/action/puppetfile/{cri_action_spec.rb → cri_runner_spec.rb} +0 -0
- data/spec/unit/deployment/config/loader_spec.rb +48 -0
- data/spec/unit/deployment/config_spec.rb +49 -0
- data/spec/unit/environment/git_spec.rb +5 -39
- data/spec/unit/environment/name_spec.rb +135 -0
- data/spec/unit/feature_spec.rb +50 -0
- data/spec/unit/git/alternates_spec.rb +1 -1
- data/spec/unit/git/cache_spec.rb +32 -19
- data/spec/unit/git/commit_spec.rb +1 -0
- data/spec/unit/git/head_spec.rb +1 -6
- data/spec/unit/git/ref_spec.rb +0 -23
- data/spec/unit/git/rugged/cache_spec.rb +26 -0
- data/spec/unit/git/shellgit/cache_spec.rb +27 -0
- data/spec/unit/git/stateful_repository_spec.rb +43 -0
- data/spec/unit/git/tag_spec.rb +1 -0
- data/spec/unit/git/working_dir_spec.rb +1 -0
- data/spec/unit/git_spec.rb +74 -0
- data/spec/unit/logging/terminaloutputter_spec.rb +53 -0
- data/spec/unit/logging_spec.rb +68 -0
- data/spec/unit/module/forge_spec.rb +7 -38
- data/spec/unit/module/git_spec.rb +7 -38
- data/spec/unit/module/metadata_file_spec.rb +69 -0
- data/spec/unit/module/svn_spec.rb +0 -4
- data/spec/unit/module_repository/forge_spec.rb +22 -1
- data/spec/unit/puppet/module_tool/metadata_spec.rb +301 -0
- data/spec/unit/settings/container_spec.rb +17 -0
- data/spec/unit/source/git_spec.rb +0 -123
- data/spec/unit/source/svn_spec.rb +66 -0
- data/spec/unit/util/commands_spec.rb +61 -0
- data/spec/unit/util/exec_env_spec.rb +56 -0
- data/spec/unit/util/subprocess/runner/posix_spec.rb +7 -0
- data/spec/unit/util/subprocess/runner/pump_spec.rb +79 -0
- data/spec/unit/util/subprocess_spec.rb +3 -2
- data/spec/unit/util/symbolize_keys_spec.rb +51 -0
- metadata +226 -45
- data/lib/r10k/execution.rb +0 -47
- data/lib/r10k/module/metadata.rb +0 -47
- data/lib/r10k/util/core_ext/hash_ext.rb +0 -19
- data/lib/r10k/util/subprocess/io.rb +0 -7
- data/lib/r10k/util/subprocess/posix.rb +0 -4
- data/lib/r10k/util/subprocess/posix/io.rb +0 -7
- data/lib/r10k/util/subprocess/posix/runner.rb +0 -140
- data/lib/r10k/util/subprocess/windows.rb +0 -4
- data/lib/r10k/util/subprocess/windows/io.rb +0 -6
- data/spec/fixtures/vcr/cassettes/R10K_ModuleRepository_Forge/looking_up_versions.yml +0 -42
- data/spec/fixtures/vcr/cassettes/R10K_ModuleRepository_Forge/looking_up_versions/can_fetch_all_versions_of_a_given_module.yml +0 -42
- data/spec/fixtures/vcr/cassettes/R10K_ModuleRepository_Forge/looking_up_versions/can_fetch_the_latest_version_of_a_given_module.yml +0 -42
- data/spec/unit/deployment/source_spec.rb +0 -24
- data/spec/unit/module/metadata_spec.rb +0 -68
- data/spec/unit/util/core_ext/hash_ext_spec.rb +0 -63
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'git_utils'
|
2
|
+
require 'r10k_utils'
|
3
|
+
require 'master_manipulator'
|
4
|
+
test_name 'CODEMGMT-63 - C59258 - Attempt to Deploy Environment with Duplicate Module Names'
|
5
|
+
|
6
|
+
#Init
|
7
|
+
git_environments_path = '/root/environments'
|
8
|
+
last_commit = git_last_commit(master, git_environments_path)
|
9
|
+
|
10
|
+
#Verification
|
11
|
+
error_message_regex = /ERROR\]/
|
12
|
+
|
13
|
+
#File
|
14
|
+
puppet_file = <<-PUPPETFILE
|
15
|
+
mod "puppetlabs/motd"
|
16
|
+
mod "jeffmccune/motd"
|
17
|
+
PUPPETFILE
|
18
|
+
|
19
|
+
puppet_file_path = File.join(git_environments_path, 'Puppetfile')
|
20
|
+
|
21
|
+
#Teardown
|
22
|
+
teardown do
|
23
|
+
clean_up_r10k(master, last_commit, git_environments_path)
|
24
|
+
end
|
25
|
+
|
26
|
+
#Setup
|
27
|
+
step 'Stub Forge on Master'
|
28
|
+
stub_forge_on(master)
|
29
|
+
|
30
|
+
step 'Checkout "production" Branch'
|
31
|
+
git_on(master, 'checkout production', git_environments_path)
|
32
|
+
|
33
|
+
step 'Create "Puppetfile" for the "production" Environment'
|
34
|
+
create_remote_file(master, puppet_file_path, puppet_file)
|
35
|
+
|
36
|
+
step 'Push Changes'
|
37
|
+
git_add_commit_push(master, 'production', 'Add modules.', git_environments_path)
|
38
|
+
|
39
|
+
#Tests
|
40
|
+
step 'Attempt to Deploy via r10k'
|
41
|
+
on(master, 'r10k deploy environment -v -p', :acceptable_exit_codes => 0) do |result|
|
42
|
+
expect_failure('Expected to fail due to CODEMGMT-71') do
|
43
|
+
assert_match(error_message_regex, result.stderr, 'Expected message not found!')
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'git_utils'
|
2
|
+
require 'r10k_utils'
|
3
|
+
require 'master_manipulator'
|
4
|
+
test_name 'CODEMGMT-42 - C59256 - Attempt to Deploy Environment with Inaccessible Forge'
|
5
|
+
|
6
|
+
#Init
|
7
|
+
master_certname = on(master, puppet('config', 'print', 'certname')).stdout.rstrip
|
8
|
+
git_environments_path = '/root/environments'
|
9
|
+
last_commit = git_last_commit(master, git_environments_path)
|
10
|
+
|
11
|
+
hosts_file_path = '/etc/hosts'
|
12
|
+
|
13
|
+
#File
|
14
|
+
puppet_file = <<-PUPPETFILE
|
15
|
+
mod "puppetlabs/motd"
|
16
|
+
PUPPETFILE
|
17
|
+
|
18
|
+
puppet_file_path = File.join(git_environments_path, 'Puppetfile')
|
19
|
+
|
20
|
+
#Verification
|
21
|
+
error_message_regex = /Error: Could not connect via HTTPS to https:\/\/forgeapi.puppetlabs.com/
|
22
|
+
|
23
|
+
#Teardown
|
24
|
+
teardown do
|
25
|
+
clean_up_r10k(master, last_commit, git_environments_path)
|
26
|
+
|
27
|
+
step 'Restore Original Hosts File'
|
28
|
+
on(master, "mv #{hosts_file_path}.bak #{hosts_file_path}")
|
29
|
+
end
|
30
|
+
|
31
|
+
#Setup
|
32
|
+
step 'Backup "/etc/hosts" File on Master'
|
33
|
+
on(master, "mv #{hosts_file_path} #{hosts_file_path}.bak")
|
34
|
+
|
35
|
+
step 'Point Forge Hostname to Localhost'
|
36
|
+
on(master, "echo '127.0.0.1 forgeapi.puppetlabs.com' > #{hosts_file_path}")
|
37
|
+
|
38
|
+
step 'Checkout "production" Branch'
|
39
|
+
git_on(master, 'checkout production', git_environments_path)
|
40
|
+
|
41
|
+
step 'Create "Puppetfile" for the "production" Environment'
|
42
|
+
create_remote_file(master, puppet_file_path, puppet_file)
|
43
|
+
|
44
|
+
step 'Push Changes'
|
45
|
+
git_add_commit_push(master, 'production', 'Update Puppetfile.', git_environments_path)
|
46
|
+
|
47
|
+
#Tests
|
48
|
+
step 'Attempt to Deploy via r10k'
|
49
|
+
on(master, 'r10k deploy environment -v -p', :acceptable_exit_codes => 1) do |result|
|
50
|
+
assert_match(error_message_regex, result.stderr, 'Expected message not found!')
|
51
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'git_utils'
|
2
|
+
require 'r10k_utils'
|
3
|
+
require 'master_manipulator'
|
4
|
+
test_name 'CODEMGMT-63 - C62511 - Attempt to Deploy Environment Containing Invalid Character in Name'
|
5
|
+
|
6
|
+
#Init
|
7
|
+
git_environments_path = '/root/environments'
|
8
|
+
last_commit = git_last_commit(master, git_environments_path)
|
9
|
+
invalid_env_name = 'should-not-contain-dashes'
|
10
|
+
|
11
|
+
#Verification
|
12
|
+
error_message_regex = /ERROR\]/
|
13
|
+
|
14
|
+
#Teardown
|
15
|
+
teardown do
|
16
|
+
clean_up_r10k(master, last_commit, git_environments_path)
|
17
|
+
end
|
18
|
+
|
19
|
+
#Setup
|
20
|
+
step "Create \"#{invalid_env_name}\" Branch from \"production\""
|
21
|
+
git_on(master, 'checkout production', git_environments_path)
|
22
|
+
git_on(master, "checkout -b #{invalid_env_name}", git_environments_path)
|
23
|
+
|
24
|
+
step "Push Changes to \"#{invalid_env_name}\" Environment"
|
25
|
+
git_push(master, invalid_env_name, git_environments_path)
|
26
|
+
|
27
|
+
#Tests
|
28
|
+
step 'Attempt to Deploy via r10k'
|
29
|
+
on(master, 'r10k deploy environment -v') do |result|
|
30
|
+
expect_failure('Expected to fail due to CODEMGMT-65') do
|
31
|
+
assert_match(error_message_regex, result.stderr, 'Expected message not found!')
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'git_utils'
|
2
|
+
require 'r10k_utils'
|
3
|
+
test_name 'CODEMGMT-86 - C63185 - Attempt to Deploy Environment with Invalid Puppetfile'
|
4
|
+
|
5
|
+
#Init
|
6
|
+
git_environments_path = '/root/environments'
|
7
|
+
last_commit = git_last_commit(master, git_environments_path)
|
8
|
+
|
9
|
+
puppet_file_path = File.join(git_environments_path, 'Puppetfile')
|
10
|
+
|
11
|
+
#In-line files
|
12
|
+
puppet_file = <<-PUPPETFILE
|
13
|
+
- modulo 'puppetlabs/motd",,
|
14
|
+
PUPPETFILE
|
15
|
+
|
16
|
+
#Verification
|
17
|
+
error_message_regex = /ERROR\].*syntax error/m
|
18
|
+
|
19
|
+
#Teardown
|
20
|
+
teardown do
|
21
|
+
clean_up_r10k(master, last_commit, git_environments_path)
|
22
|
+
end
|
23
|
+
|
24
|
+
#Setup
|
25
|
+
step 'Create "Puppetfile" for the "production" Environment'
|
26
|
+
create_remote_file(master, puppet_file_path, puppet_file)
|
27
|
+
|
28
|
+
step 'Push Changes'
|
29
|
+
git_add_commit_push(master, 'production', 'Update Puppetfile.', git_environments_path)
|
30
|
+
|
31
|
+
#Tests
|
32
|
+
step 'Attempt to Deploy via r10k'
|
33
|
+
on(master, 'r10k deploy environment -v -p', :acceptable_exit_codes => 1) do |result|
|
34
|
+
assert_match(error_message_regex, result.stderr, 'Expected message not found!')
|
35
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'git_utils'
|
2
|
+
require 'r10k_utils'
|
3
|
+
test_name 'CODEMGMT-127 - C64121 - Attempt to Deploy Environment with Forge Module Specified at Deleted Release'
|
4
|
+
|
5
|
+
#This test uses the spotty module at https://forge-aio01-petest.puppetlabs.com//puppetlabs/spotty, with valid released 0.1.0 and 0.3.0 versions, and deleted 0.2.0 and 0.4.0 versions.
|
6
|
+
|
7
|
+
#Init
|
8
|
+
git_environments_path = '/root/environments'
|
9
|
+
last_commit = git_last_commit(master, git_environments_path)
|
10
|
+
|
11
|
+
#Verification
|
12
|
+
error_notification_regex = /No releases matching '0.2.0'/
|
13
|
+
|
14
|
+
#File
|
15
|
+
puppet_file = <<-PUPPETFILE
|
16
|
+
mod "puppetlabs/spotty", '0.2.0'
|
17
|
+
PUPPETFILE
|
18
|
+
|
19
|
+
puppet_file_path = File.join(git_environments_path, 'Puppetfile')
|
20
|
+
|
21
|
+
#Teardown
|
22
|
+
teardown do
|
23
|
+
clean_up_r10k(master, last_commit, git_environments_path)
|
24
|
+
end
|
25
|
+
|
26
|
+
#Setup
|
27
|
+
step 'Stub Forge on Master'
|
28
|
+
stub_forge_on(master)
|
29
|
+
|
30
|
+
#Tests
|
31
|
+
step 'Checkout "production" Branch'
|
32
|
+
git_on(master, 'checkout production', git_environments_path)
|
33
|
+
|
34
|
+
step 'Create "Puppetfile" for the "production" Environment'
|
35
|
+
create_remote_file(master, puppet_file_path, puppet_file)
|
36
|
+
|
37
|
+
step 'Push Changes'
|
38
|
+
git_add_commit_push(master, 'production', 'Add module.', git_environments_path)
|
39
|
+
|
40
|
+
#Tests
|
41
|
+
step "Deploy production environment via r10k with module specified at deleted version"
|
42
|
+
on(master, 'r10k deploy environment -p -v', :acceptable_exit_codes => 1) do |result|
|
43
|
+
assert_match(error_notification_regex, result.stderr, 'Unexpected error was detected!')
|
44
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'git_utils'
|
2
|
+
require 'r10k_utils'
|
3
|
+
test_name 'CODEMGMT-86 - C59266 - Attempt to Deploy Environment to Read Only Directory'
|
4
|
+
|
5
|
+
#Init
|
6
|
+
git_repo_path = '/git_repos'
|
7
|
+
git_repo_name = 'environments'
|
8
|
+
git_control_remote = File.join(git_repo_path, "#{git_repo_name}.git")
|
9
|
+
git_environments_path = '/root/environments'
|
10
|
+
last_commit = git_last_commit(master, git_environments_path)
|
11
|
+
git_provider = ENV['GIT_PROVIDER'] || 'shellgit'
|
12
|
+
|
13
|
+
r10k_config_path = get_r10k_config_file_path(master)
|
14
|
+
r10k_config_bak_path = "#{r10k_config_path}.bak"
|
15
|
+
|
16
|
+
tmpfs_path = '/mnt/tmpfs'
|
17
|
+
|
18
|
+
#In-line files
|
19
|
+
r10k_conf = <<-CONF
|
20
|
+
cachedir: '/var/cache/r10k'
|
21
|
+
git:
|
22
|
+
provider: '#{git_provider}'
|
23
|
+
sources:
|
24
|
+
broken:
|
25
|
+
basedir: "#{tmpfs_path}"
|
26
|
+
remote: "#{git_control_remote}"
|
27
|
+
CONF
|
28
|
+
|
29
|
+
#Verification
|
30
|
+
error_message_regex = /ERROR\].*Read-only file system/m
|
31
|
+
|
32
|
+
#Teardown
|
33
|
+
teardown do
|
34
|
+
step 'Restore Original "r10k" Config'
|
35
|
+
on(master, "mv #{r10k_config_bak_path} #{r10k_config_path}")
|
36
|
+
|
37
|
+
step 'Unmount and Destroy TMP File System'
|
38
|
+
on(master, "umount #{tmpfs_path}")
|
39
|
+
on(master, "rm -rf #{tmpfs_path}")
|
40
|
+
end
|
41
|
+
|
42
|
+
#Setup
|
43
|
+
step 'Backup Current "r10k" Config'
|
44
|
+
on(master, "mv #{r10k_config_path} #{r10k_config_bak_path}")
|
45
|
+
|
46
|
+
step 'Update the "r10k" Config'
|
47
|
+
create_remote_file(master, r10k_config_path, r10k_conf)
|
48
|
+
|
49
|
+
step 'Create Read Only TMP File System and Mount'
|
50
|
+
on(master, "mkdir -p #{tmpfs_path}")
|
51
|
+
on(master, "mount -osize=10m,ro tmpfs #{tmpfs_path} -t tmpfs")
|
52
|
+
|
53
|
+
#Tests
|
54
|
+
step 'Attempt to Deploy via r10k'
|
55
|
+
on(master, 'r10k deploy environment', :acceptable_exit_codes => 1) do |result|
|
56
|
+
assert_match(error_message_regex, result.stderr, 'Expected message not found!')
|
57
|
+
end
|
data/integration/tests/user_scenario/basic_workflow/negative/neg_specify_deleted_forge_module.rb
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'git_utils'
|
2
|
+
require 'r10k_utils'
|
3
|
+
test_name 'CODEMGMT-127 - C64288 - Attempt to Deploy Environment Specify Deleted Forge Module'
|
4
|
+
|
5
|
+
#This test uses the regret module deleted from the acceptance forge (history at https://github.com/justinstoller/puppetlabs-regret/commits/master), with versions 0.1.0 - 0.4.0 deleted, effectively deleting the module.
|
6
|
+
|
7
|
+
#Init
|
8
|
+
git_environments_path = '/root/environments'
|
9
|
+
last_commit = git_last_commit(master, git_environments_path)
|
10
|
+
|
11
|
+
#Verification
|
12
|
+
error_notification_regex = /Does 'puppetlabs-regret' have at least one published release?/
|
13
|
+
|
14
|
+
#File
|
15
|
+
puppet_file = <<-PUPPETFILE
|
16
|
+
mod "puppetlabs/regret"
|
17
|
+
PUPPETFILE
|
18
|
+
|
19
|
+
puppet_file_path = File.join(git_environments_path, 'Puppetfile')
|
20
|
+
|
21
|
+
#Teardown
|
22
|
+
teardown do
|
23
|
+
clean_up_r10k(master, last_commit, git_environments_path)
|
24
|
+
end
|
25
|
+
|
26
|
+
#Setup
|
27
|
+
step 'Stub Forge on Master'
|
28
|
+
stub_forge_on(master)
|
29
|
+
|
30
|
+
#Tests
|
31
|
+
step 'Checkout "production" Branch'
|
32
|
+
git_on(master, 'checkout production', git_environments_path)
|
33
|
+
|
34
|
+
step 'Create "Puppetfile" for the "production" Environment'
|
35
|
+
create_remote_file(master, puppet_file_path, puppet_file)
|
36
|
+
|
37
|
+
step 'Push Changes'
|
38
|
+
git_add_commit_push(master, 'production', 'Add module.', git_environments_path)
|
39
|
+
|
40
|
+
#Tests
|
41
|
+
step "Deploy production environment via r10k with specified module deleted"
|
42
|
+
on(master, 'r10k deploy environment -p -v', :acceptable_exit_codes => 1) do |result|
|
43
|
+
assert_match(error_notification_regex, result.stderr, 'Unexpected error was detected!')
|
44
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require 'git_utils'
|
2
|
+
require 'r10k_utils'
|
3
|
+
require 'master_manipulator'
|
4
|
+
test_name 'CODEMGMT-62 - C59239 - Single Environment with 10,000 Files'
|
5
|
+
|
6
|
+
#Init
|
7
|
+
master_certname = on(master, puppet('config', 'print', 'certname')).stdout.rstrip
|
8
|
+
environment_path = on(master, puppet('config', 'print', 'environmentpath')).stdout.rstrip
|
9
|
+
prod_env_path = File.join(environment_path, 'production')
|
10
|
+
|
11
|
+
git_environments_path = '/root/environments'
|
12
|
+
last_commit = git_last_commit(master, git_environments_path)
|
13
|
+
local_files_root_path = ENV['FILES'] || 'files'
|
14
|
+
helloworld_module_path = File.join(local_files_root_path, 'modules', 'helloworld')
|
15
|
+
|
16
|
+
test_files = 'test_files'
|
17
|
+
test_files_path = File.join(git_environments_path, test_files)
|
18
|
+
|
19
|
+
file_bucket_path = '/opt/filebucket'
|
20
|
+
file_bucket_command_path = File.join(file_bucket_path, 'filebucketapp.py')
|
21
|
+
pattern_file_path = File.join(file_bucket_path, 'psuedo_random_128k.pat')
|
22
|
+
|
23
|
+
#Manifest
|
24
|
+
site_pp_path = File.join(git_environments_path, 'manifests', 'site.pp')
|
25
|
+
site_pp = create_site_pp(master_certname, ' include helloworld')
|
26
|
+
|
27
|
+
#Verification
|
28
|
+
notify_message_regex = /I am in the production environment/
|
29
|
+
|
30
|
+
checksum_file_name = 'files.md5'
|
31
|
+
prod_env_test_files_path = File.join(prod_env_path, test_files)
|
32
|
+
prod_env_checksum_file_path = File.join(prod_env_test_files_path, checksum_file_name)
|
33
|
+
|
34
|
+
#Teardown
|
35
|
+
teardown do
|
36
|
+
clean_up_r10k(master, last_commit, git_environments_path)
|
37
|
+
end
|
38
|
+
|
39
|
+
#Setup
|
40
|
+
step 'Checkout "production" Branch'
|
41
|
+
git_on(master, 'checkout production', git_environments_path)
|
42
|
+
|
43
|
+
step 'Copy "helloworld" Module to "production" Environment Git Repo'
|
44
|
+
scp_to(master, helloworld_module_path, File.join(git_environments_path, "site", 'helloworld'))
|
45
|
+
|
46
|
+
step 'Inject New "site.pp" to the "production" Environment'
|
47
|
+
inject_site_pp(master, site_pp_path, site_pp)
|
48
|
+
|
49
|
+
step 'Create 10,000 Files'
|
50
|
+
create_remote_file(master, File.join(git_environments_path, '.gitattributes'), '*.file binary')
|
51
|
+
on(master, "mkdir -p #{test_files_path}")
|
52
|
+
on(master, "#{file_bucket_command_path} -k -c 10000 -p #{test_files_path}/test -u .file")
|
53
|
+
|
54
|
+
step 'Create MD5 Checksum of Files'
|
55
|
+
on(master, "cd #{test_files_path};md5sum *.file > #{checksum_file_name}")
|
56
|
+
|
57
|
+
step 'Push Changes'
|
58
|
+
git_add_commit_push(master, 'production', 'Update site.pp and add module.', git_environments_path)
|
59
|
+
|
60
|
+
#Tests
|
61
|
+
step 'Deploy "production" Environment via r10k'
|
62
|
+
on(master, 'r10k deploy environment -v')
|
63
|
+
|
64
|
+
step 'Verify Files in "production" Environment'
|
65
|
+
on(master, "cd #{prod_env_test_files_path};md5sum -c #{prod_env_checksum_file_path}")
|
66
|
+
|
67
|
+
agents.each do |agent|
|
68
|
+
step "Run Puppet Agent"
|
69
|
+
on(agent, puppet('agent', '--test', '--environment production'), :acceptable_exit_codes => 2) do |result|
|
70
|
+
assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!')
|
71
|
+
assert_match(notify_message_regex, result.stdout, 'Expected message not found!')
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
require 'git_utils'
|
2
|
+
require 'r10k_utils'
|
3
|
+
require 'master_manipulator'
|
4
|
+
test_name 'CODEMGMT-40 - C59222 - Single Environment with Custom, Forge and Git Modules'
|
5
|
+
|
6
|
+
#Init
|
7
|
+
master_certname = on(master, puppet('config', 'print', 'certname')).stdout.rstrip
|
8
|
+
git_environments_path = '/root/environments'
|
9
|
+
last_commit = git_last_commit(master, git_environments_path)
|
10
|
+
local_files_root_path = ENV['FILES'] || 'files'
|
11
|
+
helloworld_module_path = File.join(local_files_root_path, 'modules', 'helloworld')
|
12
|
+
|
13
|
+
#Verification
|
14
|
+
motd_path = '/etc/motd'
|
15
|
+
motd_contents = 'Hello!'
|
16
|
+
motd_contents_regex = /\A#{motd_contents}\z/
|
17
|
+
|
18
|
+
ini_file_path = '/tmp/foo.ini'
|
19
|
+
ini_file_section = 'foo'
|
20
|
+
ini_file_setting = 'foosetting'
|
21
|
+
ini_file_value = 'FOO!'
|
22
|
+
ini_file_contents_regex = /\[#{ini_file_section}\].*#{ini_file_setting}\s=\s#{ini_file_value}/m
|
23
|
+
|
24
|
+
notify_message_regex = /I am in the production environment/
|
25
|
+
|
26
|
+
#File
|
27
|
+
puppet_file = <<-PUPPETFILE
|
28
|
+
mod "puppetlabs/motd"
|
29
|
+
mod 'puppetlabs/inifile',
|
30
|
+
:git => 'https://github.com/puppetlabs/puppetlabs-inifile'
|
31
|
+
PUPPETFILE
|
32
|
+
|
33
|
+
puppet_file_path = File.join(git_environments_path, 'Puppetfile')
|
34
|
+
|
35
|
+
#Manifest
|
36
|
+
manifest = <<-MANIFEST
|
37
|
+
class { 'helloworld': }
|
38
|
+
class { 'motd':
|
39
|
+
content => '#{motd_contents}',
|
40
|
+
}
|
41
|
+
ini_setting { "sample setting":
|
42
|
+
ensure => present,
|
43
|
+
path => '#{ini_file_path}',
|
44
|
+
section => '#{ini_file_section}',
|
45
|
+
setting => '#{ini_file_setting}',
|
46
|
+
value => '#{ini_file_value}',
|
47
|
+
}
|
48
|
+
MANIFEST
|
49
|
+
|
50
|
+
site_pp_path = File.join(git_environments_path, 'manifests', 'site.pp')
|
51
|
+
site_pp = create_site_pp(master_certname, manifest)
|
52
|
+
|
53
|
+
#Teardown
|
54
|
+
teardown do
|
55
|
+
clean_up_r10k(master, last_commit, git_environments_path)
|
56
|
+
|
57
|
+
step 'Remove "/etc/motd" File'
|
58
|
+
on(agents, "rm -rf #{motd_path}")
|
59
|
+
|
60
|
+
step 'Remove Temp INI File'
|
61
|
+
on(agents, "rm -rf #{ini_file_path}")
|
62
|
+
end
|
63
|
+
|
64
|
+
#Setup
|
65
|
+
step 'Stub Forge on Master'
|
66
|
+
stub_forge_on(master)
|
67
|
+
|
68
|
+
step 'Checkout "production" Branch'
|
69
|
+
git_on(master, 'checkout production', git_environments_path)
|
70
|
+
|
71
|
+
step 'Copy "helloworld" Module to "production" Environment Git Repo'
|
72
|
+
scp_to(master, helloworld_module_path, File.join(git_environments_path, "site", 'helloworld'))
|
73
|
+
|
74
|
+
step 'Inject New "site.pp" to the "production" Environment'
|
75
|
+
inject_site_pp(master, site_pp_path, site_pp)
|
76
|
+
|
77
|
+
step 'Create "Puppetfile" for the "production" Environment'
|
78
|
+
create_remote_file(master, puppet_file_path, puppet_file)
|
79
|
+
|
80
|
+
step 'Push Changes'
|
81
|
+
git_add_commit_push(master, 'production', 'Update site.pp and add modules.', git_environments_path)
|
82
|
+
|
83
|
+
#Tests
|
84
|
+
step 'Deploy "production" Environment via r10k'
|
85
|
+
on(master, 'r10k deploy environment -v -p')
|
86
|
+
|
87
|
+
agents.each do |agent|
|
88
|
+
step "Run Puppet Agent"
|
89
|
+
on(agent, puppet('agent', '--test', '--environment production'), :acceptable_exit_codes => 2) do |result|
|
90
|
+
assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!')
|
91
|
+
assert_match(notify_message_regex, result.stdout, 'Expected message not found!')
|
92
|
+
end
|
93
|
+
|
94
|
+
step "Verify MOTD Contents"
|
95
|
+
on(agent, "cat #{motd_path}") do |result|
|
96
|
+
assert_match(motd_contents_regex, result.stdout, 'File content is invalid!')
|
97
|
+
end
|
98
|
+
|
99
|
+
step "Verify INI File Contents"
|
100
|
+
on(agent, "cat #{ini_file_path}") do |result|
|
101
|
+
assert_match(ini_file_contents_regex, result.stdout, 'File content is invalid!')
|
102
|
+
end
|
103
|
+
end
|