We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If you do not configure the cert file, you can connect to etcd for access
Unable to connect to etcd
Set tls to nil
func createEtcdClient() (api.Client, error) { etcdConfig := apiconfig.EtcdConfig{ EtcdEndpoints: "127.0.0.1:2379", } etcdV3Client, err := etcdv3.NewEtcdV3Client(&etcdConfig) if err != nil { return nil, err } return etcdV3Client, nil } func TestEtcdV3Client(t *testing.T) { tests := []struct { name string cidr string nodeName string expectValue model.BlockAffinity }{ { name: "test1", cidr: "1.1.1.1/26", nodeName: "node1", expectValue: model.BlockAffinity{ State: "confirmed", Deleted: false, }, }, } cli, err := createEtcdClient() if err != nil { t.Errorf("connect to etcd failed, err:%v\n", err) } ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) for _, test := range tests { t.Run(test.name, func(t *testing.T) { _, cidr, err := net.ParseCIDR(test.cidr) if err != nil { t.Fatalf("Failed to parse CIDR: %v", err) } key := model.BlockAffinityKey{ Host: test.nodeName, CIDR: *cidr, } get, err := cli.Get(ctx, key, "") if err != nil { fmt.Printf("create from etcd failed, err:%v\n", err) return } value, ok := get.Value.(*model.BlockAffinity) if !ok { t.Errorf("Value is not BlockAffinity, err:%v\n", err) } assert.Equal(t, test.expectValue.State, value.State) assert.Equal(t, test.expectValue.Deleted, value.Deleted) }) } cancel() }
=== RUN TestEtcdV3Client --- PASS: TestEtcdV3Client (5.01s) === RUN TestEtcdV3Client/test1 {"level":"warn","ts":"2025-02-21T16:27:41.989034+0800","logger":"etcd-client","caller":"v3/retry_interceptor.go:63","msg":"retrying of unary invoker failed","target":"etcd-endpoints://0x1400036a5a0/127.0.0.1:2379","attempt":0,"error":"rpc error: code = DeadlineExceeded desc = latest balancer error: last connection error: connection error: desc = \"transport: authentication handshake failed: EOF\""} create from etcd failed, err:context deadline exceeded --- PASS: TestEtcdV3Client/test1 (5.00s) PASS
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Expected Behavior
If you do not configure the cert file, you can connect to etcd for access
Current Behavior
Unable to connect to etcd
Possible Solution
Set tls to nil
Steps to Reproduce (for bugs)
Context
Your Environment
The text was updated successfully, but these errors were encountered: