JasperFx / alba

Easy integration testing for ASP.NET Core applications
https://jasperfx.github.io/alba
Apache License 2.0
386 stars 37 forks source link

Error Log Message when running within Docker context #149

Open SlaterCodes opened 11 months ago

SlaterCodes commented 11 months ago

I am running integration tests within a docker compose file (windows OS running linux containers) - integration tests are hitting API endpoints and connecting to a postgres instance running within the context for a fully contained integration test run.

The tests are running, and passing or failing as I would expect them to. I do find this warning happening within the logs a bit worrying and hoping they don't cause issues down the line as the test suite grows more complex. So not a blocking issue but wondering if my config complexity grows it may eventually emerge as an issue.

Section of docker compose:

  integrationtest:
    profiles:
      - test
    image: mcr.microsoft.com/dotnet/sdk:7.0
    depends_on:
      - postgresql
    environment:
      - ASPNETCORE_ENVIRONMENT=Docker
    volumes:
      - .:/src
    command: [ "dotnet", "test", "/src" ]
services-integrationtest-1  | [red]Invalid usage[/][yellow]Unknown argument or flag for value --ENVIRONMENT=Docker[/]
services-integrationtest-1  | run - Start and run this .Net application
services-integrationtest-1  | └── Start and run this .Net application
services-integrationtest-1  |     └── dotnet run -- run
services-integrationtest-1  |         ├── [-c, --check]
services-integrationtest-1  |         ├── [-e, --environment <environment>]
services-integrationtest-1  |         ├── [-v, --verbose]
services-integrationtest-1  |         ├── [-l, --log-level
services-integrationtest-1  |         │   Trace|Debug|Information|Warning|Error|Critical|None]
services-integrationtest-1  |         └── [--config:<prop> <value>]

I am creating the host like below:

public async Task InitializeAsync()
        {
            // Start the web host immediately
            OaktonEnvironment.AutoStartHost = true;

            // Get a Host of the Integration App under test
            Host = await AlbaHost.For<T>();
}
in this case is the Program.cs file of whichever service I am testing ( I have 3-4 microservices using this shared helper ). Dotnet7. The error message is repeated for every scenario I make an API request with the AlbaHost such as `opts.Get.Url($"/api/v1/myApi")` in a scenario.
jeremydmiller commented 10 months ago

That is annoying, and I get that occasionally too. It's from the WebApplicationFactory passing in arguments that don't fit Oakton's signature here and there