Commit Graph

3 Commits

Author SHA1 Message Date
Fraser Waters cf5b4a2790
Use `assert.NoError` rather than `assert.Nil` ()
<!--- 
Thanks so much for your contribution! If this is your first time
contributing, please ensure that you have read the
[CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md)
documentation.
-->

# Description

<!--- Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context. -->
Likewise `require.NoError` instead of `require.Nil`, and `assert.Error`
rather than `assert.NotNil`.

The error variants of these functions print the errors nicer for test
failures using `Error()` rather than `GoString()`.

For bail errors this is _much_ better than the `result.Result` days
where we now get errors like:
```
Error:      	Received unexpected error:
            	BAIL: inner error
```
instead of:
```
Error:      	Expected nil, but got: &simpleResult{}
```

Also print the bail error in `TestPlan.Run` so we can see the
description of it.
2023-10-13 09:46:07 +00:00
Abhinav Gupta 34961a6a29
pkg/filestate: Plumb context
The filestate backend implementation drops context in many places
instead opting to use context.TODO.
context.TODO is a TODO--something intended to be addressed.
context.Backgruond is appropriate for process-scoped operations.

In this case, we can resolve the issues and drop all uses of
context.TODO by plumbing the received contexts appropriately.

For localSnapshotPersister, we add a new `ctx` field
because the interface doesn't yet accept a context argument.
This is tracked in .

Result:

```
% rg context.TODO pkg/backend/filestate
[empty]
```

Resolves 
2023-04-10 15:53:32 -07:00
Abhinav Gupta 0cca581ac5
test(filestate): Add legacy copies of migrated tests
The filestate backend now defaults to using project mode for new stores.
This has a side effect of migrating stores in all existing tests
to project mode.
As a result of this, we lost some of the legacy test.

To get around this, create legacy copies of affected tests.
We run them in legacy mode by ensuring that the bucket is non-empty
with a marker file.
2023-03-31 13:21:30 -07:00