Skip to content

Commit 3c54acb

Browse files
authored
Disable fsync on etcd envtest (kubernetes-sigs#1630)
etcd 3.5 now supports disabling fsync; this change adds the new flag if it's available which helps speed up envtest execution Signed-off-by: Vince Prignano <[email protected]>
1 parent 9133799 commit 3c54acb

File tree

3 files changed

+6
-13
lines changed

3 files changed

+6
-13
lines changed

hack/test-all.sh

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,6 @@ source $(dirname ${BASH_SOURCE})/common.sh
2020

2121
header_text "running go test"
2222

23-
# On MacOS there is a strange race condition
24-
# between port allocation of envtest suites when go test
25-
# runs all the tests in parallel without any limits (spins up around 10+ environments).
26-
#
27-
# To avoid flakes, set we're setting the go-test parallel flag to
28-
# to limit the number of parallel executions.
29-
#
30-
# TODO(community): Investigate this behavior further.
31-
if [[ "${OSTYPE}" == "darwin"* ]]; then
32-
P_FLAG="-p=1"
33-
fi
34-
3523
go test -race ${P_FLAG} ${MOD_OPT} ./...
3624

3725
if [[ -n ${ARTIFACTS:-} ]]; then

pkg/controller/controllerutil/controllerutil.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ func CreateOrUpdate(ctx context.Context, c client.Client, obj client.Object, f M
207207
return OperationResultCreated, nil
208208
}
209209

210-
existing := obj.DeepCopyObject() //nolint:ifshort
210+
existing := obj.DeepCopyObject() //nolint
211211
if err := mutate(f, key, obj); err != nil {
212212
return OperationResultNone, err
213213
}

pkg/internal/testing/controlplane/etcd.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,11 @@ func (e *Etcd) defaultArgs() map[string][]string {
157157
args["advertise-client-urls"] = []string{e.URL.String()}
158158
args["listen-client-urls"] = []string{e.URL.String()}
159159
}
160+
161+
// Add unsafe no fsync, available from etcd 3.5
162+
if ok, _ := e.processState.CheckFlag("unsafe-no-fsync"); ok {
163+
args["unsafe-no-fsync"] = []string{"true"}
164+
}
160165
return args
161166
}
162167

0 commit comments

Comments
 (0)