Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,19 @@ import (
"github.com/antithesishq/antithesis-sdk-go/random"

clientv3 "go.etcd.io/etcd/client/v3"
"go.etcd.io/etcd/tests/v3/robustness/client"
"go.etcd.io/etcd/tests/v3/robustness/identity"
)

func Connect() *clientv3.Client {
func Connect() *client.RecordingClient {
// This function returns a client connection to an etcd node

hosts := [][]string{{"etcd0:2379"}, {"etcd1:2379"}, {"etcd2:2379"}}
host := random.RandomChoice(hosts)
cli, err := clientv3.New(clientv3.Config{
Endpoints: host,
DialTimeout: 5 * time.Second,
})
hosts := []string{"etcd0:2379", "etcd1:2379", "etcd2:2379"}
cli, err := client.NewRecordingClient(hosts, identity.NewIDProvider(), time.Now())
if err != nil {
log.Fatalf("Failed to connect to etcd: %v", err)
// Antithesis Assertion: client should always be able to connect to an etcd host
host := random.RandomChoice(hosts)
assert.Unreachable("Client failed to connect to an etcd host", map[string]any{"host": host, "error": err})
os.Exit(1)
}
Expand Down