Skip to content

feat(testing): support envconfig in integration test harness#794

Open
THardy98 wants to merge 4 commits into
mainfrom
feat/integration-tests-on-cloud
Open

feat(testing): support envconfig in integration test harness#794
THardy98 wants to merge 4 commits into
mainfrom
feat/integration-tests-on-cloud

Conversation

@THardy98

Copy link
Copy Markdown
Contributor

What was changed

Add opt-in envconfig support to .NET integration-test harness.

Why?

This enables integration tests to target arbitrary Temporal server environments, including local, staging, release, and Temporal Cloud environments.

Checklist

  1. Part of Run integration tests against cloud features#851

  2. How was this tested:

  • An integration test runs a Workflow against an envconfig-selected server using the standard shared test harness and a non-default namespace.
  1. Any docs updates needed?
    No

@THardy98
THardy98 force-pushed the feat/integration-tests-on-cloud branch from a97c498 to b6e3671 Compare July 20, 2026 18:28
@THardy98
THardy98 force-pushed the feat/integration-tests-on-cloud branch from b6e3671 to 6d7f9b9 Compare July 20, 2026 19:17
@THardy98
THardy98 marked this pull request as ready for review July 20, 2026 19:51
@THardy98
THardy98 requested a review from a team as a code owner July 20, 2026 19:51
{
// If an existing target is given via environment variable, use that
if (Environment.GetEnvironmentVariable("TEMPORAL_TEST_CLIENT_TARGET_HOST") is string host)
if (string.Equals(

@jmaeagle99 jmaeagle99 Jul 20, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks a little strange to have to (1) set envConfigOptions in the ctor, (2) set an environment variable, and then (3) call InitializeAsync, which then decides whether the envConfigOptions is used based on the environment variable.

How about we have the default constructor pass an empty ProfileLoadOptions if the environment variable is set and simplify the check in InitializeAsync?

public WorkflowEnvironment()
    : this(UseEnvConfigFromEnvironment() ? new ClientEnvConfig.ProfileLoadOptions() : null)
{
}

internal WorkflowEnvironment(ClientEnvConfig.ProfileLoadOptions? envConfigOptions)
{
    this.envConfigOptions = envConfigOptions;
    this.kitchenSinkWorker = new(StartKitchenSinkWorker);
}

public async Task InitializeAsync()
{
    if (null != envConfigOptions)
    {
        var options = ClientEnvConfig.LoadClientConnectOptions(envConfigOptions);
        env = new(await TemporalClient.ConnectAsync(options));
    }
    else if (Environment.GetEnvironmentVariable("TEMPORAL_TEST_CLIENT_TARGET_HOST") is string host)
    ...
}

private static bool UseEnvConfigFromEnvironment() => string.Equals(
    Environment.GetEnvironmentVariable("TEMPORAL_TEST_ENV_CONFIG_SERVER"),
    "true", StringComparison.OrdinalIgnoreCase);

@jmaeagle99 jmaeagle99 self-assigned this Jul 21, 2026
/// <remarks>
/// This connects to an existing Temporal environment and does not manage server lifecycle.
/// </remarks>
public static async Task<WorkflowEnvironment> CreateFromEnvConfigAsync(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be in the public API? It seems all of these are easily accessible by public consumers that they could do it themselves, if necessary.

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.

2 participants