Skip to content

GitHubRequestOutcomeTests fail with NullReferenceException on main: #288's tests build an Owner with no BuildProvider after #285 #300

Description

@matt-edmondson

What's wrong

4 tests in BuildMonitor.Test/GitHubRequestOutcomeTests.cs fail on main with NullReferenceException on every platform:

  • the OwnerWithToken helper at line 130, and the tests that use it
  • AWorkflowActionWithoutCredentialsReportsFailureWithoutCalling at line 192

Cause

These tests construct new Owner { ... } without a BuildProvider. Since #285 moved tokens into the secret store, Owner.TokenPersona dereferences BuildProvider.Name, so reading or writing the owner's token throws. #288 (which added these tests) was written before #285, and the two were merged in an order that broke them (80806f3 then b672d07).

Why it matters

The request-outcome reporting that #288 added is currently untested, and a red test suite on main hides new regressions.

Suggested fix / acceptance criteria

  • Build owners with provider.CreateOwner(...) so BuildProvider is set.
  • Inject an in-memory store via TokenStorage.UseCache so the tests don't touch the OS secret store.
  • dotnet test passes for GitHubRequestOutcomeTests on Windows and Linux.

Activity

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

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions