Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve test suite error messages when string encodings are different #18878

Merged
merged 1 commit into from
Feb 29, 2024

Conversation

adfoster-r7
Copy link
Contributor

Pulling in changes from rspec/rspec-expectations#1425

Example of failing tests from #18877 failing

Before

No clear reason for failure

bundle exec rspec spec/lib/msf/core/exploit/remote/x11.rb
...snip...
  2) Msf::Exploit::Remote::X11 creates a graphical context request is expected to eq "7\u0000\u0005\u0000\u0000\u0000\u0000\u0001(\u0005\u0000\u0000\b\u0000\u0000\u0000\xFF\xFF\xFF\u0000"
     Failure/Error: expect(request.to_binary_s).to eq(creategc)
     
       expected: "7\u0000\u0005\u0000\u0000\u0000\u0000\u0001(\u0005\u0000\u0000\b\u0000\u0000\u0000\xFF\xFF\xFF\u0000"
            got: "7\x00\x05\x00\x00\x00\x00\x01(\x05\x00\x00\b\x00\x00\x00\xFF\xFF\xFF\x00"
     
       (compared using ==)
...snip...

After

Clear reason for failure

  2) Msf::Exploit::Remote::X11 handles GetProperty request is expected to eq "\u0014\u0000\u0006\u0000(\u0005\u0000\u0000\u0017\u0000\u0000\u0000\u001F\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\xE1\xF5\u0005"
     Failure/Error: expect(request.to_binary_s).to eq(get_property)
     
       expected: #<Encoding:UTF-8> "\u0014\u0000\u0006\u0000(\u0005\u0000\u0000\u0017\u0000\u0000\u0000\u001F\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\xE1\xF5\u0005"
            got: #<Encoding:ASCII-8BIT> "\x14\x00\x06\x00(\x05\x00\x00\x17\x00\x00\x00\x1F\x00\x00\x00\x00\x00\x00\x00\x00\xE1\xF5\x05"

Verification

  • Ensure CI passes

@adfoster-r7 adfoster-r7 changed the title Update rspec libraries Improve test suite error messages when string encodings are different Feb 22, 2024
@jheysel-r7 jheysel-r7 merged commit 4fe861c into rapid7:master Feb 29, 2024
48 checks passed
@jheysel-r7
Copy link
Contributor

Release Notes

This PR updates a number of rspec gems which help improve test suite error messages when string encodings are different.

@jheysel-r7 jheysel-r7 added the rn-enhancement release notes enhancement label Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rn-enhancement release notes enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants