Skip to content

Commit

Permalink
Disable fsync on etcd envtest (#1630)
Browse files Browse the repository at this point in the history
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 <vincepri@vmware.com>
  • Loading branch information
vincepri authored Aug 10, 2021
1 parent 9133799 commit 3c54acb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
12 changes: 0 additions & 12 deletions hack/test-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,6 @@ source $(dirname ${BASH_SOURCE})/common.sh

header_text "running go test"

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

go test -race ${P_FLAG} ${MOD_OPT} ./...

if [[ -n ${ARTIFACTS:-} ]]; then
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/controllerutil/controllerutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ func CreateOrUpdate(ctx context.Context, c client.Client, obj client.Object, f M
return OperationResultCreated, nil
}

existing := obj.DeepCopyObject() //nolint:ifshort
existing := obj.DeepCopyObject() //nolint
if err := mutate(f, key, obj); err != nil {
return OperationResultNone, err
}
Expand Down
5 changes: 5 additions & 0 deletions pkg/internal/testing/controlplane/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,11 @@ func (e *Etcd) defaultArgs() map[string][]string {
args["advertise-client-urls"] = []string{e.URL.String()}
args["listen-client-urls"] = []string{e.URL.String()}
}

// Add unsafe no fsync, available from etcd 3.5
if ok, _ := e.processState.CheckFlag("unsafe-no-fsync"); ok {
args["unsafe-no-fsync"] = []string{"true"}
}
return args
}

Expand Down

0 comments on commit 3c54acb

Please sign in to comment.