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

Failures in Google.Apis.Tests.Apis.Requests.RequestBuilderTest #636

Closed
mmdriley opened this issue Dec 1, 2015 · 4 comments
Closed

Failures in Google.Apis.Tests.Apis.Requests.RequestBuilderTest #636

mmdriley opened this issue Dec 1, 2015 · 4 comments
Assignees

Comments

@mmdriley
Copy link
Contributor

mmdriley commented Dec 1, 2015

NUnit Console Runner 3.0.5797 
Copyright (C) 2015 Charlie Poole

Runtime Environment
   OS Version: Microsoft Windows NT 10.0.10586.0
  CLR Version: 4.0.30319.42000

Test Files
    documents\GitHub\google-api-dotnet-client\src\GoogleApis.Tests\bin\ReleaseSigned\Google.Apis.Tests.dll

Agent process 7312 starting
Running under version 4.0.30319.42000, Net 4.5
Agent process 7312 exiting

Errors and Failures

1) Failed : Google.Apis.Tests.Apis.Requests.RequestBuilderTest
One or more child tests had errors

2) Failed : Google.Apis.Tests.Apis.Requests.RequestBuilderTest.TestPathParameters_Level1
  Expected string length 39 but was 37. Strings differ at index 36.
  Expected: "http://www.example.com/Hello%20World%21"
  But was:  "http://www.example.com/Hello%20World!"
  -----------------------------------------------^
   at NUnit.Framework.Assert.That(Object actual, IResolveConstraint expression, String message, Object[] args)
   at Google.Apis.Tests.Apis.Requests.RequestBuilderTest.SubtestPathParameters(IDictionary`2 dic, String path, String expected) in c:\Users\mdril\Documents\GitHub\google-api-dotnet-client\Src\GoogleApis.Tests\Apis\Requests\RequestBuilderTest.cs:line 354

3) Failed : Google.Apis.Tests.Apis.Requests.RequestBuilderTest.TestPathParameters_Level3
  Expected string length 48 but was 46. Strings differ at index 41.
  Expected: "http://www.example.com/1024,Hello%20World%21,768"
  But was:  "http://www.example.com/1024,Hello%20World!,768"
  ----------------------------------------------------^
   at NUnit.Framework.Assert.That(Object actual, IResolveConstraint expression, String message, Object[] args)
   at Google.Apis.Tests.Apis.Requests.RequestBuilderTest.SubtestPathParameters(IDictionary`2 dic, String path, String expected) in c:\Users\mdril\Documents\GitHub\google-api-dotnet-client\Src\GoogleApis.Tests\Apis\Requests\RequestBuilderTest.cs:line 354
   at Google.Apis.Tests.Apis.Requests.RequestBuilderTest.TestPathParameters_Level3() in c:\Users\mdril\Documents\GitHub\google-api-dotnet-client\Src\GoogleApis.Tests\Apis\Requests\RequestBuilderTest.cs:line 279

4) Failed : Google.Apis.Tests.Apis.Requests.RequestBuilderTest.TestPathParameters_Level4
  Expected string length 44 but was 42. Strings differ at index 38.
  Expected: "http://www.example.com/red/green/blue/%2Ffoo"
  But was:  "http://www.example.com/red/green/blue//foo"
  -------------------------------------------------^
   at NUnit.Framework.Assert.That(Object actual, IResolveConstraint expression, String message, Object[] args)
   at Google.Apis.Tests.Apis.Requests.RequestBuilderTest.SubtestPathParameters(IDictionary`2 dic, String path, String expected) in c:\Users\mdril\Documents\GitHub\google-api-dotnet-client\Src\GoogleApis.Tests\Apis\Requests\RequestBuilderTest.cs:line 354
   at Google.Apis.Tests.Apis.Requests.RequestBuilderTest.TestPathParameters_Level4() in c:\Users\mdril\Documents\GitHub\google-api-dotnet-client\Src\GoogleApis.Tests\Apis\Requests\RequestBuilderTest.cs:line 322

Test Run Summary
    Overall result: Failed
   Tests run: 148, Passed: 145, Errors: 0, Failures: 3, Inconclusive: 0
     Not run: 0, Invalid: 0, Ignored: 0, Explicit: 0, Skipped: 0
  Start time: 2015-12-01 21:48:28Z
    End time: 2015-12-01 21:48:30Z
    Duration: 1.606 seconds

Results (nunit3) saved as TestResult.xml
@mmdriley
Copy link
Contributor Author

mmdriley commented Dec 1, 2015

The test failures are caused by two specific differences in the behavior of System.Uri depending on the target framework version. E.g.:

using System;
using System.Runtime.Versioning;

#if TARGET45
[assembly: TargetFramework(".NETFramework,Version=v4.5.2")]
#else
[assembly: TargetFramework(".NETFramework,Version=v4.0")]
#endif

class Program
{
    static void Main(string[] args)
    {
        Console.WriteLine(Uri.EscapeDataString("!"));
        Console.WriteLine(new Uri("http://www.example.com/path%2fto%2ffile/").AbsoluteUri);

        // 4.0
        //   !
        //   http://www.example.com/path/to/file/
        // 4.5.2
        //   %21
        //   http://www.example.com/path%2fto%2ffile/
    }
}

We didn't notice the failures before because NUnit only started setting the target framework based on the test assembly relatively recently.

Here's a StackOverflow question describing the "%2F" behavior and suggested solutions.

We used to use the reflection hack but we removed it a while ago. We may want to add it back.

Customers will hit this if they try to use APIs with slashes in path parameters, e.g. object requests in Google Cloud Storage. Customers can work around the issue by updating app.config, though this won't work for library or hosting scenarios.

@mmdriley
Copy link
Contributor Author

mmdriley commented Feb 1, 2021

@JustinBeckwith going to assume this was just a stray click?

@amanda-tarafa
Copy link
Contributor

This was probably a bot going through old closed issues. I'll ask automation maintainers but not to worry if it happens again.

@JustinBeckwith
Copy link

Apologies, robot run amok 🤖

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants