rapid7 / ruby_smb

A native Ruby implementation of the SMB Protocol Family
Other
80 stars 80 forks source link

Fix intermittent test failure with zero length fields #258

Closed dwelch-r7 closed 7 months ago

dwelch-r7 commented 7 months ago

We were getting intermittent failures for a test when the randomly selected size was 0

Failures:

  1) RubySMB::Dcerpc::Response#read sets #stub and #auth_pad to the correct values
     Failure/Error: expect(packet.auth_pad).to eq(response.auth_pad)

       expected: "CCCCCCCCCCCCC"
            got: "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"

       (compared using ==)

       Diff:
       @@ -1 +1 @@
       -"CCCCCCCCCCCCC"
       +"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"

     # ./spec/lib/ruby_smb/dcerpc/response_spec.rb:172:in `block (3 levels) in <top (required)>'

Finished in 12.8 seconds (files took 6.01 seconds to load)
11914 examples, 1 failure

Failed examples:

rspec ./spec/lib/ruby_smb/dcerpc/response_spec.rb:169 # RubySMB::Dcerpc::Response#read sets #stub and #auth_pad to the correct values

Randomized with seed 7550

Replication steps:

cd ruby_smb
git checkout f1cd79a628e0a9748909ddf3363456569b784a52
rspec --seed 755

This PR is just making 0 no longer an option for these tests