Commit Graph

9 Commits

Author SHA1 Message Date
Thomas Gummerer 801c504656
cloud backend test: retry creating secrets manager ()
Creating the secret manager seems to flake frequently for reasons
seemingly unrelated to the test itself, but rather cloud provider
flakyness. In particular the AWS backend seems to be somewhat flaky.

Try to work around this by retrying a few times with a backoff.

Fixes https://github.com/pulumi/pulumi/issues/16410 (hopefully).
2024-06-27 04:33:56 +00:00
Fraser Waters 40b45ecc85
Add test for azure secrets ()
Add a test showing the problems we ran into when upgrading from
gocloud.dev 0.27.0 to 0.28.0 and 0.29.0. It's a little bit awkward,
since the issue only happens when upgrading form an encrypted key
generated with the old version of gocloud.dev to a newer version of
gocloud.dev.

Fixes https://github.com/pulumi/pulumi/issues/11986

---------

Co-authored-by: Thomas Gummerer <t.gummerer@gmail.com>
2024-01-03 14:47:09 +00:00
Abhinav Gupta 7aa5b77a0c
all: Reformat with gofumpt
Per team discussion, switching to gofumpt.

[gofumpt][1] is an alternative, stricter alternative to gofmt.
It addresses other stylistic concerns that gofmt doesn't yet cover.

  [1]: https://github.com/mvdan/gofumpt

See the full list of [Added rules][2], but it includes:

- Dropping empty lines around function bodies
- Dropping unnecessary variable grouping when there's only one variable
- Ensuring an empty line between multi-line functions
- simplification (`-s` in gofmt) is always enabled
- Ensuring multi-line function signatures end with
  `) {` on a separate line.

  [2]: https://github.com/mvdan/gofumpt#Added-rules

gofumpt is stricter, but there's no lock-in.
All gofumpt output is valid gofmt output,
so if we decide we don't like it, it's easy to switch back
without any code changes.

gofumpt support is built into the tooling we use for development
so this won't change development workflows.

- golangci-lint includes a gofumpt check (enabled in this PR)
- gopls, the LSP for Go, includes a gofumpt option
  (see [installation instrutions][3])

  [3]: https://github.com/mvdan/gofumpt#installation

This change was generated by running:

```bash
gofumpt -w $(rg --files -g '*.go' | rg -v testdata | rg -v compilation_error)
```

The following files were manually tweaked afterwards:

- pkg/cmd/pulumi/stack_change_secrets_provider.go:
  one of the lines overflowed and had comments in an inconvenient place
- pkg/cmd/pulumi/destroy.go:
  `var x T = y` where `T` wasn't necessary
- pkg/cmd/pulumi/policy_new.go:
  long line because of error message
- pkg/backend/snapshot_test.go:
  long line trying to assign three variables in the same assignment

I have included mention of gofumpt in the CONTRIBUTING.md.
2023-03-03 09:00:24 -08:00
Fraser Waters a3f7a342b2 Move the project file handling for secret config to one place
This means the secret providers just work in terms of
workspace.ProjectStack, mutate as they wish and let the higher level
work out if it should save the file or not. Rather than having each
secret manager maintain "should I save the file" code.
2023-02-01 17:03:38 +00:00
Fraser Waters db9a17193d Replace assertNoError with require.NoError in aws kms tests 2023-01-24 08:28:48 +00:00
Abhinav Gupta c9d5287f5c
sleep: Retry and adapt instead of fixed sleep
Instead of sleeping for a fixed 10 seconds,
make up to 10 attempts with 2 second delays in between each.
This will adapt better if the delay in AWS changes.
2023-01-19 09:50:03 -08:00
Fraser Waters 62df45aa76 Add tests for assumed role to awskms tests 2023-01-14 21:52:16 +00:00
Fraser Waters f9a49b3407 Move cloud methods to pkg/secrets 2023-01-13 10:39:16 +00:00
Fraser Waters 2adcd3d919 Add tests for awskms secret manager 2022-12-02 13:38:28 +00:00