Unit tests all work on my dev machine but some fail in AppVeyor

Pure Krome's Avatar

Pure Krome

04 Nov, 2014 11:26 AM

Heya!

like the title says, unit tests all go green on my machine, but some fail on AppVeyor.

here's a sample..

Shouldly.ChuckedAWobbly : 
    result.Query
        should be
    "?pewpew=woot&foo=bar&x=y&state=0aa44508-991a-47db-b6b4-d8edd4c0bf40&a=1&b%5E%2A%26%2F234=%26%257as%20ad7%206%2A%20SA%20"
        but was
    "?pewpew=woot&foo=bar&x=y&state=0aa44508-991a-47db-b6b4-d8edd4c0bf40&a=1&b%5E*%26%2F234=%26%257as%20ad7%206*%20SA%20"

Ok .. notice this difference :

%5E%2A%26

vs

%5E*%26

So what's happening here is that the * is getting encoded on my machine (and in this .NET Fiddle). On AppVeyor, it's not.

I've asked this question on StackOverflow but haven't gotten any luck what so ever.

I'm not sure what's going on :(

NOTE: here's the repo if you wanted to download and build on your own machine.

  1. Support Staff 1 Posted by Feodor Fitsner on 04 Nov, 2014 03:36 PM

    Feodor Fitsner's Avatar

    Could it be the same issue with repository CRLF settings as described here: http://help.appveyor.com/discussions/problems/948-tests-fail-on-app... ?

  2. 2 Posted by Pure Krome on 05 Nov, 2014 12:05 AM

    Pure Krome's Avatar

    /me just read that thread.

    I don't think it does because it's not a string comparison failure where i can't see the failure difference.

    In this case, my local (and the .NET Fiddle) are encoding an asterix. On AppV, it is NOT encoding the asterix. Sounds like a .NET issue. (.NET changed this behaviour in 4.5+).

  3. Support Staff 3 Posted by Feodor Fitsner on 05 Nov, 2014 12:20 AM

    Feodor Fitsner's Avatar

    Nice one. There is 4.5.2 installed.

  4. 4 Posted by Pure Krome on 05 Nov, 2014 11:12 PM

    Pure Krome's Avatar

    OK, so i've done a quick experiment. I'm trying to figure out what the expected result should be so we know if there is a problem or not.

    So, here's the results.

    `` Data: abcde *.(.)."

    .NET 2.0: abcde%20*.(.). .NET 3.0: abcde%20*.(.). .NET 3.5: abcde%20*.(.). .NET 4.0: abcde%20*.(.).

    -- MSDN NOTES: Bug now fixed here --

    .NET 4.5: abcde%20%2A.%28.%29. .NET 4.5.1: abcde%20%2A.%28.%29. .NET 4.5.2: abcde%20%2A.%28.%29. .NET 4.5.3: abcde%20%2A.%28.%29.

    
    So .. looking at this code .. it says that it should be encoding an asterix or parenthisis.


    AppVeyor is not.


    Which is really weird, because AV is running the test as 4.5.2 .. and under that framework, it should be encoding.


    Can you confirm/deny my current experiment?


    HINT: Use the code from this gist in a File -> New -> Console app.
  5. 5 Posted by Pure Krome on 05 Nov, 2014 11:13 PM

    Pure Krome's Avatar

    Urgh :( I can't edit my previous post :(

  6. Support Staff 6 Posted by Feodor Fitsner on 05 Nov, 2014 11:20 PM

    Feodor Fitsner's Avatar

    Interesting findings. Will take a look!

    -Feodor

  7. Support Staff 7 Posted by Feodor Fitsner on 06 Nov, 2014 07:11 PM

    Feodor Fitsner's Avatar

    OK, I can confirm that there is .NET 4.5.2 is installed. According to this article build workers have Release : 379893 in the registry.

    An easy experiment on AppVeyor environment using PowerShell (it's v3.0 that runs .NET 4.0) shows that it's encoding correctly (as per your notes): https://ci.appveyor.com/project/FeodorFitsner/appveyor-bot-test/bui... (lines 6,7)

    My question would be what was the command to run unit tests?

  8. 8 Posted by Pure Krome on 06 Nov, 2014 09:01 PM

    Pure Krome's Avatar

    the command to run unit tests? Er.. no idea :( I'm using xUnit.

    The project is OSS so here's the full AppVeyor log output and this is the branch for the code .. so you can easily clone (or fork) and then push it up to AppVeyor with your own settings to confirm stuff.

    BTW- i'm not doing anything custom - just using the defaults.

  9. Support Staff 9 Posted by Feodor Fitsner on 06 Nov, 2014 10:28 PM

    Feodor Fitsner's Avatar

    Hm, that's xunit.console.clr4.x86 - .NET 4.0. Should be fine.

    I'm wondering if you could do a very simple test repo with just a single xUnit test case verifying encoding? This would greatly isolate the issue.

  10. 10 Posted by Pure Krome on 06 Nov, 2014 10:43 PM

    Pure Krome's Avatar

    yep. i'll try and create a new repo etc.

  11. 11 Posted by Pure Krome on 07 Nov, 2014 12:18 AM

    Pure Krome's Avatar

    Ok done. Error still occurs (yay!).

    Unit test results: https://ci.appveyor.com/project/PureKrome/appveyorunittest/build/1.0.1
    Fork this repo: https://github.com/PureKrome/AppVeyorUnitTest

    go nuts and figure this out :)

    NOTES: Class library has the 1 unit test method. Project is 4.5.

  12. Support Staff 12 Posted by Feodor Fitsner on 07 Nov, 2014 12:20 AM

    Feodor Fitsner's Avatar

    Snap! :) will do, thanks for the repo.

    -Feodor

  13. Support Staff 13 Posted by Feodor Fitsner on 13 Nov, 2014 05:30 AM

    Feodor Fitsner's Avatar

    It's definitely xUnit!

    I've played around test repo: https://ci.appveyor.com/project/FeodorFitsner/appveyorunittest

    Downloaded "clean" xunit runners from NuGet - same result, called console app - works correctly.

    Also cloned the repo to my dev machine - same result abcde%20*.(.). when running xunit tests though I have .NET 4.5.2 installed.

    I don't know if it makes sense to dig further or maybe better asking on their forums.

  14. 14 Posted by Pure Krome on 13 Nov, 2014 06:14 AM

    Pure Krome's Avatar

    Oh wow - interesting :) I might see if I can grab the XUnit team into this thread then...

  15. 15 Posted by Pure Krome on 13 Nov, 2014 06:19 AM

    Pure Krome's Avatar

    What's also interesting here @Feodor is that I don't get the xunit error when I'm running it locally on my dev .. but i've only got .NET 4.5.1 installed! I've pinged @BradWilson to see if he might be able to help.

    /me prays to the coding overlords...

  16. 16 Posted by Brad Wilson on 13 Nov, 2014 05:00 PM

    Brad Wilson's Avatar

    There have been breaking changes in the URL encoding library across different versions of .NET.

    When writing unit tests that validate URL encoding, the "expected" value should be something that's been URL encoded by the system, rather than a hard-coded string.

  17. 17 Posted by Pure Krome on 13 Nov, 2014 11:05 PM

    Pure Krome's Avatar

    Hi Brad - thanks heaps for popping into this thread! (really appreciate it!)

    There have been breaking changes in the URL encoding library across different versions of .NET.

    The breaking change to the URL encoding was at version 4.5. (I think this is the link: http://msdn.microsoft.com/en-us/library/hh367887(v=vs.110).aspx ... and search for Uri.EscapeDataString).

    This thread is talking about .NET 4.5, .NET 4.5.1 and also .NET 4.5.2

    When writing unit tests that validate URL encoding, the "expected" value should be something that's been URL encoded by the system, rather than a hard-coded string.

    Um - that's what I thought we're doing in our fully-repo'd tests?

    @Feodor has a perfect repo that is highlighting that a CONSOLE APPLICATION (running under 4.5.2) works 100% perfectly (as the docs have suggested). When we use the xUnit test running, we are -not- getting the expected behaviour. This suggests that the xUnit runnner is not working as expected?

    What's weird is that the xunit runner on my dev machine (win 8.1, .NET 4.5.1 & R# .. which I used to 'grab' the running using the R# Extensions Manager) isn't doing this :/

    We don't get it :/

  18. 18 Posted by Pure Krome on 20 Nov, 2014 03:40 AM

    Pure Krome's Avatar

    @Feodor - I think we've lost Brad :(

    Yeah, it's a work around to do:

    var expected = Uri.EscapeDataString("abcde *.(.).");
    Assert.Equal(expected, result);
    

    but I feel that this is just covering up the real issue here. If anything, hiding the problem? @Feodor - do you agree with me, here?

  19. Support Staff 19 Posted by Feodor Fitsner on 20 Nov, 2014 04:15 AM

    Feodor Fitsner's Avatar

    Yes, there is some problem.

  20. 20 Posted by Pure Krome on 11 Jul, 2016 03:51 AM

    Pure Krome's Avatar

    Closing issue.

  21. Pure Krome closed this discussion on 11 Jul, 2016 03:51 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac