Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release/8.0] [tests] EndToEnd - add test scenarios (#3113) #3377

Merged
merged 2 commits into from
Apr 4, 2024

Conversation

joperezr
Copy link
Member

@joperezr joperezr commented Apr 3, 2024

Backport of #3113 into release/8.0

Original Description:

Test scenarios allow defining different groupings for tests to be run. This is useful for CI to run the tests in separate helix items.

        TestResourceNames resourcesToInclude = TestScenario switch
        {
            "oracle" => TestResourceNames.oracledatabase,
            "cosmos" => TestResourceNames.cosmos,
            "scenario0" => TestResourceNames.kafka
                              | TestResourceNames.mongodb
                              | TestResourceNames.rabbitmq
                              | TestResourceNames.redis
                              | TestResourceNames.postgres
                              | TestResourceNames.efnpgsql
                              | TestResourceNames.mysql
                              | TestResourceNames.efmysql
                              | TestResourceNames.sqlserver,
            "" or null => TestResourceNames.All,
            _ => throw new ArgumentException($"Unknown test scenario '{TestScenario}'")
        };

Once eforacle is added it can run with the oracle scenario.

The default is to run all the tests.

Also:

  • Enable cosmos E2E tests on helix
  • make TestResourceNames into a [Flag] enum so multiple can be expressed at the same time.
  • And support dumping docker container logs for resources where the resource name does not match the container name prefix. For example efnpgsql vs postgres.
Microsoft Reviewers: Open in CodeFlow

Test scenarios allow defining different groupings for tests to be run. This is useful for CI to run the tests in separate helix items.

```csharp
        TestResourceNames resourcesToInclude = TestScenario switch
        {
            "oracle" => TestResourceNames.oracledatabase,
            "cosmos" => TestResourceNames.cosmos,
            "scenario0" => TestResourceNames.kafka
                              | TestResourceNames.mongodb
                              | TestResourceNames.rabbitmq
                              | TestResourceNames.redis
                              | TestResourceNames.postgres
                              | TestResourceNames.efnpgsql
                              | TestResourceNames.mysql
                              | TestResourceNames.efmysql
                              | TestResourceNames.sqlserver,
            "" or null => TestResourceNames.All,
            _ => throw new ArgumentException($"Unknown test scenario '{TestScenario}'")
        };
```

Once `eforacle` is added it can run with the `oracle` scenario.

The default is to run all the tests.

Also:
- Enable `cosmos` E2E tests on helix
- make `TestResourceNames` into a `[Flag]` enum so multiple can be expressed at the same time.
- And support dumping docker container logs for resources where the resource name does not match the container name prefix. For example `efnpgsql` vs `postgres`.
@dotnet-issue-labeler dotnet-issue-labeler bot added the area-integrations Issues pertaining to Aspire Integrations packages label Apr 3, 2024
@radical
Copy link
Member

radical commented Apr 4, 2024

Test failure is unrelated - #3380 .

@radical
Copy link
Member

radical commented Apr 4, 2024

Test failure is unrelated - #3380 .

Don't merge on RED though as this was a non-helix test failure, thus the helix tests never ran.

Copy link
Member

@eerhardt eerhardt left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines +278 to +280
public async Task DumpComponentLogsAsync(TestResourceNames resource, ITestOutputHelper? testOutputArg = null)
{
string component = resource switch
Copy link
Member

Choose a reason for hiding this comment

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

(not for this PR, but we can fix it in main) -

This is kind of weird now that TestResourceNames is a flags enum. If you pass in a value with multiple resources set, it will throw with "unknown resource: {resource}". Maybe the error message could be better saying only single resource names are supported?

@radical
Copy link
Member

radical commented Apr 4, 2024

@joperezr could you please merge this? I don't have permissions for it.

@eerhardt eerhardt merged commit 048fe95 into dotnet:release/8.0 Apr 4, 2024
8 checks passed
@danmoseley danmoseley mentioned this pull request Apr 12, 2024
@github-actions github-actions bot locked and limited conversation to collaborators May 8, 2024
@joperezr joperezr deleted the Backport3113 branch May 16, 2024 20:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-integrations Issues pertaining to Aspire Integrations packages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants