waffle icon indicating copy to clipboard operation
waffle copied to clipboard

Two test failures in NegotiateSecurityFilterTests

Open michael-o opened this issue 7 years ago • 5 comments

mvn test tells me:

[INFO]
[INFO] Results:
[INFO]
[ERROR] Failures:
[ERROR]   NegotiateSecurityFilterTests.testChallengeNTLMPOST:275 expected:<1> but was:<3>
[ERROR]   NegotiateSecurityFilterTests.testChallengeNTLMPUT:304 expected:<1> but was:<3>
[INFO]
[ERROR] Tests run: 46, Failures: 2, Errors: 0, Skipped: 5
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] waffle-parent ...................................... SUCCESS [  6.530 s]
[INFO] waffle-jna ......................................... SUCCESS [  8.689 s]
[INFO] waffle-tests ....................................... FAILURE [ 10.655 s]

Debugging the test in Eclipse tells me that this code block is used:

public SecurityFilterProviderCollection(final IWindowsAuthProvider auth) {
    this.providers.add(new NegotiateSecurityFilterProvider(auth));
    this.providers.add(new BasicSecurityFilterProvider(auth));
}

so there are always three WWW-Authenticate values: Negotiate, NTLM, Basic realm="..."

Turning both values to 3 gives me:

[INFO]
[INFO] Results:
[INFO]
[ERROR] Failures:
[ERROR]   NegotiateSecurityFilterTests.testChallengeNTLMPOST:276
[ERROR]   NegotiateSecurityFilterTests.testChallengeNTLMPUT:305
[INFO]
[ERROR] Tests run: 46, Failures: 2, Errors: 0, Skipped: 5
[INFO]

The reason for this subsequent failures is

  1. Assert.assertTrue(wwwAuthenticates[0].startsWith("NTLM ")); the index is incorrect
  2. the missing NTLM type 2 message.

even turning that assertion off gives me:

[INFO]
[INFO] Results:
[INFO]
[ERROR] Failures:
[ERROR]   NegotiateSecurityFilterTests.testChallengeNTLMPOST:278 expected:<[keep-aliv]e> but was:<[clos]e>
[ERROR]   NegotiateSecurityFilterTests.testChallengeNTLMPUT:306 expected:<3> but was:<2>
[INFO]

In case of NTLM, close makes absolutely no sense here.

My machine (Windows 7 Enterprise) is part of a forest. Just created a Windows 10 Pro VM in VirtualBox which is not joined with any domain. The test passes. So these tests don't seem to be portable for me. Are they?

michael-o avatar Jun 07 '17 14:06 michael-o

@michael-o For me these have always worked. I'm not on a domain on my home machine so I'm sure that has something to do with it. I haven't seen others with issues so I suspect this maybe a rare case. What I can say is that neither travis ci or appvoyer even run tests due to other issues. So if you have time and can write some better tests that still cover the necessary items, I would say go for it and I can merge it in.

hazendaz avatar Jun 10 '17 22:06 hazendaz

@hazendaz Do you have a chance to test this in a domain? I highly suspect that this is the case.

michael-o avatar Jun 11 '17 08:06 michael-o

@michael-o Yes I can try this later this week.

hazendaz avatar Jun 13 '17 00:06 hazendaz

@michael-o Sorry for delay. I'm unable to test on a machine with a domain due to some restrictive policies. When I get some more time I'll try turning tests back on for appvoyer and hopefully can flush out these issues there.

hazendaz avatar Jun 29 '17 02:06 hazendaz

@hazendaz Sure thing, don't hurry. I am busy myself. I'll see wether I can reproduce this with a new Samba version on a Windows 7 joined machine.

michael-o avatar Jun 29 '17 12:06 michael-o