Commit 51fc4c1
* Implement ReadStateBytes + WriteStateBytes
* [WIP] - Testing ReadStateBytes and WriteStateBytes (#37464)
* Fix nil pointer error
* Add WIP test for ReadStateBytes
* Move test mock to separate testing file
* Update mock to send unexpected EOF when there's a problem returning data and it's not a true EOF
* Add test case for when length != expected length
* Add test for when trying to read state from a store type that doesn't exist
* Change symbol names to lowercase
* Add ability to force a diagnostic to be returned from `mockReadStateBytesClient`'s `Recv` method
* Add test showing error diagnostics raised by the ReadStateBytes client are returned
* Add missing header
* Simplify mock by using an embedded type
* Rename `mockOpts` to `mockReadStateBytesOpts`
* Update existing tests to assert what arguments are passed to the RPC method call
* Add mock WriteStateBytesClient which uses `go.uber.org/mock/gomock` to enable assertions about calls to Send
* Add a test for WriteStateBytes that makes assertions about calls to the Send method
* Update test case to explicitly test writing data smaller than the chunk size
* Implement chunking in WriteStateBytes, add test case to assert expected chunking behaviour
* Add generated mock for Provider_WriteStateBytesClient in protocol v6
* Update tests to use new `MockProvider_WriteStateBytesClient`, remove handwritten mock
* Update code comments in test
* Add tests for diagnostics and errors returned during WriteStateBytes
* Add generated mock for Provider_ReadStateBytesClient in protocol v6, replace old mock
* Add test case for grpc errors in ReadStateBytes, fix how error is returned
* Typo in comment
* Add missing warning test, rename some test cases
* Update proto file definition of Read/WriteStateBytes RPCs (#37529)
* Update Read/WriteStateBytes RPCs to match hashicorp/terraform-plugin-go#531
* Run `make protobuf`
* Run `make generate`
* Update use of `proto.ReadStateBytes_ResponseChunk` in tests
* Fix how diagnostics are handled alongside EOF error, update ReadStateBytes test
* More fixes - test setup was incorrect
I think? I assume that a response would be returned full of zero-values when EOF is encountered.
* WIP - avoid crash if chunk is nil
* Sarah's updates to radek/pss-read-write (#37642)
* Update code to not expect a chunk when EOF encountered
* Return early if any grpc errors are encountered during ReadStateBytes
* Close the stream with CloseSend once everything's read without error. Add test case about handling grpc errors from CloseSend.
* Fix test case about warnings: We would expect to receive a chunk with data alongside the warning and have a normal closing of the stream after EOF
* Add log line, remove unneeded type info
* Implement configurable state chunk size
* handle metadata in WriteStateBytes correctly
* validate chunk sizes received from provider
* ReadStateBytes: avoid early return on warnings
---------
Co-authored-by: Sarah French <[email protected]>
1 parent a4cc769 commit 51fc4c1
File tree
18 files changed
+2840
-488
lines changed- docs/plugin-protocol
- internal
- builtin/providers/terraform
- grpcwrap
- plugin6
- mock_proto
- plugin
- provider-simple-v6
- provider-simple
- providers
- testing
- refactoring
- stacks/stackruntime/internal/stackeval/stubs
- tfplugin6
18 files changed
+2840
-488
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
390 | 390 | | |
391 | 391 | | |
392 | 392 | | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
393 | 398 | | |
394 | 399 | | |
395 | 400 | | |
| |||
896 | 901 | | |
897 | 902 | | |
898 | 903 | | |
899 | | - | |
900 | 904 | | |
901 | 905 | | |
902 | 906 | | |
| |||
911 | 915 | | |
912 | 916 | | |
913 | 917 | | |
| 918 | + | |
914 | 919 | | |
915 | 920 | | |
916 | 921 | | |
| 922 | + | |
917 | 923 | | |
918 | 924 | | |
919 | 925 | | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
920 | 971 | | |
921 | 972 | | |
922 | 973 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
295 | 295 | | |
296 | 296 | | |
297 | 297 | | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
298 | 310 | | |
299 | 311 | | |
300 | 312 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
907 | 907 | | |
908 | 908 | | |
909 | 909 | | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
910 | 918 | | |
911 | 919 | | |
912 | 920 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1444 | 1444 | | |
1445 | 1445 | | |
1446 | 1446 | | |
| 1447 | + | |
| 1448 | + | |
| 1449 | + | |
| 1450 | + | |
| 1451 | + | |
| 1452 | + | |
| 1453 | + | |
| 1454 | + | |
1447 | 1455 | | |
1448 | 1456 | | |
1449 | 1457 | | |
| |||
0 commit comments