pulumi/sdk/python/lib/test/automation
Thomas Gummerer 1339f96833
automation: only read complete lines before trying to deserialize (#15778)
When tailing the event log in automation API we currently have nothing
that makes sure we read only complete lines. This means if the OS
happens to flush an incomplete line for whatever reason (or the Go JSON
encoder does, which we're using to write these lines), we might read a
line that is incompletely written, and thus will fail to JSON decode it.

Since the JSON encoder always writes a newline at the end of each
string, we can also make sure that the line we read ends with a newline
and otherwise wait for the rest of the line to be written.

The library we use in Go provides a convenient setting for this, while
in python and nodejs we need to add some code to do this ourselves.

Fixes https://github.com/pulumi/pulumi/issues/15235
Fixes https://github.com/pulumi/pulumi/issues/15652
Fixes https://github.com/pulumi/pulumi/issues/9269 (This is closed
already, but never had a proper resolution afaics)
Fixes https://github.com/pulumi/pulumi/issues/6768

It would be nice to add a typescript test here as well, but I'm not sure
how to do that without marking the readLines function non-private. But I
don't know typescript well, so any hints of how to do that would be
appreciated!

## Checklist

- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
  - [x] I have formatted my code using `gofumpt`

<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [x] I have added tests that prove my fix is effective or that my
feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [x] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @Pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
2024-03-26 14:32:56 +00:00
..
data Update github.com/cloudflare/circl to v1.3.7 (#15151) 2024-01-16 08:59:57 +00:00
errors [sdk/python] Install local SDK in automation API test (#15222) 2024-01-24 02:06:38 +00:00
__init__.py [Automation API] Python Implementation (#5979) 2021-01-12 16:55:59 -08:00
test_cmd.py [auto/python] Add new API to install the Pulumi CLI (#15204) 2024-01-26 14:30:19 +00:00
test_errors.py [sdk/python] Install local SDK in automation API test (#15222) 2024-01-24 02:06:38 +00:00
test_isolation.py Make pythons RPCManager a context variable 2023-07-13 09:59:12 +01:00
test_local_workspace.py Support async inline programs (#15278) 2024-01-29 16:10:13 +00:00
test_remote_workspace.py [auto] Add SkipInstallDependencies option for remote workspaces 2022-12-19 10:27:01 -05:00
test_stack.py automation: only read complete lines before trying to deserialize (#15778) 2024-03-26 14:32:56 +00:00
test_utils.py [Automation API / Python] - Environment functions (#14776) 2023-12-11 16:14:22 +00:00