Skip to content

Conversation

@dealloc
Copy link

@dealloc dealloc commented Jan 15, 2026

**Closes #1015 **

This PR is a continuation of the previous PR for Zitadel support: #1021

PR Checklist

  • Created a feature/dev branch in your fork (vs. submitting directly from a commit on main)
  • Based off latest main branch of toolkit
  • PR doesn't include merge commits (always rebase on top of our main, if needed)
  • New integration
    • Docs are written
    • Added description of major feature to project description for NuGet package (4000 total character limit, so don't push entire description over that)
  • Tests for the changes have been added (for bug fixes / features) (if applicable)
  • Contains NO breaking changes
  • Every new API (including internal ones) has full XML docs
  • Code follows all style conventions

Other information

@aaronpowell
Copy link
Member

I'm seeing failures in the test log starting here: https://github.com/CommunityToolkit/Aspire/actions/runs/21052154522/job/60540747581?pr=1100#step:6:497

The tests themselves don't seem to report failing, so possibly the Assert isn't capturing the stack properly.

Do the test pass locally?

@dealloc
Copy link
Author

dealloc commented Jan 16, 2026

@aaronpowell the problem seems to happen when GetEnvironmentVariablesAsync is called and the tests just 'hang'

@github-actions github-actions bot added the Stale label Jan 22, 2026
@github-actions github-actions bot closed this Jan 25, 2026
@dealloc
Copy link
Author

dealloc commented Jan 25, 2026

I don't mind continuing to work on this, I just need input on why GetEnvironmentVariablesAsync causes the tests to hang.
From what I can tell it's whenever a Postgres integration is also in play

@aaronpowell aaronpowell reopened this Feb 2, 2026
@aaronpowell aaronpowell removed the Stale label Feb 2, 2026
@dealloc
Copy link
Author

dealloc commented Feb 3, 2026

@aaronpowell any input on the GetEnvironmentVariablesAsync?

@aaronpowell
Copy link
Member

@dealloc sorry, been under the pump with some other stuff recently. I've just pushed a commit which fixes the timeout issue. I think some of the asserts are now failing though

@dealloc
Copy link
Author

dealloc commented Feb 6, 2026

no worries, just wanted to make sure this PR didn't slip under the radar :)
One of the failing asserts is Assert.Equal("false", env["ZITADEL_TLS_ENABLED"]);

it seems that WithHttpsCertificateConfiguration didn't run yet as I set those vars in the callback.

    [Fact]
    public async Task AddZitadel_Sets_Default_Environment_Variables()
    {
        var builder = DistributedApplication.CreateBuilder();

        var zitadel = builder.AddZitadel("zitadel");

        var env = await zitadel.Resource.GetEnvironmentVariablesAsync();

        Assert.Equal("false", env["ZITADEL_TLS_ENABLED"]);
        Assert.Equal("false", env["ZITADEL_EXTERNALSECURE"]);
        Assert.Equal("zitadel.dev.localhost", env["ZITADEL_EXTERNALDOMAIN"]);
        Assert.Equal("false", env["ZITADEL_DEFAULTINSTANCE_FEATURES_LOGINV2_REQUIRED"]);
        Assert.Equal("false", env["ZITADEL_FIRSTINSTANCE_ORG_HUMAN_PASSWORDCHANGEREQUIRED"]);
    }

I suspect I need to do something so Aspire actually calls the callback for it?

@aaronpowell
Copy link
Member

To test that, I think you'll need to actually start the app host. Looking into the Aspire source I found this test https://github.com/dotnet/aspire/blob/a6b68c75e6a789e938c9e6630073e27231fb06f9/tests/Aspire.Hosting.Tests/DistributedApplicationTests.cs#L768-L809

https://github.com/dotnet/aspire/blob/a6b68c75e6a789e938c9e6630073e27231fb06f9/tests/Aspire.Hosting.Tests/DistributedApplicationTests.cs#L797 is a test against something setup in the callback to WithHttpsCertificateConfiguration, so you'll need to do something along these lines to create the app from the builder and start it, then resolve the resource: https://github.com/dotnet/aspire/blob/a6b68c75e6a789e938c9e6630073e27231fb06f9/tests/Aspire.Hosting.Tests/DistributedApplicationTests.cs#L784-L788

We've got a bunch of tests that do that already in the toolkit codebase you can use as reference.

@dealloc
Copy link
Author

dealloc commented Feb 9, 2026

turns out the specific assertion I was making was incorrect, it's never set to false only to true if the callback would run (since false is a default value anyway)

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

Successfully merging this pull request may close these issues.

Hosting integration for Zitadel

2 participants