simp-rake-helpers 5.24.0 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +20 -1
- data/CHANGELOG.md +33 -0
- data/Gemfile +14 -6
- data/lib/simp/command_utils.rb +6 -3
- data/lib/simp/componentinfo.rb +47 -33
- data/lib/simp/local_gpg_signing_key.rb +302 -303
- data/lib/simp/packer/iso_vars_json.rb +17 -15
- data/lib/simp/rake/build/auto.rb +415 -432
- data/lib/simp/rake/build/build.rb +119 -124
- data/lib/simp/rake/build/clean.rb +39 -39
- data/lib/simp/rake/build/code.rb +125 -128
- data/lib/simp/rake/build/constants.rb +7 -4
- data/lib/simp/rake/build/deps.rb +196 -207
- data/lib/simp/rake/build/helpers.rb +17 -13
- data/lib/simp/rake/build/iso.rb +404 -411
- data/lib/simp/rake/build/pkg.rb +752 -759
- data/lib/simp/rake/build/rpmdeps.rb +70 -70
- data/lib/simp/rake/build/spec.rb +44 -46
- data/lib/simp/rake/build/tar.rb +169 -173
- data/lib/simp/rake/build/unpack.rb +105 -107
- data/lib/simp/rake/build/upload.rb +93 -102
- data/lib/simp/rake/fixtures.rb +69 -66
- data/lib/simp/rake/helpers/rpm_spec.rb +10 -7
- data/lib/simp/rake/helpers/version.rb +3 -1
- data/lib/simp/rake/helpers.rb +12 -10
- data/lib/simp/rake/pkg.rb +417 -440
- data/lib/simp/rake/pupmod/helpers.rb +100 -87
- data/lib/simp/rake/pupmod/module_build.rb +39 -0
- data/lib/simp/rake/rubygem.rb +57 -56
- data/lib/simp/rake.rb +34 -29
- data/lib/simp/relchecks.rb +52 -43
- data/lib/simp/rpm.rb +123 -127
- data/lib/simp/rpm_signer.rb +57 -55
- data/lib/simp/yum.rb +54 -53
- data/spec/acceptance/nodesets/{default_ruby3_1.yml → almalinux10.yml} +4 -4
- data/spec/acceptance/nodesets/{default.yml → almalinux8.yml} +2 -2
- data/spec/acceptance/nodesets/almalinux9.yml +25 -0
- data/spec/acceptance/suites/default/00_pkg_rpm_custom_scriptlets_spec.rb +23 -28
- data/spec/acceptance/suites/default/10_pkg_rpm_spec.rb +54 -56
- data/spec/acceptance/suites/default/30_pkg_misc_spec.rb +17 -19
- data/spec/acceptance/suites/default/50_local_gpg_signing_key_spec.rb +5 -5
- data/spec/acceptance/suites/default/55_build_pkg_signing_spec.rb +109 -101
- data/spec/acceptance/suites/default/files/testpackage/spec/classes/init_spec.rb +1 -0
- data/spec/acceptance/suites/default/files/testpackage/spec/files/mock_something.rb +3 -1
- data/spec/acceptance/suites/default/files/testpackage/utils/convert_v1_to_v2.rb +2 -0
- data/spec/acceptance/suites/default/support/build_project_helpers.rb +20 -17
- data/spec/acceptance/suites/default/support/build_user_helpers.rb +4 -2
- data/spec/acceptance/suites/default/support/pkg_rpm_helpers.rb +30 -31
- data/spec/acceptance/support/simp_rake_helpers.rb +3 -1
- data/spec/lib/simp/command_utils_spec.rb +13 -10
- data/spec/lib/simp/componentinfo_changelog_regex_spec.rb +33 -33
- data/spec/lib/simp/componentinfo_spec.rb +99 -86
- data/spec/lib/simp/packer/iso_vars_json_spec.rb +16 -14
- data/spec/lib/simp/rake/build/helpers_spec.rb +7 -7
- data/spec/lib/simp/rake/build/rpmdeps_spec.rb +48 -46
- data/spec/lib/simp/rake/helpers_spec.rb +6 -5
- data/spec/lib/simp/rake/pkg_spec.rb +7 -5
- data/spec/lib/simp/rake/pupmod/fixtures/othermod/spec/classes/init_spec.rb +3 -1
- data/spec/lib/simp/rake/pupmod/fixtures/othermod/spec/spec_helper.rb +2 -0
- data/spec/lib/simp/rake/pupmod/fixtures/simpmod/spec/acceptance/suites/default/class_spec.rb +6 -5
- data/spec/lib/simp/rake/pupmod/fixtures/simpmod/spec/classes/init_spec.rb +51 -33
- data/spec/lib/simp/rake/pupmod/fixtures/simpmod/spec/spec_helper.rb +15 -16
- data/spec/lib/simp/rake/pupmod/fixtures/simpmod/spec/spec_helper_acceptance.rb +9 -9
- data/spec/lib/simp/rake/pupmod/helpers_spec.rb +20 -19
- data/spec/lib/simp/rake/pupmod/module_build_spec.rb +87 -0
- data/spec/lib/simp/rake_spec.rb +7 -6
- data/spec/lib/simp/relchecks_check_rpm_changelog_spec.rb +26 -31
- data/spec/lib/simp/relchecks_compare_latest_tag_spec.rb +32 -26
- data/spec/lib/simp/relchecks_create_tag_changelog_spec.rb +27 -19
- data/spec/lib/simp/rpm_signer_spec.rb +45 -39
- data/spec/lib/simp/rpm_spec.rb +190 -194
- data/spec/spec_helper.rb +4 -2
- data/spec/spec_helper_acceptance.rb +3 -5
- metadata +47 -76
- data/bin/simp_rake_helpers +0 -3
- data/lib/simp/ci/gitlab.rb +0 -226
- data/lib/simp/rake/ci.rb +0 -31
- data/spec/lib/simp/ci/files/global_nodesets_only/spec/acceptance/nodesets/default.yml +0 -41
- data/spec/lib/simp/ci/files/global_nodesets_only/spec/acceptance/nodesets/oel.yml +0 -41
- data/spec/lib/simp/ci/files/job_broken_link_nodeset/spec/acceptance/nodesets/centos.yml +0 -41
- data/spec/lib/simp/ci/files/job_broken_link_nodeset/spec/acceptance/nodesets/oel.yml +0 -41
- data/spec/lib/simp/ci/files/job_broken_link_nodeset/spec/acceptance/suites/default/class_spec.rb +0 -0
- data/spec/lib/simp/ci/files/job_invalid_nodeset/spec/acceptance/nodesets/default.yml +0 -41
- data/spec/lib/simp/ci/files/job_invalid_nodeset/spec/acceptance/nodesets/oel.yml +0 -41
- data/spec/lib/simp/ci/files/job_invalid_nodeset/spec/acceptance/suites/default/class_spec.rb +0 -0
- data/spec/lib/simp/ci/files/job_invalid_suite/spec/acceptance/nodesets/default.yml +0 -41
- data/spec/lib/simp/ci/files/job_invalid_suite/spec/acceptance/nodesets/oel.yml +0 -41
- data/spec/lib/simp/ci/files/job_invalid_suite/spec/acceptance/suites/default/class_spec.rb +0 -0
- data/spec/lib/simp/ci/files/job_missing_nodeset/spec/acceptance/nodesets/default.yml +0 -41
- data/spec/lib/simp/ci/files/job_missing_nodeset/spec/acceptance/nodesets/oel.yml +0 -41
- data/spec/lib/simp/ci/files/job_missing_nodeset/spec/acceptance/suites/default/class_spec.rb +0 -0
- data/spec/lib/simp/ci/files/job_missing_suite_and_nodeset/spec/acceptance/nodesets/default.yml +0 -41
- data/spec/lib/simp/ci/files/job_missing_suite_and_nodeset/spec/acceptance/nodesets/oel.yml +0 -41
- data/spec/lib/simp/ci/files/job_missing_suite_and_nodeset/spec/acceptance/suites/default/class_spec.rb +0 -0
- data/spec/lib/simp/ci/files/multiple_invalid_jobs/spec/acceptance/nodesets/default.yml +0 -41
- data/spec/lib/simp/ci/files/multiple_invalid_jobs/spec/acceptance/nodesets/oel.yml +0 -41
- data/spec/lib/simp/ci/files/multiple_invalid_jobs/spec/acceptance/suites/default/class_spec.rb +0 -0
- data/spec/lib/simp/ci/files/multiple_invalid_jobs/spec/acceptance/suites/feature-1/feature-1_spec.rb +0 -0
- data/spec/lib/simp/ci/files/multiple_invalid_jobs/spec/acceptance/suites/feature_2/feature_2_spec.rb +0 -0
- data/spec/lib/simp/ci/files/multiple_invalid_jobs/spec/acceptance/suites/feature_2/nodesets/default.yml +0 -35
- data/spec/lib/simp/ci/files/multiple_invalid_jobs/spec/acceptance/suites/feature_2/nodesets/oel.yml +0 -35
- data/spec/lib/simp/ci/files/multiple_valid_jobs/spec/acceptance/nodesets/default.yml +0 -41
- data/spec/lib/simp/ci/files/multiple_valid_jobs/spec/acceptance/nodesets/oel.yml +0 -41
- data/spec/lib/simp/ci/files/multiple_valid_jobs/spec/acceptance/suites/default/class_spec.rb +0 -0
- data/spec/lib/simp/ci/files/multiple_valid_jobs/spec/acceptance/suites/feature-1/feature-1_spec.rb +0 -0
- data/spec/lib/simp/ci/files/multiple_valid_jobs/spec/acceptance/suites/feature_2/feature_2_spec.rb +0 -0
- data/spec/lib/simp/ci/files/multiple_valid_jobs/spec/acceptance/suites/feature_2/nodesets/default.yml +0 -35
- data/spec/lib/simp/ci/files/multiple_valid_jobs/spec/acceptance/suites/feature_2/nodesets/oel.yml +0 -35
- data/spec/lib/simp/ci/files/no_acceptance_tests/spec/spec_helper.rb +0 -0
- data/spec/lib/simp/ci/files/no_gitlab_config_with_tests/spec/acceptance/nodesets/default.yml +0 -41
- data/spec/lib/simp/ci/files/no_gitlab_config_with_tests/spec/acceptance/nodesets/oel.yml +0 -41
- data/spec/lib/simp/ci/files/no_gitlab_config_with_tests/spec/acceptance/suites/default/class_spec.rb +0 -0
- data/spec/lib/simp/ci/files/no_gitlab_config_without_tests/spec/acceptance/nodesets/default.yml +0 -41
- data/spec/lib/simp/ci/files/no_gitlab_config_without_tests/spec/acceptance/nodesets/oel.yml +0 -41
- data/spec/lib/simp/ci/files/suite_skeleton_only/spec/acceptance/nodesets/centos.yml +0 -41
- data/spec/lib/simp/ci/files/suite_skeleton_only/spec/acceptance/nodesets/oel.yml +0 -41
- data/spec/lib/simp/ci/files/valid_job_global_nodeset/spec/acceptance/nodesets/default.yml +0 -41
- data/spec/lib/simp/ci/files/valid_job_global_nodeset/spec/acceptance/nodesets/oel.yml +0 -41
- data/spec/lib/simp/ci/files/valid_job_global_nodeset/spec/acceptance/suites/default/class_spec.rb +0 -0
- data/spec/lib/simp/ci/files/valid_job_nodeset_dir_link/spec/acceptance/nodesets/default.yml +0 -41
- data/spec/lib/simp/ci/files/valid_job_nodeset_dir_link/spec/acceptance/nodesets/oel.yml +0 -41
- data/spec/lib/simp/ci/files/valid_job_nodeset_dir_link/spec/acceptance/suites/default/class_spec.rb +0 -0
- data/spec/lib/simp/ci/files/valid_job_nodeset_link/spec/acceptance/suites/default/class_spec.rb +0 -0
- data/spec/lib/simp/ci/files/valid_job_nodeset_link/spec/acceptance/suites/default/nodesets/centos.yml +0 -41
- data/spec/lib/simp/ci/files/valid_job_nodeset_link/spec/acceptance/suites/default/nodesets/oel.yml +0 -41
- data/spec/lib/simp/ci/files/valid_job_suite_nodeset/spec/acceptance/suites/default/class_spec.rb +0 -0
- data/spec/lib/simp/ci/files/valid_job_suite_nodeset/spec/acceptance/suites/default/nodesets/default.yml +0 -41
- data/spec/lib/simp/ci/files/valid_job_suite_nodeset/spec/acceptance/suites/default/nodesets/oel.yml +0 -41
- data/spec/lib/simp/ci/gitlab_spec.rb +0 -245
|
@@ -1,29 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'simp/command_utils'
|
|
2
4
|
require 'spec_helper'
|
|
3
5
|
|
|
4
6
|
describe Simp::CommandUtils do
|
|
5
7
|
RSpec.configure do |c|
|
|
6
|
-
c.include
|
|
8
|
+
c.include described_class
|
|
7
9
|
end
|
|
8
10
|
|
|
9
11
|
describe '.which' do
|
|
10
|
-
it '
|
|
12
|
+
it 'returns location of command that exists' do
|
|
11
13
|
expect(Facter::Core::Execution).to receive(:which).with('ls').and_return('/usr/bin/ls')
|
|
12
|
-
expect(
|
|
14
|
+
expect(which('ls')).to eq('/usr/bin/ls')
|
|
13
15
|
end
|
|
14
16
|
|
|
15
|
-
it '
|
|
16
|
-
expect(
|
|
17
|
+
it 'returns nil if command does not exist by default' do
|
|
18
|
+
expect(which('/does/not/exist/command')).to be_nil
|
|
17
19
|
end
|
|
18
20
|
|
|
19
|
-
it '
|
|
20
|
-
expect{ which('/does/not/exist/command', true) }.to raise_error(
|
|
21
|
-
RuntimeError,
|
|
21
|
+
it 'fails if command does not exist if fail=true' do
|
|
22
|
+
expect { which('/does/not/exist/command', true) }.to raise_error(
|
|
23
|
+
RuntimeError, %r{Warning: Command /does/not/exist/command not found}
|
|
24
|
+
)
|
|
22
25
|
end
|
|
23
26
|
|
|
24
|
-
it '
|
|
27
|
+
it 'caches commands' do
|
|
25
28
|
allow(Facter::Core::Execution).to receive(:which).with('ls').and_return('/path1/ls', '/path2/ls')
|
|
26
|
-
expect(
|
|
29
|
+
expect(which('ls')).to eq('/path1/ls')
|
|
27
30
|
end
|
|
28
31
|
end
|
|
29
32
|
end
|
|
@@ -1,120 +1,120 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'simp/relchecks'
|
|
2
4
|
require 'spec_helper'
|
|
3
5
|
|
|
4
6
|
describe 'Simp::ComponentInfo changelog regex' do
|
|
5
|
-
|
|
6
7
|
context 'valid initial changelog lines' do
|
|
7
8
|
it 'matches a valid line with a hyphen before version' do
|
|
8
9
|
line = '* Mon Nov 06 2017 Tom Smith <tom.smith@simp.com> - 3.8.0-0'
|
|
9
10
|
result = line.match(Simp::ComponentInfo::CHANGELOG_ENTRY_REGEX)
|
|
10
|
-
expect(
|
|
11
|
-
expect(
|
|
12
|
-
expect(
|
|
13
|
-
expect(
|
|
14
|
-
expect(
|
|
11
|
+
expect(result).not_to be_nil
|
|
12
|
+
expect(result[1]).to eq 'Mon Nov 06 2017'
|
|
13
|
+
expect(result[2]).to eq 'Tom Smith <tom.smith@simp.com>'
|
|
14
|
+
expect(result[3]).to eq '3.8.0'
|
|
15
|
+
expect(result[4]).to eq '0'
|
|
15
16
|
end
|
|
16
17
|
|
|
17
18
|
it 'matches a valid line without a hyphen before version' do
|
|
18
19
|
line = '* Mon Nov 06 2017 Tom Smith <tom.smith@simp.com> 13.28.30-RC1 '
|
|
19
20
|
result = line.match(Simp::ComponentInfo::CHANGELOG_ENTRY_REGEX)
|
|
20
|
-
expect(
|
|
21
|
-
expect(
|
|
22
|
-
expect(
|
|
23
|
-
expect(
|
|
24
|
-
expect(
|
|
21
|
+
expect(result).not_to be_nil
|
|
22
|
+
expect(result[1]).to eq 'Mon Nov 06 2017'
|
|
23
|
+
expect(result[2]).to eq 'Tom Smith <tom.smith@simp.com>'
|
|
24
|
+
expect(result[3]).to eq '13.28.30'
|
|
25
|
+
expect(result[4]).to eq 'RC1'
|
|
25
26
|
end
|
|
26
27
|
|
|
27
28
|
it 'matches a valid line without release qualifier' do
|
|
28
29
|
line = '* Mon Nov 06 2017 Tom Smith <tom.smith@simp.com> - 3.8.0'
|
|
29
30
|
result = line.match(Simp::ComponentInfo::CHANGELOG_ENTRY_REGEX)
|
|
30
|
-
expect(
|
|
31
|
-
expect(
|
|
32
|
-
expect(
|
|
33
|
-
expect(
|
|
34
|
-
expect(
|
|
31
|
+
expect(result).not_to be_nil
|
|
32
|
+
expect(result[1]).to eq 'Mon Nov 06 2017'
|
|
33
|
+
expect(result[2]).to eq 'Tom Smith <tom.smith@simp.com>'
|
|
34
|
+
expect(result[3]).to eq '3.8.0'
|
|
35
|
+
expect(result[4]).to be_nil
|
|
35
36
|
end
|
|
36
37
|
end
|
|
37
38
|
|
|
38
39
|
context 'invalid initial changelog lines' do
|
|
39
40
|
it "does not match line that does not begin with '*'" do
|
|
40
41
|
line = '- Mon Nov 06 2017 Tom Smith <tom.smith@simp.com> - 3.8.0-0'
|
|
41
|
-
expect(
|
|
42
|
+
expect(line.match(Simp::ComponentInfo::CHANGELOG_ENTRY_REGEX)).to be_nil
|
|
42
43
|
end
|
|
43
44
|
|
|
44
45
|
it 'does not match line with bad weekday' do
|
|
45
46
|
line = '* Tues Nov 06 2017 Tom Smith <tom.smith@simp.com> - 3.8.0-0'
|
|
46
|
-
expect(
|
|
47
|
+
expect(line.match(Simp::ComponentInfo::CHANGELOG_ENTRY_REGEX)).to be_nil
|
|
47
48
|
end
|
|
48
49
|
|
|
49
50
|
it 'does not match line missing weekday' do
|
|
50
51
|
line = '* Nov 06 2017 Tom Smith <tom.smith@simp.com> - 3.8.0-0'
|
|
51
|
-
expect(
|
|
52
|
+
expect(line.match(Simp::ComponentInfo::CHANGELOG_ENTRY_REGEX)).to be_nil
|
|
52
53
|
end
|
|
53
54
|
|
|
54
55
|
it 'does not match line with invalid month' do
|
|
55
56
|
line = '* Mon June 06 2017 Tom Smith <tom.smith@simp.com> - 3.8.0-0'
|
|
56
|
-
expect(
|
|
57
|
+
expect(line.match(Simp::ComponentInfo::CHANGELOG_ENTRY_REGEX)).to be_nil
|
|
57
58
|
end
|
|
58
59
|
|
|
59
60
|
it 'does not match line missing month' do
|
|
60
61
|
line = '* Mon 06 06 2017 Tom Smith <tom.smith@simp.com> - 3.8.0-0'
|
|
61
|
-
expect(
|
|
62
|
+
expect(line.match(Simp::ComponentInfo::CHANGELOG_ENTRY_REGEX)).to be_nil
|
|
62
63
|
end
|
|
63
64
|
|
|
64
65
|
it 'does not match line with single digit day' do
|
|
65
66
|
line = '* Mon Nov 6 2017 Tom Smith <tom.smith@simp.com> - 3.8.0-0'
|
|
66
|
-
expect(
|
|
67
|
+
expect(line.match(Simp::ComponentInfo::CHANGELOG_ENTRY_REGEX)).to be_nil
|
|
67
68
|
end
|
|
68
69
|
|
|
69
70
|
it 'does not match line with a too-large day' do
|
|
70
71
|
line = '* Mon Nov 46 2017 Tom Smith <tom.smith@simp.com> - 3.8.0-0'
|
|
71
|
-
expect(
|
|
72
|
+
expect(line.match(Simp::ComponentInfo::CHANGELOG_ENTRY_REGEX)).to be_nil
|
|
72
73
|
end
|
|
73
74
|
|
|
74
75
|
it 'does not match line missing day' do
|
|
75
76
|
line = '* Mon Nov 2017 Tom Smith <tom.smith@simp.com> - 3.8.0-0'
|
|
76
|
-
expect(
|
|
77
|
+
expect(line.match(Simp::ComponentInfo::CHANGELOG_ENTRY_REGEX)).to be_nil
|
|
77
78
|
end
|
|
78
79
|
|
|
79
80
|
it 'does not match line with a two-digit year' do
|
|
80
81
|
line = '* Mon Nov 01 17 Tom Smith <tom.smith@simp.com> - 3.8.0-0'
|
|
81
|
-
expect(
|
|
82
|
+
expect(line.match(Simp::ComponentInfo::CHANGELOG_ENTRY_REGEX)).to be_nil
|
|
82
83
|
end
|
|
83
84
|
|
|
84
85
|
it 'does not match line with a too-large year' do
|
|
85
86
|
line = '* Mon Nov 01 20170 Tom Smith <tom.smith@simp.com> - 3.8.0-0'
|
|
86
|
-
expect(
|
|
87
|
+
expect(line.match(Simp::ComponentInfo::CHANGELOG_ENTRY_REGEX)).to be_nil
|
|
87
88
|
end
|
|
88
89
|
|
|
89
90
|
it 'does not match line missing year' do
|
|
90
91
|
line = '* Mon Nov 01 Tom Smith <tom.smith@simp.com> - 3.8.0-0'
|
|
91
|
-
expect(
|
|
92
|
+
expect(line.match(Simp::ComponentInfo::CHANGELOG_ENTRY_REGEX)).to be_nil
|
|
92
93
|
end
|
|
93
94
|
|
|
94
95
|
it 'does not match line missing author name' do
|
|
95
96
|
line = '* Mon Nov 01 2017 <tom.smith@simp.com> - 3.8.0-0'
|
|
96
|
-
expect(
|
|
97
|
+
expect(line.match(Simp::ComponentInfo::CHANGELOG_ENTRY_REGEX)).to be_nil
|
|
97
98
|
end
|
|
98
99
|
|
|
99
100
|
it 'does not match line missing author email address' do
|
|
100
101
|
line = '* Mon Nov 01 20170 Tom Smith - 3.8.0-0'
|
|
101
|
-
expect(
|
|
102
|
+
expect(line.match(Simp::ComponentInfo::CHANGELOG_ENTRY_REGEX)).to be_nil
|
|
102
103
|
end
|
|
103
104
|
|
|
104
105
|
it 'does not match line missing version' do
|
|
105
106
|
line = '* Mon Nov 06 2017 Tom Smith <tom.smith@simp.com>'
|
|
106
|
-
expect(
|
|
107
|
+
expect(line.match(Simp::ComponentInfo::CHANGELOG_ENTRY_REGEX)).to be_nil
|
|
107
108
|
end
|
|
108
109
|
|
|
109
110
|
it 'does not match line with a version less than 3 parts' do
|
|
110
111
|
line = '* Mon Nov 01 20170 Tom Smith <tom.smith@simp.com> - 3.8'
|
|
111
|
-
expect(
|
|
112
|
+
expect(line.match(Simp::ComponentInfo::CHANGELOG_ENTRY_REGEX)).to be_nil
|
|
112
113
|
end
|
|
113
114
|
|
|
114
115
|
it 'does not match a valid line with more than 3 parts in the version' do
|
|
115
116
|
line = '* Mon Nov 06 2017 Tom Smith <tom.smith@simp.com> 3.8.0.0'
|
|
116
|
-
expect(
|
|
117
|
+
expect(line.match(Simp::ComponentInfo::CHANGELOG_ENTRY_REGEX)).to be_nil
|
|
117
118
|
end
|
|
118
|
-
|
|
119
119
|
end
|
|
120
120
|
end
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'simp/componentinfo'
|
|
2
4
|
require 'spec_helper'
|
|
3
5
|
|
|
4
6
|
describe Simp::ComponentInfo do
|
|
5
|
-
let(:files_dir)
|
|
6
|
-
File.join(
|
|
7
|
-
|
|
7
|
+
let(:files_dir) do
|
|
8
|
+
File.join(File.dirname(__FILE__), 'files', File.basename(__FILE__, '.rb'))
|
|
9
|
+
end
|
|
8
10
|
|
|
9
11
|
context 'with valid module input' do
|
|
10
|
-
let(:component_dir){ File.join(files_dir, 'module') }
|
|
11
|
-
let(:info){
|
|
12
|
+
let(:component_dir) { File.join(files_dir, 'module') }
|
|
13
|
+
let(:info) { described_class.new(component_dir) }
|
|
12
14
|
let(:expected_release) { nil }
|
|
13
15
|
let(:expected_changelog) do
|
|
14
16
|
[
|
|
@@ -18,7 +20,7 @@ describe Simp::ComponentInfo do
|
|
|
18
20
|
:release => '0',
|
|
19
21
|
:content => [
|
|
20
22
|
'* Wed Nov 15 2017 Mary Jones <mary.jones@simp.com> - 3.8.0-0',
|
|
21
|
-
'- Disable deprecation warnings by default'
|
|
23
|
+
'- Disable deprecation warnings by default',
|
|
22
24
|
]
|
|
23
25
|
},
|
|
24
26
|
{
|
|
@@ -27,17 +29,17 @@ describe Simp::ComponentInfo do
|
|
|
27
29
|
:release => '0',
|
|
28
30
|
:content => [
|
|
29
31
|
'* Mon Nov 06 2017 Tom Smith <tom.smith@simp.com> - 3.8.0-0',
|
|
30
|
-
'- Fixes split failure when "findmnt" does not exist on Linux'
|
|
32
|
+
'- Fixes split failure when "findmnt" does not exist on Linux',
|
|
31
33
|
]
|
|
32
34
|
},
|
|
33
35
|
{
|
|
34
36
|
:date => 'Thu Oct 26 2017',
|
|
35
37
|
:version => '3.7.0',
|
|
36
38
|
:release => '0',
|
|
37
|
-
:content => [
|
|
39
|
+
:content => [ # +changelog_date+:: Date string of the form <weekday> <month> <day> <year>
|
|
38
40
|
|
|
39
41
|
'* Thu Oct 26 2017 Mary Jones <mary.jones@simp.com> - 3.7.0-0',
|
|
40
|
-
'- Add Mod::Macaddress data type'
|
|
42
|
+
'- Add Mod::Macaddress data type',
|
|
41
43
|
]
|
|
42
44
|
},
|
|
43
45
|
{
|
|
@@ -49,31 +51,33 @@ describe Simp::ComponentInfo do
|
|
|
49
51
|
"- Convert all 'sysctl' 'kernel.shm*' entries to Strings",
|
|
50
52
|
' - shmall and shmmax were causing Facter and newer versions of Puppet to crash',
|
|
51
53
|
' - See FACT-1732 for additional information',
|
|
52
|
-
'- Add Puppet function `mod::assert_metadata_os()`'
|
|
54
|
+
'- Add Puppet function `mod::assert_metadata_os()`',
|
|
53
55
|
]
|
|
54
|
-
}
|
|
56
|
+
},
|
|
55
57
|
]
|
|
56
58
|
end
|
|
57
59
|
|
|
58
60
|
shared_examples 'an instance with expected module data' do
|
|
59
|
-
it { expect(
|
|
60
|
-
it { expect(
|
|
61
|
-
it { expect(
|
|
62
|
-
it { expect(
|
|
61
|
+
it { expect(info.component_dir).to eq component_dir }
|
|
62
|
+
it { expect(info.type).to eq :module }
|
|
63
|
+
it { expect(info.version).to eq '3.8.0' }
|
|
64
|
+
it { expect(info.release).to eq expected_release }
|
|
63
65
|
it { expect(info.changelog).to eq expected_changelog }
|
|
64
66
|
end
|
|
65
67
|
|
|
66
68
|
it_behaves_like 'an instance with expected module data'
|
|
67
69
|
|
|
68
70
|
context 'with loads version and latest-version-only changelog info' do
|
|
69
|
-
let(:info){
|
|
70
|
-
let(:expected_changelog){ super()[0..1] }
|
|
71
|
+
let(:info) { described_class.new(component_dir, true) }
|
|
72
|
+
let(:expected_changelog) { super()[0..1] }
|
|
73
|
+
|
|
71
74
|
it_behaves_like 'an instance with expected module data'
|
|
72
75
|
end
|
|
73
76
|
|
|
74
77
|
context 'with a module version containing a prerelease suffix (3.8.0-rc0)' do
|
|
75
|
-
let(:component_dir){ File.join(files_dir, 'module_with_prerelease_dash_in_version') }
|
|
76
|
-
let(:expected_release){ 'rc0' }
|
|
78
|
+
let(:component_dir) { File.join(files_dir, 'module_with_prerelease_dash_in_version') }
|
|
79
|
+
let(:expected_release) { 'rc0' }
|
|
80
|
+
|
|
77
81
|
it_behaves_like 'an instance with expected module data'
|
|
78
82
|
end
|
|
79
83
|
end
|
|
@@ -81,37 +85,42 @@ describe Simp::ComponentInfo do
|
|
|
81
85
|
context 'with invalid module input' do
|
|
82
86
|
it 'fails when metadata.json is malformed' do
|
|
83
87
|
component_dir = File.join(files_dir, 'module_with_malformed_metadata')
|
|
84
|
-
expect{
|
|
85
|
-
JSON::ParserError
|
|
88
|
+
expect { described_class.new(component_dir) }.to raise_error(
|
|
89
|
+
JSON::ParserError,
|
|
90
|
+
)
|
|
86
91
|
end
|
|
87
92
|
|
|
88
93
|
it 'fails when version is missing from metadata.json' do
|
|
89
94
|
component_dir = File.join(files_dir, 'module_missing_version_metadata')
|
|
90
|
-
expect{
|
|
91
|
-
|
|
95
|
+
expect { described_class.new(component_dir) }.to raise_error(
|
|
96
|
+
%r{Version missing from .*module_missing_version_metadata/metadata.json},
|
|
97
|
+
)
|
|
92
98
|
end
|
|
93
99
|
|
|
94
100
|
it 'fails when module CHANGELOG is missing' do
|
|
95
101
|
component_dir = File.join(files_dir, 'module_without_changelog')
|
|
96
|
-
expect{
|
|
97
|
-
|
|
102
|
+
expect { described_class.new(component_dir) }.to raise_error(
|
|
103
|
+
%r{No CHANGELOG file found in .*module_without_changelog},
|
|
104
|
+
)
|
|
98
105
|
end
|
|
99
106
|
|
|
100
107
|
it 'fails when any changelog entry version is > top-most version' do
|
|
101
108
|
component_dir = File.join(files_dir, 'module_with_version_misordered_entries')
|
|
102
|
-
expect{
|
|
103
|
-
|
|
109
|
+
expect { described_class.new(component_dir) }.to raise_error(
|
|
110
|
+
%r{ERROR: Changelog entries are not properly version ordered},
|
|
111
|
+
)
|
|
104
112
|
end
|
|
105
113
|
|
|
106
114
|
it 'fails when changelog entry dates are not ordered newest to oldest' do
|
|
107
115
|
component_dir = File.join(files_dir, 'module_with_date_misordered_entries')
|
|
108
|
-
expect{
|
|
109
|
-
|
|
116
|
+
expect { described_class.new(component_dir) }.to raise_error(
|
|
117
|
+
%r{ERROR: Changelog entries are not properly date ordered},
|
|
118
|
+
)
|
|
110
119
|
end
|
|
111
120
|
|
|
112
121
|
it 'stops processing upon first malformed changelog signature' do
|
|
113
122
|
component_dir = File.join(files_dir, 'module_with_invalid_entries')
|
|
114
|
-
info =
|
|
123
|
+
info = described_class.new(component_dir)
|
|
115
124
|
expected_changelog = [
|
|
116
125
|
{
|
|
117
126
|
:date => 'Wed Nov 15 2017',
|
|
@@ -119,16 +128,16 @@ describe Simp::ComponentInfo do
|
|
|
119
128
|
:release => '0',
|
|
120
129
|
:content => [
|
|
121
130
|
'* Wed Nov 15 2017 Mary Jones <mary.jones@simp.com> - 3.8.0-0',
|
|
122
|
-
'- Disable deprecation warnings by default'
|
|
131
|
+
'- Disable deprecation warnings by default',
|
|
123
132
|
]
|
|
124
|
-
}
|
|
133
|
+
},
|
|
125
134
|
]
|
|
126
135
|
expect(info.changelog).to eq expected_changelog
|
|
127
136
|
end
|
|
128
137
|
|
|
129
138
|
it 'stops processing upon first invalid changelog weekday' do
|
|
130
139
|
component_dir = File.join(files_dir, 'module_with_invalid_weekday_entry')
|
|
131
|
-
info =
|
|
140
|
+
info = described_class.new(component_dir)
|
|
132
141
|
expected_changelog = [
|
|
133
142
|
{
|
|
134
143
|
:date => 'Thu Nov 16 2017',
|
|
@@ -136,22 +145,22 @@ describe Simp::ComponentInfo do
|
|
|
136
145
|
:release => '0',
|
|
137
146
|
:content => [
|
|
138
147
|
'* Thu Nov 16 2017 Mary Jones <mary.jones@simp.com> - 3.8.0-0',
|
|
139
|
-
'- Disable deprecation warnings by default'
|
|
148
|
+
'- Disable deprecation warnings by default',
|
|
140
149
|
]
|
|
141
|
-
}
|
|
150
|
+
},
|
|
142
151
|
]
|
|
143
152
|
expect(info.changelog).to eq expected_changelog
|
|
144
153
|
end
|
|
145
154
|
end
|
|
146
155
|
|
|
147
156
|
context 'with valid asset input' do
|
|
148
|
-
|
|
157
|
+
it 'loads version, release and changelog info from a single-package spec file' do
|
|
149
158
|
component_dir = File.join(files_dir, 'asset_with_single_package')
|
|
150
|
-
info =
|
|
151
|
-
expect(
|
|
152
|
-
expect(
|
|
153
|
-
expect(
|
|
154
|
-
expect(
|
|
159
|
+
info = described_class.new(component_dir, true)
|
|
160
|
+
expect(info.component_dir).to eq component_dir
|
|
161
|
+
expect(info.type).to eq :asset
|
|
162
|
+
expect(info.version).to eq '1.0.0'
|
|
163
|
+
expect(info.release).to eq '1'
|
|
155
164
|
expected_changelog = [
|
|
156
165
|
{
|
|
157
166
|
:date => 'Wed Oct 18 2017',
|
|
@@ -159,20 +168,20 @@ describe Simp::ComponentInfo do
|
|
|
159
168
|
:release => '1',
|
|
160
169
|
:content => [
|
|
161
170
|
'* Wed Oct 18 2017 Jane Doe <jane.doe@simp.com> - 1.0.0-1',
|
|
162
|
-
'- Fix installed file permissions'
|
|
171
|
+
'- Fix installed file permissions',
|
|
163
172
|
]
|
|
164
|
-
}
|
|
173
|
+
},
|
|
165
174
|
]
|
|
166
175
|
expect(info.changelog).to eq expected_changelog
|
|
167
176
|
end
|
|
168
177
|
|
|
169
178
|
it 'loads version, release, and changelog info for primary package from a multi-package spec file' do
|
|
170
179
|
component_dir = File.join(files_dir, 'asset_with_multiple_packages')
|
|
171
|
-
info =
|
|
172
|
-
expect(
|
|
173
|
-
expect(
|
|
174
|
-
expect(
|
|
175
|
-
expect(
|
|
180
|
+
info = described_class.new(component_dir)
|
|
181
|
+
expect(info.component_dir).to eq component_dir
|
|
182
|
+
expect(info.type).to eq :asset
|
|
183
|
+
expect(info.version).to eq '4.0.3'
|
|
184
|
+
expect(info.release).to eq '0'
|
|
176
185
|
expected_changelog = [
|
|
177
186
|
{
|
|
178
187
|
:date => 'Thu Aug 31 2017',
|
|
@@ -181,7 +190,7 @@ describe Simp::ComponentInfo do
|
|
|
181
190
|
:content => [
|
|
182
191
|
'* Thu Aug 31 2017 Jane Doe <jane.doe@simp.com> - 4.0.3',
|
|
183
192
|
'- Fix bug Z',
|
|
184
|
-
' - Thanks to Lilia Smith for the PR!'
|
|
193
|
+
' - Thanks to Lilia Smith for the PR!',
|
|
185
194
|
]
|
|
186
195
|
},
|
|
187
196
|
{
|
|
@@ -190,7 +199,7 @@ describe Simp::ComponentInfo do
|
|
|
190
199
|
:release => nil,
|
|
191
200
|
:content => [
|
|
192
201
|
'* Mon Jun 12 2017 Jane Doe <jane.doe@simp.com> - 4.0.3',
|
|
193
|
-
'- Prompt user for new input'
|
|
202
|
+
'- Prompt user for new input',
|
|
194
203
|
]
|
|
195
204
|
},
|
|
196
205
|
{
|
|
@@ -200,20 +209,20 @@ describe Simp::ComponentInfo do
|
|
|
200
209
|
:content => [
|
|
201
210
|
'* Fri Jun 02 2017 Jim Jones <jim.jones@simp.com> - 4.0.2-0',
|
|
202
211
|
'- Expand X',
|
|
203
|
-
'- Fix Y'
|
|
212
|
+
'- Fix Y',
|
|
204
213
|
]
|
|
205
|
-
}
|
|
214
|
+
},
|
|
206
215
|
]
|
|
207
216
|
expect(info.changelog).to eq expected_changelog
|
|
208
217
|
end
|
|
209
218
|
|
|
210
219
|
it 'loads version, release, and changelog info when release includes distribution' do
|
|
211
220
|
component_dir = File.join(files_dir, 'asset_with_dist_in_release')
|
|
212
|
-
info =
|
|
213
|
-
expect(
|
|
214
|
-
expect(
|
|
215
|
-
expect(
|
|
216
|
-
expect(
|
|
221
|
+
info = described_class.new(component_dir)
|
|
222
|
+
expect(info.component_dir).to eq component_dir
|
|
223
|
+
expect(info.type).to eq :asset
|
|
224
|
+
expect(info.version).to eq '1.0.0'
|
|
225
|
+
expect(info.release).to include('0')
|
|
217
226
|
expected_changelog = [
|
|
218
227
|
{
|
|
219
228
|
:date => 'Wed Oct 18 2017',
|
|
@@ -221,52 +230,56 @@ describe Simp::ComponentInfo do
|
|
|
221
230
|
:release => '0',
|
|
222
231
|
:content => [
|
|
223
232
|
'* Wed Oct 18 2017 Jane Doe <jane.doe@simp.com> - 1.0.0-0',
|
|
224
|
-
'- Package with distribution in release tag'
|
|
233
|
+
'- Package with distribution in release tag',
|
|
225
234
|
]
|
|
226
|
-
}
|
|
235
|
+
},
|
|
227
236
|
]
|
|
228
237
|
expect(info.changelog).to eq expected_changelog
|
|
229
238
|
end
|
|
230
239
|
end
|
|
231
240
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
241
|
+
# Since same changelog parsing code is used for module and
|
|
242
|
+
# RPM changelog content, only focus on the errors not already
|
|
243
|
+
# tested above.
|
|
235
244
|
context 'with invalid asset input' do
|
|
236
245
|
it 'fails when asset RPM spec file is missing' do
|
|
237
246
|
component_dir = File.join(files_dir, 'asset_without_spec_file')
|
|
238
|
-
expect{
|
|
239
|
-
|
|
240
|
-
|
|
247
|
+
expect { described_class.new(component_dir) }.to raise_error(
|
|
248
|
+
%r{No RPM spec file found in .*asset_without_spec_file/build},
|
|
249
|
+
)
|
|
250
|
+
end
|
|
241
251
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
252
|
+
it 'fails when more than 1 asset RPM spec file is found' do
|
|
253
|
+
component_dir = File.join(files_dir, 'asset_with_two_spec_files')
|
|
254
|
+
expect { described_class.new(component_dir) }.to raise_error(
|
|
255
|
+
%r{More than 1 RPM spec file found:},
|
|
256
|
+
)
|
|
257
|
+
end
|
|
247
258
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
259
|
+
it 'fails when version is missing from asset RPM spec file' do
|
|
260
|
+
component_dir = File.join(files_dir, 'asset_missing_version')
|
|
261
|
+
expect { described_class.new(component_dir) }.to raise_error(
|
|
262
|
+
%r{Could not extract version and release from },
|
|
263
|
+
)
|
|
264
|
+
end
|
|
253
265
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
266
|
+
it 'fails when release is missing from asset RPM spec file' do
|
|
267
|
+
component_dir = File.join(files_dir, 'asset_missing_release')
|
|
268
|
+
expect { described_class.new(component_dir) }.to raise_error(
|
|
269
|
+
%r{Could not extract version and release from },
|
|
270
|
+
)
|
|
271
|
+
end
|
|
259
272
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
273
|
+
it 'fails when changelog cannot be read from asset RPM spec file' do
|
|
274
|
+
skip(
|
|
275
|
+
<<~SKIP.strip.split("\n").join(' '),
|
|
263
276
|
This has to be a case in which version and release can be read from
|
|
264
277
|
spec file but the changelog (which is optional) can't.
|
|
265
278
|
|
|
266
279
|
It *could* be mocked, but is probably not worth the LOE unless we
|
|
267
280
|
encounter a real-world test case."
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
281
|
+
SKIP
|
|
282
|
+
)
|
|
283
|
+
end
|
|
271
284
|
end
|
|
272
285
|
end
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'simp/packer/iso_vars_json'
|
|
2
4
|
require 'spec_helper'
|
|
3
5
|
require 'tmpdir'
|
|
4
6
|
require 'json'
|
|
5
7
|
|
|
6
8
|
describe Simp::Packer::IsoVarsJson do
|
|
7
|
-
DUMMY_CONTENT = 'Dummy text with known checksum'
|
|
8
|
-
DUMMY_CHECKSUM = 'bd6eae40b2b18359f33332dd5b1a3dd5c9e885240c3d4907d6a1208cdafa0003'
|
|
9
|
+
DUMMY_CONTENT = 'Dummy text with known checksum'
|
|
10
|
+
DUMMY_CHECKSUM = 'bd6eae40b2b18359f33332dd5b1a3dd5c9e885240c3d4907d6a1208cdafa0003'
|
|
9
11
|
|
|
10
|
-
before do
|
|
12
|
+
before(:each) do
|
|
11
13
|
@tmp_dir = Dir.mktmpdir(File.basename(__FILE__))
|
|
12
14
|
@iso = File.expand_path('fixture.iso', @tmp_dir)
|
|
13
15
|
File.open(@iso, 'w') { |f| f.puts DUMMY_CONTENT }
|
|
@@ -21,7 +23,7 @@ describe Simp::Packer::IsoVarsJson do
|
|
|
21
23
|
@var_json = described_class.new(@iso, target_release, target_data, :silent => true)
|
|
22
24
|
end
|
|
23
25
|
|
|
24
|
-
after do
|
|
26
|
+
after(:each) do
|
|
25
27
|
FileUtils.remove_entry_secure @tmp_dir
|
|
26
28
|
end
|
|
27
29
|
|
|
@@ -31,22 +33,22 @@ describe Simp::Packer::IsoVarsJson do
|
|
|
31
33
|
it 'returns expected information for v1.0.0 format' do
|
|
32
34
|
expect(@var_json.data).to include(
|
|
33
35
|
'simp_vars_version' => '1.0.0',
|
|
34
|
-
'box_distro_release'
|
|
35
|
-
'box_simp_release'
|
|
36
|
-
'iso_checksum'
|
|
37
|
-
'iso_checksum_type'
|
|
38
|
-
'dist_os_flavor'
|
|
36
|
+
'box_distro_release' => 'SIMP-6.3.0-Beta1-CentOS-6.10',
|
|
37
|
+
'box_simp_release' => '6.3.0-Beta1',
|
|
38
|
+
'iso_checksum' => DUMMY_CHECKSUM,
|
|
39
|
+
'iso_checksum_type' => 'sha256',
|
|
40
|
+
'dist_os_flavor' => 'CentOS',
|
|
39
41
|
'dist_os_maj_version' => '6',
|
|
40
|
-
'dist_os_version'
|
|
41
|
-
'dist_source_isos'
|
|
42
|
-
'packer_src_type'
|
|
43
|
-
'iso_builder'
|
|
42
|
+
'dist_os_version' => '6.10',
|
|
43
|
+
'dist_source_isos' => 'CentOS-6.10-x86_64-bin-DVD1.iso:CentOS-6.10-x86_64-bin-DVD2.iso',
|
|
44
|
+
'packer_src_type' => 'simp-iso',
|
|
45
|
+
'iso_builder' => 'rubygem-simp-rake-helpers',
|
|
44
46
|
)
|
|
45
47
|
end
|
|
46
48
|
end
|
|
47
49
|
|
|
48
50
|
describe '#write' do
|
|
49
|
-
before
|
|
51
|
+
before(:each) { @var_json.write }
|
|
50
52
|
|
|
51
53
|
let(:json_file) { "#{File.basename(@iso, '.iso')}.json" }
|
|
52
54
|
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'simp/rake/build/helpers'
|
|
2
4
|
require 'spec_helper'
|
|
3
5
|
|
|
4
6
|
describe Simp::Rake::Build::Helpers do
|
|
5
7
|
before :each do
|
|
6
|
-
dir = File.expand_path(
|
|
8
|
+
dir = File.expand_path('../../files/simp_build', File.dirname(__FILE__))
|
|
7
9
|
env = ENV['SIMP_RPM_dist'].dup
|
|
8
10
|
ENV['SIMP_RPM_dist'] = '.el7'
|
|
9
|
-
@obj =
|
|
11
|
+
@obj = described_class.new(dir)
|
|
10
12
|
ENV['SIMP_RPM_dist'] = env
|
|
11
13
|
end
|
|
12
14
|
|
|
13
|
-
describe
|
|
14
|
-
it
|
|
15
|
-
expect(
|
|
15
|
+
describe '#initialize' do
|
|
16
|
+
it 'initialized (smoke test)' do
|
|
17
|
+
expect(@obj.class).to eq described_class
|
|
16
18
|
end
|
|
17
19
|
end
|
|
18
20
|
end
|
|
19
|
-
|
|
20
|
-
|