Skip to content

Commit eb498be

Browse files
authored
Merge pull request #8939 from AriaXLi/pup-11406_update_rspec_for_ruby_3.1
(PUP-11406) Update puppet rspec tests for Ruby 3.1.
2 parents 2377fad + cd84949 commit eb498be

File tree

5 files changed

+9
-5
lines changed

5 files changed

+9
-5
lines changed

spec/unit/http/service/compiler_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@
592592
invalid_facts = Puppet::Node::Facts.new(certname, {'invalid_utf8_sequence' => "\xE2\x82".force_encoding('binary')})
593593
expect {
594594
subject.put_facts(certname, environment: 'production', facts: invalid_facts)
595-
}.to raise_error(Puppet::HTTP::SerializationError, /Failed to serialize Puppet::Node::Facts to json: "\\xE2" from ASCII-8BIT to UTF-8/)
595+
}.to raise_error(Puppet::HTTP::SerializationError, /Failed to serialize Puppet::Node::Facts to json: ("\\xE2" from ASCII-8BIT to UTF-8|partial character in source, but hit end)/)
596596
end
597597
end
598598

spec/unit/network/formats_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ def self.from_binary(data)
504504

505505
context "when rendering face-related objects" do
506506
it "pretty prints facts" do
507-
tm = Time.new("2016-01-27T19:30:00")
507+
tm = Time.new(2016, 1, 27, 19, 30, 0)
508508
values = {
509509
"architecture" => "x86_64",
510510
"os" => {

spec/unit/reports/store_spec.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@
1515
end
1616

1717
let(:report) do
18-
report = YAML.load_file(File.join(PuppetSpec::FIXTURE_DIR, 'yaml/report2.6.x.yaml'))
18+
if RUBY_VERSION < "3.0"
19+
report = YAML.load_file(File.join(PuppetSpec::FIXTURE_DIR, 'yaml/report2.6.x.yaml'))
20+
else
21+
report = YAML.unsafe_load_file(File.join(PuppetSpec::FIXTURE_DIR, 'yaml/report2.6.x.yaml'))
22+
end
1923
report.extend(described_class)
2024
report
2125
end

spec/unit/util/storage_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def write_state_file(contents)
170170
it 'should load Time and Symbols' do
171171
state = {
172172
'File[/etc/puppetlabs/puppet]' =>
173-
{ :checked => Time.new('2018-08-08 15:28:25.546999000 -07:00') }
173+
{ :checked => Time.new(2018, 8, 8, 15, 28, 25, "-07:00") }
174174
}
175175
write_state_file(YAML.dump(state))
176176

spec/unit/x509/cert_provider_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def expects_private_file(path)
135135

136136
expect {
137137
create_provider(crlpath: crl_path).load_crls
138-
}.to raise_error(OpenSSL::X509::CRLError, 'nested asn1 error')
138+
}.to raise_error(OpenSSL::X509::CRLError, /(PEM_read_bio_X509_CRL: bad base64 decode|nested asn1 error)/)
139139
end
140140

141141
it 'raises if the input is empty' do

0 commit comments

Comments
 (0)