pulumi/tests
Justin Van Patten 7309681b5b
Support Python 3.12 (#15190)
Python 3.12 requires `grpcio` 1.59.0 or higher. Unfortunately, there is
a regression in `grpcio` 1.58.0 through the latest version (currently
1.60.0) which causes any error returned from a Python gRPC server to be
written to stderr, including UNIMPLEMENTED errors. This primarily
affects Python dynamic providers, which don't have implementations for
`CheckConfig` and `DiffConfig`, resulting in a traceback error being
emitted to stderr when the engine calls these, which is visible to
users. This `grpcio` regression has been fixed upstream, but the fix has
not been released yet. We've been waiting for a 1.60.1 patch release.

This has not been great for our Python users who are using Python 3.12.
It's particularly bad for new Pulumi users who are using Python 3.12 and
are trying to get started with Pulumi. For these users, when trying to
install the `pulumi` PyPi package (i.e. via `pulumi new python`) the
installation fails with an error because it is pinned to depending on an
older version of `grpcio` which doesn't work on Python 3.12.

This commit works around the problem by providing default
implementations of `CheckConfig` and `DiffConfig` for python dynamic
providers and the component provider API, so that no error is emitted to
stderr when the engine calls these methods. The default implementations
for these are the same behavior that the engine would use if these
methods had returned UNIMPLEMENTED. I believe these are the only two
methods affected by this. Other methods like `Invoke`, `Call`,
`StreamInvoke`, `Construct`, `Attach`, `GetMapping`, and `GetMappings`,
continue to return UNIMPLEMENTED for dynamic providers, which I think is
OK; I don't believe these will be called by the engine under normal
circumstances.

Out of an abundance of caution, the `pulumi` package continues to depend
on the pinned version of `grpcio` when installing on versions of Python
less than 3.12. On Python 3.12 or greater, we now depend on `grpcio`
`~=1.60.0`. 1.60.0 doesn't have the fix for the regression, but the
workaround should allow things to work on Python 3.12 as before.

Once 1.60.1 is released, we can look into updating the `grpcio`
dependency to `~=1.60.1` for all versions of Python, and possibly revert
the workarounds, if we want.

Note: #14474 added a test for dynamic providers to ensure nothing is
written to stderr. The test would fail if the workaround in this PR did
not work as intended:
https://github.com/pulumi/pulumi/pull/14474/files#diff-d92ccd283e08eadab2597825103e45cdaa96fea93324bc4d4d3b1d2b83c51b76

This PR depends on several other smaller PRs:
- https://github.com/pulumi/pulumi/pull/15220
- https://github.com/pulumi/pulumi/pull/15221
- https://github.com/pulumi/pulumi/pull/15222
- https://github.com/pulumi/pulumi/pull/15223
- https://github.com/pulumi/pulumi/pull/15224
- https://github.com/pulumi/pulumi/pull/15225
- https://github.com/pulumi/pulumi/pull/15226

Fixes #14258
2024-01-24 22:24:34 +00:00
..
benchmarks/go-alias-norm Bump the go_modules group across 29 directories with 1 update (#15131) 2024-01-11 16:05:38 +00:00
examples Update node sdk to use typescript definitions for grpc and protobufs. (#14415) 2023-12-04 15:22:44 +00:00
integration Support Python 3.12 (#15190) 2024-01-24 22:24:34 +00:00
testdata Add --import-file to pulumi preview (#14548) 2023-12-05 08:32:40 +00:00
testprovider Remove deprecated Protobufs imports (#15158) 2024-01-17 09:35:20 +00:00
.gitignore ci: Use reduced smoke testing on Windows & macOS targets 2022-09-21 09:55:06 -07:00
README.md Rename "Smoke" test to "Acceptance" tests 2023-01-30 15:38:37 -05:00
about_test.go test: fix regex used to test Go version output in about command. (#10499) 2022-08-29 11:53:03 -07:00
config_test.go filestate: Re-add project support 2023-03-31 13:21:36 -07:00
go.mod Add azure login test (#15161) 2024-01-23 09:41:20 +00:00
go.sum Upgrade pulumi-yaml to 1.5.0 (#15214) 2024-01-23 13:24:11 +00:00
history_test.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
login_test.go ci: radical idea - what if slow tests & no stdout makes GH consider runner dead? 2022-03-06 14:52:13 -08:00
main_test.go Switch to use env.Env in filestate (#14044) 2023-10-18 10:52:54 +00:00
policy_new_test.go Revert "[policy] support premium policies (#13898)" (#14114) 2023-10-06 09:49:40 +00:00
remote_test.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
roundtrip_test.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
smoke_test.go Support Python 3.12 (#15190) 2024-01-24 22:24:34 +00:00
stack_test.go chore: Fix staticcheck failures (#14766) 2023-12-06 17:33:51 +00:00

README.md

Integration Tests

This module provides integration tests for the Pulumi CLI.

The tests can be run via:

make test_all

Usage of Go build tags

In order to speed up integration tests in GitHub actions, Go build tags are used to conditionally compile the desired test cases.

// integration_nodejs_test.go
//go:build (nodejs || all) && !xplatform-acceptance

// integration_nodejs_acceptance_test.go
//go:build nodejs || all