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

Add unit tests to aws-csharp #867

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

justinvp
Copy link
Member

@justinvp justinvp commented Dec 17, 2024

This change updates the aws-csharp template to include unit tests, similar to #863 for aws-typescript, #864 for aws-python, and #866 for aws-go.

Part of #865

@justinvp justinvp force-pushed the justin/tests-aws-csharp branch from 0944dcf to 79fcf80 Compare December 17, 2024 23:00
@@ -4,6 +4,7 @@
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<DefaultItemExcludes>$(DefaultItemExcludes);tests/**/*.cs;sdks/**/*.cs</DefaultItemExcludes>
Copy link
Member Author

Choose a reason for hiding this comment

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

The more idiomatic thing to do would be to have the program and test projects SxS:

proj/
├── Pulumi.yaml
├── Program.cs
└── proj.csproj
tests/
├── InfraTests.cs
└── Tests.csproj

But we can't easily do that from a template. If we structured the template like this, you wouldn't be able to run pulumi up after pulumi new because the program would live in a subdirectory. You'd have to cd into the program's subdirectory first.

I think we want to keep it such that you can run pulumi up immediately after pulumi new, without having to change directories. So we nest the test project:

proj/
├── Pulumi.yaml
├── Program.cs
├── proj.csproj
└── tests/
    ├── InfraTests.cs
    └── Tests.csproj

To do so, we have to exclude the source files in the nested project here.

We have a similar issue with parameterized providers, where pulumi package add generates the sdks in a sdks subdirectory, and we ask users to add <DefaultItemExcludes> for that. For that reason, I've included excludes for both sdks/ and tests/ by default.

@justinvp justinvp marked this pull request as ready for review December 17, 2024 23:16
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.

1 participant