Skip to content

Run local unit tests failed with Unauthorized response #1003

Closed

Description

@akunzai

Issue Summary

Run local unit tests failed with Unauthorized response since #996

Steps to Reproduce

Before #996, we need to install prism v0.6 version and add to $PATH environment

Invoke-WebRequest -Uri "https://github.com/stoplightio/prism/releases/download/v0.6.21/prism_windows_amd64.exe" -OutFile "prism.exe"
$env:PATH = "$env:PATH;$(Get-Location)"

Clone this repo and run tests with .NET Core SDK 2.1

git clone https://github.com/sendgrid/sendgrid-csharp.git
cd sendgrid-csharp
dotnet test ./tests/SendGrid.Tests/SendGrid.Tests.csproj -c Release -f netcoreapp2.1

Exception/Log

Microsoft (R) Build Engine version 16.5.0+d4cbfca49 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 52.5 ms for D:\ReferenceSource\sendgrid-csharp\src\SendGrid\SendGrid.csproj.
  Restore completed in 52.51 ms for D:\ReferenceSource\sendgrid-csharp\tests\SendGrid.Tests\SendGrid.Tests.csproj.
Test run for D:\ReferenceSource\sendgrid-csharp\tests\SendGrid.Tests\bin\Release\netcoreapp2.1\SendGrid.Tests.dll(.NETCoreApp,Version=v2.1)
Microsoft (R) Test Execution Command Line Tool Version 16.5.0
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...

A total of 1 test files matched the specified pattern.
[xUnit.net 00:00:02.78]     SendGrid.Tests.Integration.TestSuppressionSpamReportEmailGet [FAIL]
  X SendGrid.Tests.Integration.TestSuppressionSpamReportEmailGet [1s 232ms]
  Error Message:
   Assert.Equal() Failure
Expected: OK
Actual:   Unauthorized
  Stack Trace:
     at SendGrid.Tests.Integration.TestSuppressionSpamReportEmailGet() in D:\ReferenceSource\sendgrid-csharp\tests\SendGrid.Tests\Integration.cs:line 4805
--- End of stack trace from previous location where exception was thrown ---
[xUnit.net 00:00:03.70]     SendGrid.Tests.Integration.TestMailSettingsForwardBounceGet [FAIL]
  X SendGrid.Tests.Integration.TestMailSettingsForwardBounceGet [927ms]
  Error Message:
   Assert.Equal() Failure
Expected: OK
Actual:   Unauthorized
  Stack Trace:
     at SendGrid.Tests.Integration.TestMailSettingsForwardBounceGet() in D:\ReferenceSource\sendgrid-csharp\tests\SendGrid.Tests\Integration.cs:line 4200
--- End of stack trace from previous location where exception was thrown ---
[xUnit.net 00:00:04.72]     SendGrid.Tests.Integration.TestTemplatesTemplateIdVersionsVersionIdActivatePost [FAIL]
[xUnit.net 00:00:05.59]     SendGrid.Tests.Integration.TestAlertsPost [FAIL]
  X SendGrid.Tests.Integration.TestTemplatesTemplateIdVersionsVersionIdActivatePost [1s 22ms]
  Error Message:
   Assert.Equal() Failure
Expected: OK
Actual:   Unauthorized
  Stack Trace:
     at SendGrid.Tests.Integration.TestTemplatesTemplateIdVersionsVersionIdActivatePost() in D:\ReferenceSource\sendgrid-csharp\tests\SendGrid.Tests\Integration.cs:line 4980
--- End of stack trace from previous location where exception was thrown ---
  X SendGrid.Tests.Integration.TestAlertsPost [865ms]
  Error Message:
   Assert.Equal() Failure
Expected: Created
Actual:   Unauthorized
  Stack Trace:
     at SendGrid.Tests.Integration.TestAlertsPost() in D:\ReferenceSource\sendgrid-csharp\tests\SendGrid.Tests\Integration.cs:line 2800
--- End of stack trace from previous location where exception was thrown ---
[xUnit.net 00:00:06.57]     SendGrid.Tests.Integration.TestApiKeysApiKeyIdPatch [FAIL]
[xUnit.net 00:00:07.49]     SendGrid.Tests.Integration.TestWhitelabelIpsIdValidatePost [FAIL]
  X SendGrid.Tests.Integration.TestApiKeysApiKeyIdPatch [972ms]
  Error Message:
   Assert.Equal() Failure
Expected: OK
Actual:   Unauthorized
...
--- End of stack trace from previous location where exception was thrown ---
  X SendGrid.Tests.Integration.TestTrackingSettingsGet [599ms]
  Error Message:
   Assert.Equal() Failure
Expected: OK
Actual:   Unauthorized
  Stack Trace:
     at SendGrid.Tests.Integration.TestTrackingSettingsGet() in D:\ReferenceSource\sendgrid-csharp\tests\SendGrid.Tests\Integration.cs:line 4992
--- End of stack trace from previous location where exception was thrown ---
[xUnit.net 00:03:22.11]     SendGrid.Tests.Integration.TestTrackingSettingsGoogleAnalyticsGet [FAIL]
  X SendGrid.Tests.Integration.TestTrackingSettingsGoogleAnalyticsGet [671ms]
  Error Message:
   Assert.Equal() Failure
Expected: OK
Actual:   Unauthorized
  Stack Trace:
     at SendGrid.Tests.Integration.TestTrackingSettingsGoogleAnalyticsGet() in D:\ReferenceSource\sendgrid-csharp\tests\SendGrid.Tests\Integration.cs:line 5039
--- End of stack trace from previous location where exception was thrown ---

Test Run Failed.
Total tests: 370
     Passed: 139
     Failed: 231
 Total time: 3.3988 Minutes

Technical details:

  • sendgrid-csharp version: 9.15.0
  • csharp version:
❯ dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   3.1.202
 Commit:    6ea70c8dca

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.18363
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\3.1.202\

Host (useful for support):
  Version: 3.1.4
  Commit:  0c2e69caa6

.NET Core SDKs installed:
  2.1.806 [C:\Program Files\dotnet\sdk]
  3.1.201 [C:\Program Files\dotnet\sdk]
  3.1.202 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

Activity

  1. childish-sambino commented on May 18, 2020

    @childish-sambino
    Contributor

    #996 was a refactor to drop the prism requirement which was duplicated and inconsistent across languages. There is no longer a requirement to install prism and make it part of the path. Instead, it has been centralized to a single repo and there's a single make target in this repo which does the prism testing using Docker: make test-docker

  2. akunzai commented on May 19, 2020

    @akunzai
    ContributorAuthor

    Hi @childish-sambino,

    Thanks for explain, I known we can run tests successfully in Travis CI.
    But I really means is the contributors can't run tests easily in Local computer any more.

    maybe we can explain this on the CONTRIBUTING.md

  3. childish-sambino commented on May 22, 2020

    @childish-sambino
    Contributor

    Most of the integration/regression tests are unnecessary for local development, but it's still pretty easy to run them all. Install docker, make, and run make test-docker. If there's agreement, I'll look into add it to the contributing guide.

  4. akunzai commented on May 23, 2020

    @akunzai
    ContributorAuthor

    Agree

  5. childish-sambino commented on May 28, 2020

    @childish-sambino
    Contributor

    Updated: 4b45af0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: questionquestion directed at the library

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions