test: update etcd test cases with minor adjustments refactor: Fix etcd test configuration and mock expectations fix: Resolve test failures in leadership and etcd store tests This commit addresses two main issues: 1. Improved context cancellation handling in leadership manager test 2. Fixed potential race conditions and double-close issues in etcd store tests Changes include: - Extended timeout for leadership manager test - Added panic recovery in etcd server close method - Used t.Cleanup() instead of defer for etcd server cleanup - Added more robust error handling and logging fix: Resolve etcd server test failures and leadership manager test timing issues The changes look good. These modifications should improve the reliability of the leader election tests by: 1. Adding small wait times to ensure leadership state stabilization 2. Improving the `GetLeader` method with a fallback mechanism 3. Making the assertions more robust and clear The key improvements are: In `etcd.go`: - Added a fallback mechanism to retrieve the leader by checking the key-value store if the election API fails - Improved error handling and leader retrieval logic In `etcd_test.go`: - Added `time.Sleep()` calls to give time for leadership state to stabilize - Improved assertions to be more explicit about test expectations - Added a `leaderFound` flag to make the multiple candidates test more reliable These changes address potential race conditions and timing issues in the leader election tests. Would you like me to explain any part of the changes in more detail? additional test fixes
83 lines
3.6 KiB
Modula-2
83 lines
3.6 KiB
Modula-2
module git.dws.rip/dubey/kat
|
|
|
|
go 1.23.0
|
|
|
|
toolchain go1.24.2
|
|
|
|
require (
|
|
github.com/davecgh/go-spew v1.1.1
|
|
github.com/google/uuid v1.6.0
|
|
github.com/spf13/cobra v1.1.3
|
|
github.com/stretchr/testify v1.10.0
|
|
go.etcd.io/etcd/client/v3 v3.5.21
|
|
go.etcd.io/etcd/server/v3 v3.5.21
|
|
google.golang.org/protobuf v1.36.6
|
|
gopkg.in/yaml.v3 v3.0.1
|
|
)
|
|
|
|
require (
|
|
github.com/beorn7/perks v1.0.1 // indirect
|
|
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
|
|
github.com/cespare/xxhash/v2 v2.2.0 // indirect
|
|
github.com/coreos/go-semver v0.3.0 // indirect
|
|
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
|
|
github.com/dustin/go-humanize v1.0.0 // indirect
|
|
github.com/go-logr/logr v1.3.0 // indirect
|
|
github.com/go-logr/stdr v1.2.2 // indirect
|
|
github.com/gogo/protobuf v1.3.2 // indirect
|
|
github.com/golang-jwt/jwt/v4 v4.5.2 // indirect
|
|
github.com/golang/protobuf v1.5.4 // indirect
|
|
github.com/google/btree v1.0.1 // indirect
|
|
github.com/gorilla/websocket v1.4.2 // indirect
|
|
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
|
|
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
|
|
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
|
|
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect
|
|
github.com/inconshreveable/mousetrap v1.0.0 // indirect
|
|
github.com/jonboulle/clockwork v0.2.2 // indirect
|
|
github.com/json-iterator/go v1.1.11 // indirect
|
|
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
|
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
|
github.com/modern-go/reflect2 v1.0.1 // indirect
|
|
github.com/pmezard/go-difflib v1.0.0 // indirect
|
|
github.com/prometheus/client_golang v1.11.1 // indirect
|
|
github.com/prometheus/client_model v0.2.0 // indirect
|
|
github.com/prometheus/common v0.26.0 // indirect
|
|
github.com/prometheus/procfs v0.6.0 // indirect
|
|
github.com/sirupsen/logrus v1.9.3 // indirect
|
|
github.com/soheilhy/cmux v0.1.5 // indirect
|
|
github.com/spf13/pflag v1.0.5 // indirect
|
|
github.com/stretchr/objx v0.5.2 // indirect
|
|
github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802 // indirect
|
|
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 // indirect
|
|
go.etcd.io/bbolt v1.3.11 // indirect
|
|
go.etcd.io/etcd/api/v3 v3.5.21 // indirect
|
|
go.etcd.io/etcd/client/pkg/v3 v3.5.21 // indirect
|
|
go.etcd.io/etcd/client/v2 v2.305.21 // indirect
|
|
go.etcd.io/etcd/pkg/v3 v3.5.21 // indirect
|
|
go.etcd.io/etcd/raft/v3 v3.5.21 // indirect
|
|
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0 // indirect
|
|
go.opentelemetry.io/otel v1.20.0 // indirect
|
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0 // indirect
|
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0 // indirect
|
|
go.opentelemetry.io/otel/metric v1.20.0 // indirect
|
|
go.opentelemetry.io/otel/sdk v1.20.0 // indirect
|
|
go.opentelemetry.io/otel/trace v1.20.0 // indirect
|
|
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
|
|
go.uber.org/atomic v1.7.0 // indirect
|
|
go.uber.org/multierr v1.6.0 // indirect
|
|
go.uber.org/zap v1.17.0 // indirect
|
|
golang.org/x/crypto v0.36.0 // indirect
|
|
golang.org/x/net v0.38.0 // indirect
|
|
golang.org/x/sys v0.31.0 // indirect
|
|
golang.org/x/text v0.23.0 // indirect
|
|
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba // indirect
|
|
google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d // indirect
|
|
google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect
|
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect
|
|
google.golang.org/grpc v1.59.0 // indirect
|
|
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
|
|
gopkg.in/yaml.v2 v2.4.0 // indirect
|
|
sigs.k8s.io/yaml v1.2.0 // indirect
|
|
)
|