pulumi/pkg/resource
Kyle Dixler 485718f533
[ci] `pkg/resource/deploy/(step(_generator|_executor)?|import).go` coverage (#14997)
covers
- step.go
- step_executor.go
- step_generator.go
- import.go

They all depend on an added field to steps that use providers in
`Apply()`

# Includes changes to a non-test file: step.go

steps query the deployment for providers. There is not a straightforward
way of mocking a provider for a step. I've added a field called
`provider plugin.Provider` to steps that use providers to be used
instead of querying the Deployment with getProvider().

This approach aims to minimize the cognitive complexity and potential
for errors in comparison to the branching alternative due to the
behavior of `:=` and assigning the value to an existing value while also
defining a new variable err.

```diff
-               prov, err := getProvider(s, s.provider)
-               if err != nil {
-                       return resource.StatusOK, nil, err
+               prov := s.provider
+               if prov == nil {
+                       var err error
+                       prov, err = getProvider(s)
+                       if err != nil {
+                               return resource.StatusOK, nil, err
+                       }
                }
```
2023-12-22 21:14:04 +00:00
..
analyzer Clean up uses of .Error() (#14965) 2023-12-20 15:54:06 +00:00
deploy [ci] `pkg/resource/deploy/(step(_generator|_executor)?|import).go` coverage (#14997) 2023-12-22 21:14:04 +00:00
edit Rewrite filestate.RenameStack logic in terms of checkpoints (#13927) 2023-12-22 12:28:41 +00:00
graph Replace ResourceSet with a generic set type (#14724) 2023-12-03 23:20:43 +00:00
provider Clean up uses of .Error() (#14965) 2023-12-20 15:54:06 +00:00
stack Clean up uses of .Error() (#14965) 2023-12-20 15:54:06 +00:00
testdata ci: radical idea - what if slow tests & no stdout makes GH consider runner dead? 2022-03-06 14:52:13 -08:00