Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • May 22 16:15
    hartmark commented #108
  • May 22 16:13
    hartmark opened #108
  • May 17 01:34
    Hawxy commented #107
  • May 04 13:52
    nghhoese commented #70
  • May 02 17:13
    jasper-ci removed as member
  • Apr 25 13:44
    marcindruzgala opened #107
  • Mar 23 08:52
    AdaskoTheBeAsT commented #106
  • Mar 22 18:02
    AdaskoTheBeAsT opened #106
  • Feb 26 02:14
    dependabot[bot] labeled #105
  • Feb 26 02:14
    dependabot[bot] labeled #105
  • Feb 26 02:14
    dependabot[bot] opened #105
  • Feb 26 02:14

    dependabot[bot] on npm_and_yarn

    Bump prismjs from 1.25.0 to 1.2… (compare)

  • Feb 09 15:01

    jeremydmiller on gh-pages

    Documentation Update for 6.1.0 (compare)

  • Feb 06 12:41

    Hawxy on gh-pages

    Documentation Update for 6.1.0 (compare)

  • Feb 06 12:00

    github-actions[bot] on v6.1.0

    (compare)

  • Feb 06 10:29

    Hawxy on master

    Move to package license express… (compare)

  • Feb 06 10:29
    Hawxy closed #104
  • Feb 06 10:28
    Hawxy opened #104
  • Feb 06 10:17

    dependabot[bot] on npm_and_yarn

    (compare)

  • Feb 06 10:17

    Hawxy on master

    Bump nanoid from 3.1.30 to 3.2.… (compare)

JT
@Hawxy
We have a number of tests that rely on the ability to change the tenant ID or other token data mid-run.
Jeremy D. Miller
@jeremydmiller
@Hawxy Nothing today, it’s just additive. But also probably not a huge deal to change to give you better control over that. Sounds like a very helpful PR
JT
@Hawxy
Cool, I'll investigate and put something up.
JT
@Hawxy
btw I pushed up #96
JT
@Hawxy
Any chance of getting this in? Unfortunately it's a blocker for us moving to v5.
Hallstein Brøtan
@hallstein82_twitter
Any news on supporting .NET 6? Documentation on how to create a test fixture with only Program.cs would be highly appreciated.
JT
@Hawxy
There might need to be a new overload that uses WebApplicationFactory<TEntryPoint>, as the internal HostFactoryResolver is required to resolve the minimal host.
I'm not wild about messing with WebApplicationFactory, but we can try that too.
JT
@Hawxy
Can't say I'm a huge fan of needing a bespoke minimal API design to fit Alba.
I did a bit of work spiking integration with WebApplicationFactory, let me know what you think of #97.
JT
@Hawxy
In theory you could move everything that lives in AlbaHost into the factory and standardize on it across the board, although at the cost of ForStartup and consumers with unusual entry-points.
Jeremy D. Miller
@jeremydmiller
I think the ForStartup() needs to die and go away anyway. Too much other stuff potentially happens on HostBuilder. I need to think about it a touch more, but I’m inclined to agree with the approach in that PR. Now that I understand the magic of how WebApplicationFactory resolves things w/o having to duplicate all the project configuration, I think I’m good with what you did.
Oakton is going to be a totally different problem, but that’s later next week’s problem
Thank you for doing that!
JT
@Hawxy
No problem. You might've seen it already but Andrew Lock has some great articles around the HostFactoryResolver internals: https://andrewlock.net/exploring-dotnet-6-part-5-supporting-ef-core-tools-with-webapplicationbuilder/
Jeremy D. Miller
@jeremydmiller
@Hawxy I pulled your PR in today. Added a tiny bit more tests, and made some mild adjustments, but it's looking good right now.
Jeremy D. Miller
@jeremydmiller
Alba 7.0 is up with support for WebApplication & WebApplicationBuilder. Docs and a blog post will follow later this week or next.
JT
@Hawxy
Sweet!
JT
@Hawxy
I did have another branch in the works that's more aggressive and removes everything apart from the WebApplicationFactory extensions, cleaning up the AlbaHost quite a bit. The ecosystem might not be ready for that yet though :)
Jeremy D. Miller
@jeremydmiller
I was impatient to shoot that one out. Trying to clear the deck fast for the .Net 6 stuff. I don’t want to drop support for IHostBuilder at the least. No reason to strip out stuff that works in .Net 5/6
JT
@Hawxy
Got a quick one: JasperFx/alba#99
Jeremy D. Miller
@jeremydmiller
I’ll get that today. And hey, check the Marten room too. I think we’re having to partially reverse some of the async improvement PR you did awhile back. Might be interesting to watch that
pieteckhart
@pieteckhart
Hi,
I'm currently running my integration tests using Microsoft.AspNetCore.Mvc.Testing directly. This allows me to use the HttpClient directly so I can inject it in a (swagger) generated rest client.
I would like to make use of the Security Extensions that Alba provides. Is there any way to access the underlying httpclient in an Scenario?
Jeremy D. Miller
@jeremydmiller
Not right now, no. Sounds like an interesting pull request though. The extensions are only working against Alba’s in memory scenario model.
And I’d argue that using Alba would be easier than trying to do things directly through HttpClient anyway in most cases
pieteckhart
@pieteckhart
Thanks for the quick reply. Maybe in the future I can contribute. For now I have worked around it without using Alba.
Trying out Alba made me fall in love with integration testing, so thanks for that anyway :)
Jeremy D. Miller
@jeremydmiller
And there’s always the option of just stealing the code out of Alba, but adapting it to using HttpClient.
Hallstein Brøtan
@hallstein82_twitter
Thanks for adding support for ASP.Net Core 6 and WebApplicationBuilder! Is it possible to update the documentation with an example on how to share a test setup using xUnit (and TestFixtureCollection I presume) using the new functionality for WebApplicationBuilder?
Jeremy D. Miller
@jeremydmiller
@hallstein82_twitter Sounds like a good pull request
JT
@Hawxy
@hallstein82_twitter Added an example, JasperFx/alba#100
Jeremy D. Miller
@jeremydmiller
@Hawxy I'll try to cut some time tomorrow to update Alba w/ your last PR and re-publish the docs. Thanks for doing that.
JT
@Hawxy
v6.1.0 has been published, along with the relevant doc updates.
Jeremy D. Miller
@jeremydmiller
@Hawxy I tried to use Alba against a minimal API project today, and got hit with the compiler saying the implied Program class in the system under test being internal and inaccessible. Yet that works just fine in the Alba codebase itself. Do you have any idea why?
JT
@Hawxy
@jeremydmiller you gotta add:
  <ItemGroup>
    <InternalsVisibleTo Include="ProjectName.Tests" />
  </ItemGroup>
