Skip to content

Commit 948484d

Browse files
committed
fix: updating per peer review
1 parent 40de799 commit 948484d

30 files changed

+120
-2032
lines changed

CLAUDE.md

Lines changed: 0 additions & 75 deletions
This file was deleted.
Lines changed: 5 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# CLAUDE.md
1+
# Contributing to pulumitest
22

3-
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
3+
This guide provides detailed information about the pulumitest library's architecture, testing patterns, and development practices.
44

55
## Build Commands
66
- Run all tests in pulumitest module: `go test -v ./...`
@@ -80,73 +80,8 @@ The library supports multiple ways to configure providers for testing:
8080
- Sets `plugins.providers` in Pulumi.yaml for providers that don't support attachment
8181
- Provider is started by Pulumi engine, not attached
8282

83-
### Testing Patterns
84-
85-
**Default Behavior**
86-
- Programs copied to temp directory (OS-specific or `PULUMITEST_TEMP_DIR`)
87-
- Dependencies installed automatically unless `SkipInstall()` used
88-
- Stack named "test" created automatically unless `SkipStackCreate()` used
89-
- Local backend in temp directory unless `UseAmbientBackend()` used
90-
- Stacks automatically destroyed on test completion
91-
- Temp directories retained on failure for debugging (configurable via env vars)
92-
93-
**gRPC Logging** (`grpcLog.go`, `grpcLog_test.go`)
94-
- Enabled by default, written to `grpc.json` in working directory
95-
- Disable with `opttest.DisableGrpcLog()`
96-
- Access via `test.GrpcLog(t)` which returns parsed log entries
97-
- Supports sanitization of secrets before writing to disk
98-
99-
**Multi-Step Tests**
100-
- Use `UpdateSource(t, path)` to replace program files between operations
101-
- Useful for testing update behavior, replacements, etc.
102-
- Example pattern: `Up()``UpdateSource()``Up()` → assert changes
103-
104-
**SDK Configuration**
105-
- Node.js: Use `YarnLink("@pulumi/package")` after running `yarn link` in SDK directory
106-
- Go: Use `GoModReplacement("module", "path", "to", "replacement")` to add go.mod replacements
107-
- .NET/C#:
108-
- Use `DotNetReference("package", "path", "to", "project")` to add project references to .csproj files
109-
- Path can point to a .csproj file or a directory containing one
110-
- Absolute paths are resolved automatically
111-
- ProjectReference elements are added to the .csproj file on stack creation
112-
- Use `DotNetBuildConfiguration("Release")` to set build configuration (Debug/Release)
113-
- Sets `DOTNET_BUILD_CONFIGURATION` environment variable
114-
- Default is Debug if not specified
115-
- Use `DotNetTargetFramework("net8.0")` to override target framework
116-
- Modifies `<TargetFramework>` element in .csproj
117-
- Useful for testing across different .NET versions
118-
119-
**Examples**
120-
```go
121-
// Basic .NET test
122-
test := NewPulumiTest(t, "path/to/csharp/project")
123-
up := test.Up(t)
124-
125-
// Test with local SDK reference
126-
test := NewPulumiTest(t,
127-
"path/to/csharp/project",
128-
opttest.DotNetReference("Pulumi.Aws", "../pulumi-aws/sdk/dotnet"),
129-
)
130-
131-
// Test with specific framework and configuration
132-
test := NewPulumiTest(t,
133-
"path/to/csharp/project",
134-
opttest.DotNetTargetFramework("net7.0"),
135-
opttest.DotNetBuildConfiguration("Release"),
136-
)
137-
```
138-
139-
### Environment Variables
140-
141-
| Variable | Purpose |
142-
|----------|---------|
143-
| `CI` | Adjusts defaults for CI environment (affects file retention) |
144-
| `PULUMITEST_RETAIN_FILES` | Set to `true` to always retain temp directories |
145-
| `PULUMITEST_RETAIN_FILES_ON_FAILURE` | Retain temp files on test failure (default: `true` locally, `false` in CI) |
146-
| `PULUMITEST_SKIP_DESTROY_ON_FAILURE` | Skip automatic destroy on test failure (default: `false`) |
147-
| `PULUMITEST_TEMP_DIR` | Custom temp directory instead of OS default |
148-
| `PULUMI_CONFIG_PASSPHRASE` | Override default passphrase (defaults to "correct horse battery staple") |
149-
| `PULUMI_BACKEND_URL` | Override default local backend |
83+
84+
15085

15186
### Subdirectories
15287

@@ -200,13 +135,9 @@ test := NewPulumiTest(t,
200135

201136
**Target Framework Not Found**
202137
- Error: `Framework 'Microsoft.NETCore.App', version 'X.X.X' not found`
203-
- Solution: Install the required .NET SDK version or use `DotNetTargetFramework()` to specify an installed version
138+
- Solution: Install the required .NET SDK version
204139
- Check installed versions: `dotnet --list-sdks`
205140

206-
**Build Configuration Issues**
207-
- If builds are slow or producing unexpected results, explicitly set: `DotNetBuildConfiguration("Release")`
208-
- Debug builds include more information but are larger and slower
209-
210141
**Project Reference Resolution**
211142
- Ensure referenced projects use compatible target frameworks
212143
- Use absolute paths or paths relative to the test working directory

DOTNET-TODO.md

Lines changed: 0 additions & 193 deletions
This file was deleted.

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ Library for testing Pulumi providers by running Pulumi programs.
77
88
The library is composed of several modules. The most important of these is the [`pulumitest`](./pulumitest/) module. This is a library designed for testing any Pulumi program within a Go test. It extends the Go [Automation API](https://www.pulumi.com/automation/) with defaults appropriate for local testing such as using temporary directories for state.
99

10-
Here's a short example of how to use pulumitest:
10+
## Quick Start
11+
12+
Here's a basic example of how to use pulumitest:
1113

1214
```go
1315
import (
@@ -23,7 +25,7 @@ func TestPulumiProgram(t *testing.T) {
2325
}
2426
```
2527

26-
Refer to [the full documentation](./pulumitest/README.md) for a complete walkthrough of the features.
28+
For detailed usage patterns, examples, and configuration options, see [the pulumitest documentation](./pulumitest/README.md).
2729

2830
## Attaching In-Process Providers
2931

@@ -93,3 +95,4 @@ The `providers` module provides additional utilities for `pulumitest` when build
9395
The `grpclog` module contains types and functions for reading, querying and writing Pulumi's grpc log format (normally living in a `grpc.json` file).
9496

9597
The `replay` module has methods for exercising specific provider gRPC methods directly and from existing log files.
98+

0 commit comments

Comments
 (0)