Repository: kopia/kopia
Pull request #2748 (2023-02-09 06:23:57)

chore(ci): upgraded linter to 1.51.1, minor style fixes

codecov[bot]: # [Codecov](https://codecov.io/gh/kopia/kopia/pull/2748?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kopia) Report
Base: **75.17**% // Head: **75.20**% // Increases project coverage by **`+0.03%`** :tada:
> Coverage data is based on head [(`7d6dd07`)](https://codecov.io/gh/kopia/kopia/pull/2748?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kopia) compared to base [(`ddcaed5`)](https://codecov.io/gh/kopia/kopia/commit/ddcaed54efbb8fe292d0b4b4f102c8822eaded8a?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kopia).
> Patch coverage: 50.00% of modified lines in pull request are covered.

<details><summary>Additional details and impacted files</summary>


```diff
@@            Coverage Diff             @@
##           master    #2748      +/-   ##
==========================================
+ Coverage   75.17%   75.20%   +0.03%     
==========================================
  Files         457      457              
  Lines       35868    35868              
==========================================
+ Hits        26962    26976      +14     
+ Misses       7001     6991      -10     
+ Partials     1905     1901       -4     
```


| [Impacted Files](https://codecov.io/gh/kopia/kopia/pull/2748?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kopia) | Coverage Δ | |
|---|---|---|
| [repo/blob/config.go](https://codecov.io/gh/kopia/kopia/pull/2748?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kopia#diff-cmVwby9ibG9iL2NvbmZpZy5nbw==) | `100.00% <ø> (ø)` | |
| [repo/ecc/ecc\_rs\_crc.go](https://codecov.io/gh/kopia/kopia/pull/2748?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kopia#diff-cmVwby9lY2MvZWNjX3JzX2NyYy5nbw==) | `84.22% <0.00%> (ø)` | |
| [repo/format/repository\_config.go](https://codecov.io/gh/kopia/kopia/pull/2748?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kopia#diff-cmVwby9mb3JtYXQvcmVwb3NpdG9yeV9jb25maWcuZ28=) | `56.66% <ø> (ø)` | |
| [internal/sparsefile/sparsefile.go](https://codecov.io/gh/kopia/kopia/pull/2748?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kopia#diff-aW50ZXJuYWwvc3BhcnNlZmlsZS9zcGFyc2VmaWxlLmdv) | `64.28% <100.00%> (ø)` | |
| [repo/content/content\_manager\_iterate.go](https://codecov.io/gh/kopia/kopia/pull/2748?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kopia#diff-cmVwby9jb250ZW50L2NvbnRlbnRfbWFuYWdlcl9pdGVyYXRlLmdv) | `88.10% <0.00%> (-2.17%)` | :arrow_down: |
| [repo/open.go](https://codecov.io/gh/kopia/kopia/pull/2748?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kopia#diff-cmVwby9vcGVuLmdv) | `78.33% <0.00%> (-1.00%)` | :arrow_down: |
| [internal/server/server.go](https://codecov.io/gh/kopia/kopia/pull/2748?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kopia#diff-aW50ZXJuYWwvc2VydmVyL3NlcnZlci5nbw==) | `73.09% <0.00%> (-0.57%)` | :arrow_down: |
| [internal/server/source\_manager.go](https://codecov.io/gh/kopia/kopia/pull/2748?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kopia#diff-aW50ZXJuYWwvc2VydmVyL3NvdXJjZV9tYW5hZ2VyLmdv) | `81.42% <0.00%> (ø)` | |
| [internal/providervalidation/providervalidation.go](https://codecov.io/gh/kopia/kopia/pull/2748?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kopia#diff-aW50ZXJuYWwvcHJvdmlkZXJ2YWxpZGF0aW9uL3Byb3ZpZGVydmFsaWRhdGlvbi5nbw==) | `65.68% <0.00%> (+0.73%)` | :arrow_up: |
| [snapshot/snapshotfs/upload.go](https://codecov.io/gh/kopia/kopia/pull/2748?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kopia#diff-c25hcHNob3Qvc25hcHNob3Rmcy91cGxvYWQuZ28=) | `85.13% <0.00%> (+1.43%)` | :arrow_up: |
| ... and [2 more](https://codecov.io/gh/kopia/kopia/pull/2748?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kopia) | |

Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kopia). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kopia)

</details>

[:umbrella: View full report at Codecov](https://codecov.io/gh/kopia/kopia/pull/2748?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kopia).   
:loudspeaker: Do you have feedback about the report comment? [Let us know in this issue](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kopia).


Patch:
diff --git a/.golangci.yml b/.golangci.yml
index a33d726a..5854f122 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -104,6 +104,9 @@ issues:
     - path: \.pb\.go
       linters:
       - gofmt
+    - path: reporter.go
+      linters:
+      - musttag
     - path: _test\.go|testing|tests|test_env|fshasher|fault
       linters:
       - contextcheck
@@ -115,6 +118,7 @@ issues:
       - gocognit
       - gomnd
       - gosec
+      - musttag
       - nestif
       - revive
       - nolintlint
diff --git a/go.mod b/go.mod
index 0c61377b..f4c6b91d 100644
--- a/go.mod
+++ b/go.mod
@@ -51,12 +51,12 @@ require (
 	go.uber.org/zap v1.24.0
 	golang.org/x/crypto v0.5.0
 	golang.org/x/mod v0.7.0
-	golang.org/x/net v0.5.0
+	golang.org/x/net v0.6.0
 	golang.org/x/oauth2 v0.3.0
 	golang.org/x/sync v0.1.0
 	golang.org/x/sys v0.5.0
-	golang.org/x/term v0.4.0
-	golang.org/x/text v0.6.0
+	golang.org/x/term v0.5.0
+	golang.org/x/text v0.7.0
 	google.golang.org/api v0.109.0
 	google.golang.org/grpc v1.52.3
 	google.golang.org/protobuf v1.28.1
diff --git a/go.sum b/go.sum
index 2049fa5b..b5c4ab8f 100644
--- a/go.sum
+++ b/go.sum
@@ -342,8 +342,8 @@ golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qx
 golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
 golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
 golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco=
-golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw=
-golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws=
+golang.org/x/net v0.6.0 h1:L4ZwwTvKW9gr0ZMS1yrHD9GZhIuVjOBBnaKH+SPQK0Q=
+golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
 golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
 golang.org/x/oauth2 v0.3.0 h1:6l90koy8/LaBLmLu8jpHeHexzMwEita0zFfYlggy2F8=
 golang.org/x/oauth2 v0.3.0/go.mod h1:rQrIauxkUhJ6CuwEXwymO2/eh4xz2ZWF1nBkcxS+tGk=
@@ -378,16 +378,16 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
 golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
 golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
-golang.org/x/term v0.4.0 h1:O7UWfv5+A2qiuulQk30kVinPoMtoIPeVaKLEgLpVkvg=
-golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ=
+golang.org/x/term v0.5.0 h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY=
+golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
 golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
 golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
 golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
 golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
 golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
 golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
-golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k=
-golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
+golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo=
+golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
 golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
 golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
 golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
diff --git a/internal/serverapi/serverapi.go b/internal/serverapi/serverapi.go
index 507916d0..38b97076 100644
--- a/internal/serverapi/serverapi.go
+++ b/internal/serverapi/serverapi.go
@@ -123,6 +123,8 @@ type CheckRepositoryExistsRequest struct {
 }
 
 // ConnectRepositoryRequest contains request to connect to a repository.
+//
+//nolint:musttag // false positive
 type ConnectRepositoryRequest struct {
 	Storage             blob.ConnectionInfo `json:"storage"`
 	Password            string              `json:"password"`
diff --git a/internal/sparsefile/sparsefile.go b/internal/sparsefile/sparsefile.go
index 9e538e7c..866f233c 100644
--- a/internal/sparsefile/sparsefile.go
+++ b/internal/sparsefile/sparsefile.go
@@ -3,7 +3,6 @@
 
 import (
 	"io"
-	"os"
 
 	"github.com/pkg/errors"
 
@@ -27,7 +26,7 @@ func copyBuffer(dst io.WriteSeeker, src io.Reader, buf []byte) (written int64, e
 		if nr > 0 { //nolint:nestif
 			// If non-zero data is read, write it. Otherwise, skip forwards.
 			if isAllZero(buf) {
-				dst.Seek(int64(nr), os.SEEK_CUR) //nolint:errcheck
+				dst.Seek(int64(nr), io.SeekCurrent) //nolint:errcheck
 				written += int64(nr)
 
 				continue
diff --git a/repo/blob/config.go b/repo/blob/config.go
index 215fe128..ac6cb5ed 100644
--- a/repo/blob/config.go
+++ b/repo/blob/config.go
@@ -7,6 +7,8 @@
 )
 
 // ConnectionInfo represents JSON-serializable configuration of a blob storage.
+//
+//nolint:musttag // we use custom JSON marshaling.
 type ConnectionInfo struct {
 	Type   string
 	Config interface{}
diff --git a/repo/ecc/ecc_rs_crc.go b/repo/ecc/ecc_rs_crc.go
index 91df05bc..beb70365 100644
--- a/repo/ecc/ecc_rs_crc.go
+++ b/repo/ecc/ecc_rs_crc.go
@@ -402,8 +402,7 @@ type sizesInfo struct {
 	enc          reedsolomon.Encoder
 }
 
-//nolint:unused // Used in tests
-func (s *sizesInfo) computeFinalFileSize(size int) int {
+func computeFinalFileSize(s *sizesInfo, size int) int {
 	if s.StorePadding {
 		return computeFinalFileSizeWithPadding(s.DataShards, s.ParityShards, s.ShardSize, s.Blocks)
 	}
@@ -415,7 +414,6 @@ func computeFinalFileSizeWithPadding(dataShards, parityShards, shardSize, blocks
 	return (parityShards + dataShards) * (crcSize + shardSize) * blocks
 }
 
-//nolint:unused // Used in tests
 func computeFinalFileSizeWithoutPadding(inputSize, parityShards, shardSize, blocks int) int {
 	sizePlusLength := lengthSize + inputSize
 	return parityShards*(crcSize+shardSize)*blocks + sizePlusLength + ceilInt(sizePlusLength, shardSize)*crcSize
diff --git a/repo/format/repository_config.go b/repo/format/repository_config.go
index 69d81b30..5fd58b1a 100644
--- a/repo/format/repository_config.go
+++ b/repo/format/repository_config.go
@@ -10,6 +10,8 @@
 
 // RepositoryConfig describes the format of objects in a repository.
 // The contents of this object are stored encrypted since they contain sensitive key material.
+//
+//nolint:musttag // false positive
 type RepositoryConfig struct {
 	ContentFormat
 	ObjectFormat
diff --git a/tools/gettool/checksums.txt b/tools/gettool/checksums.txt
index 1f07ee91..456c1143 100644
--- a/tools/gettool/checksums.txt
+++ b/tools/gettool/checksums.txt
@@ -8,12 +8,12 @@ https://github.com/gohugoio/hugo/releases/download/v0.89.2/hugo_extended_0.89.2_
 https://github.com/gohugoio/hugo/releases/download/v0.89.2/hugo_extended_0.89.2_macOS-64bit.tar.gz: f9185f6d14eb84d9029d59cdd8a977f2f0be334c4f9d38f2099e56a0c0734731
 https://github.com/gohugoio/hugo/releases/download/v0.89.2/hugo_extended_0.89.2_macOS-ARM64.tar.gz: 99a5b4738528d4858a0237199eabc7aee77674c8c7edcfe269efb4b515566cec
 https://github.com/gohugoio/hugo/releases/download/v0.89.2/hugo_extended_0.89.2_windows-64bit.zip: 8d79db4f24fbf023c64862c37d09291ac216875dad91e71dd8753cb5883e4274
-https://github.com/golangci/golangci-lint/releases/download/v1.50.1/golangci-lint-1.50.1-darwin-amd64.tar.gz: 0f615fb8c364f6e4a213f2ed2ff7aa1fc2b208addf29511e89c03534067bbf57
-https://github.com/golangci/golangci-lint/releases/download/v1.50.1/golangci-lint-1.50.1-darwin-arm64.tar.gz: 3ca9753d7804b34f9165427fbe339dbea69bd80be8a10e3f02c6037393b2e1c4
-https://github.com/golangci/golangci-lint/releases/download/v1.50.1/golangci-lint-1.50.1-linux-amd64.tar.gz: 4ba1dc9dbdf05b7bdc6f0e04bdfe6f63aa70576f51817be1b2540bbce017b69a
-https://github.com/golangci/golangci-lint/releases/download/v1.50.1/golangci-lint-1.50.1-linux-arm64.tar.gz: 3ea0a6d5946340f6831646e2c67a317dd9b35bdc4e09b2df953a86f09ba05d74
-https://github.com/golangci/golangci-lint/releases/download/v1.50.1/golangci-lint-1.50.1-linux-armv6.tar.gz: 980832f12fbdd0a8e636666839b168c2bbf0ca573ff50b042d3977f65c4987d7
-https://github.com/golangci/golangci-lint/releases/download/v1.50.1/golangci-lint-1.50.1-windows-amd64.zip: 8c2da214884db02fb7f3d929672c515ae3b9d10defad4dd661c4ab365a316d68
+https://github.com/golangci/golangci-lint/releases/download/v1.51.1/golangci-lint-1.51.1-darwin-amd64.tar.gz: fba08acc4027f69f07cef48fbff70b8a7ecdfaa1c2aba9ad3fb31d60d9f5d4bc
+https://github.com/golangci/golangci-lint/releases/download/v1.51.1/golangci-lint-1.51.1-darwin-arm64.tar.gz: 75b8f0ff3a4e68147156be4161a49d4576f1be37a0b506473f8c482140c1e7f2
+https://github.com/golangci/golangci-lint/releases/download/v1.51.1/golangci-lint-1.51.1-linux-amd64.tar.gz: 17aeb26c76820c22efa0e1838b0ab93e90cfedef43fbfc9a2f33f27eb9e5e070
+https://github.com/golangci/golangci-lint/releases/download/v1.51.1/golangci-lint-1.51.1-linux-arm64.tar.gz: 9744bc34e7b8d82ca788b667bfb7155a39b4be9aef43bf9f10318b1372cea338
+https://github.com/golangci/golangci-lint/releases/download/v1.51.1/golangci-lint-1.51.1-linux-armv6.tar.gz: 0dda8dbeb2ff7455a044ec8e347f2fc6d655d2e99d281b3b95e88167031c673d
+https://github.com/golangci/golangci-lint/releases/download/v1.51.1/golangci-lint-1.51.1-windows-amd64.zip: 722d7b87b9cdda0a3835d5030b3fc5385c2eba4c107f63f6391cfb2ac35f051d
 https://github.com/goreleaser/goreleaser/releases/download/v0.176.0/goreleaser_Darwin_arm64.tar.gz: 1f95e6561974f4766d8833438b646b06930563ca9867447ea03edb623d876c75
 https://github.com/goreleaser/goreleaser/releases/download/v0.176.0/goreleaser_Darwin_x86_64.tar.gz: 17ecad881a50e32f033da5a200c8417d37cae70f09e925645452937998aca506
 https://github.com/goreleaser/goreleaser/releases/download/v0.176.0/goreleaser_Linux_arm64.tar.gz: 8bf2a9b9e84498bfa239f2fe91b2d555642c87ab9d3f5d37f29e6e97116910a3
diff --git a/tools/tools.mk b/tools/tools.mk
index e2a2180a..346dbf94 100644
--- a/tools/tools.mk
+++ b/tools/tools.mk
@@ -102,7 +102,7 @@ retry:=
 endif
 
 # tool versions
-GOLANGCI_LINT_VERSION=1.50.1
+GOLANGCI_LINT_VERSION=1.51.1
 CHECKLOCKS_VERSION=release-20221026.0
 NODE_VERSION=16.13.0
 HUGO_VERSION=0.89.2


Test patch:
diff --git a/repo/ecc/ecc_rs_crc_test.go b/repo/ecc/ecc_rs_crc_test.go
index 92ca8a5c..2c639289 100644
--- a/repo/ecc/ecc_rs_crc_test.go
+++ b/repo/ecc/ecc_rs_crc_test.go
@@ -21,7 +21,7 @@ func Test_RsCrc32_AssertSizeAlwaysGrow(t *testing.T) {
 
 	for i := 1; i < 10*1024*1024; i++ {
 		sizes := impl.computeSizesFromOriginal(i)
-		total := sizes.computeFinalFileSize(i)
+		total := computeFinalFileSize(&sizes, i)
 
 		//nolint:gocritic
 		// println(fmt.Sprintf("%-8v -> b:%-4v s:%-8v t:%-8v", i, sizes.Blocks, sizes.ShardSize, total))
diff --git a/tests/end_to_end_test/server_start_test.go b/tests/end_to_end_test/server_start_test.go
index 74d272fb..63473bab 100644
--- a/tests/end_to_end_test/server_start_test.go
+++ b/tests/end_to_end_test/server_start_test.go
@@ -42,7 +42,7 @@ func TestServerStart(t *testing.T) {
 
 	var sp testutil.ServerParameters
 
-	e.RunAndProcessStderr(t, sp.ProcessOutput,
+	wait, _ := e.RunAndProcessStderr(t, sp.ProcessOutput,
 		"server", "start",
 		"--ui",
 		"--address=localhost:0",
@@ -54,6 +54,9 @@ func TestServerStart(t *testing.T) {
 		"--override-username=fake-username",
 		"--ui-title-prefix", "Blah: <script>bleh</script> ",
 	)
+
+	defer wait()
+
 	t.Logf("detected server parameters %#v", sp)
 
 	cli, err := apiclient.NewKopiaAPIClient(apiclient.Options{
@@ -196,7 +199,7 @@ func TestServerStartAsyncRepoConnect(t *testing.T) {
 	)
 
 	// run again - passing --async-repo-connect
-	e.RunAndProcessStderr(t, sp.ProcessOutput,
+	wait, _ := e.RunAndProcessStderr(t, sp.ProcessOutput,
 		"server", "start",
 		"--ui",
 		"--address=localhost:0",
@@ -206,6 +209,9 @@ func TestServerStartAsyncRepoConnect(t *testing.T) {
 		"--tls-generate-cert",
 		"--tls-generate-rsa-key-size=2048", // use shorter key size to speed up generation
 	)
+
+	defer wait()
+
 	t.Logf("detected server parameters %#v", sp)
 
 	controlClient, err := apiclient.NewKopiaAPIClient(apiclient.Options{
@@ -263,13 +269,16 @@ func TestServerCreateAndConnectViaAPI(t *testing.T) {
 		},
 	}
 
-	e.RunAndProcessStderr(t, sp.ProcessOutput,
+	wait, _ := e.RunAndProcessStderr(t, sp.ProcessOutput,
 		"server", "start", "--ui",
 		"--address=localhost:0", "--random-password",
 		"--random-server-control-password",
 		"--tls-generate-cert",
 		"--tls-generate-rsa-key-size=2048", // use shorter key size to speed up generation,
 	)
+
+	defer wait()
+
 	t.Logf("detected server parameters %#v", sp)
 
 	cli, err := apiclient.NewKopiaAPIClient(apiclient.Options{
@@ -345,12 +354,16 @@ func TestConnectToExistingRepositoryViaAPI(t *testing.T) {
 	}
 
 	// at this point repository is not connected, start the server
-	e.RunAndProcessStderr(t, sp.ProcessOutput, "server", "start",
+	wait, _ := e.RunAndProcessStderr(t, sp.ProcessOutput, "server", "start",
 		"--ui", "--address=localhost:0", "--random-password",
 		"--random-server-control-password",
 		"--tls-generate-cert",
 		"--tls-generate-rsa-key-size=2048", // use shorter key size to speed up generation
-		"--override-hostname=fake-hostname", "--override-username=fake-username")
+		"--override-hostname=fake-hostname", "--override-username=fake-username",
+	)
+
+	defer wait()
+
 	t.Logf("detected server parameters %#v", sp)
 
 	controlClient, err := apiclient.NewKopiaAPIClient(apiclient.Options{
@@ -428,7 +441,7 @@ func TestServerStartInsecure(t *testing.T) {
 	var sp testutil.ServerParameters
 
 	// server starts without password and no TLS when --insecure is provided.
-	e.RunAndProcessStderr(t, sp.ProcessOutput,
+	wait, _ := e.RunAndProcessStderr(t, sp.ProcessOutput,
 		"server", "start",
 		"--ui",
 		"--address=localhost:0",
@@ -436,6 +449,8 @@ func TestServerStartInsecure(t *testing.T) {
 		"--insecure",
 	)
 
+	defer wait()
+
 	cli, err := apiclient.NewKopiaAPIClient(apiclient.Options{
 		BaseURL: sp.BaseURL,
 	})