Build codegen tests against the local Pulumi SDK - #1032
Draft
i-am-tom wants to merge 3 commits into
Draft
Conversation
The codegen test in `pulumi-language-dotnet/codegen/gen_program_test.go` used to pin a published NuGet version of `Pulumi` via a `PulumiDotnetSDKVersion` constant. That required a manual bump on every release (e.g. #1030), and meant generated programs were never validated against the SDK source actually being modified in the PR. Replace the `dotnet add package Pulumi --version X` step with `dotnet add reference <repo>/sdk/Pulumi/Pulumi.csproj`, so the test always compiles against the in-tree SDK. The constant is gone for good. Also disable NuGet audit on the test build (`-p:NuGetAudit=false`): this test exercises codegen compilation, not the dependency graph's CVE posture, which is covered by other CI jobs. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the pinned NuGet
PulumiPackageReferencein the codegen tests with aProjectReferenceto this repo'ssdk/Pulumi/Pulumi.csproj. ThePulumiDotnetSDKVersionconstant is removed.Why
The constant required a manual bump on every release (e.g. #1030), and — more importantly — meant
TestGenerateProgramwas validating generated code against a previously published SDK rather than the source tree being modified in the PR. With a project reference, the test always exercises the current SDK.Changes
gen_program_test.go: replacedep{"Pulumi", PulumiDotnetSDKVersion}.install(...)withdotnet add reference <abs-path>/sdk/Pulumi/Pulumi.csproj.if/else(both branches did the same thing).-p:NuGetAudit=falseto the test'sdotnet build. The test verifies codegen compiles; dependency-graph CVEs are the job of dedicated audit/build jobs in CI. Without this, transitive vulnerabilities surfaced by NuGet audit (e.g. the currentOpenTelemetry.Exporter.OpenTelemetryProtocol 1.9.0GHSA-4625-4j76-fww9) would fail the codegen test for unrelated reasons.Test plan
make format_language_host_check && make lint_language_hostTestGenerateProgram/{assets-archives,aws-eks,kubernetes-pod,simple-resource-schema,throw-not-implemented}— all pass against the local SDKmake test_codegenin CI🤖 Generated with Claude Code