I did update the alba docs with that as I noticed it was missing
Jeremy D. Miller
@jeremydmiller
And that feels very obvious in retrospect, thank you!
dhaligas
@dhaligas
I am trying to use Host.Services.GetRequiredService in my tests but that is not resolving. Is there an extra setup or field to get those
dhaligas
@dhaligas
Looks like I was able to get it by creating a scope Host.Services.CreateScope().ServiceProvider.GetRequiredService<MyService>()
Jeremy D. Miller
@jeremydmiller
That shouldn’t be necessary, can you add more context to what went wrong?
nghhoese
@nghhoese
is it possible to do a https request instead of a http request with alba?
Jeremy D. Miller
@jeremydmiller
It’s not doing a real HTTP request. Alba is using TestServer under the covers, so there’s no Kestrel in there at all
Thomas Skovsende
@skovsende
Been searching for half an hour now and can't find anywhere that explains how to modify my autofac registrations in my tests. The problem is that builder.ConfigureServices in Alba.AlbaHost.For<Program>(...) runs before builder.Host.ConfigureContainer in Program, so all my test registrations is getting overwritten by my application registrations. If anyone can point me in the right direction it would be greatly appreciated.
Thomas Skovsende
@skovsende
I have tried using builder.ConfigureTestContainer, but it doesn't seem to get called
Thomas Skovsende
@skovsende
Ha! I think I got it. Apparently a bug was introduced in .net 3 that made ConfigureTestContainer not be called any more: dotnet/aspnetcore#14907 But the good guys at autofac came up with a way to work around that bug here: https://github.com/autofac/Autofac/issues/1207#issuecomment-701961371 - and with that and reading a little alba code, I came up with an IAlbaHostExtension that seems to work! https://gist.github.com/skovsende/bc4f3b3ccd6ea40e733020d63a58f121
I'll see if I can find some time over the weekend to do a short blog post about the solution.