github.com/lfch/etcd-io/tests/v3@v3.0.0-20221004140520-eac99acd3e9d/functional/rpcpb/etcd_config_test.go (about) 1 // Copyright 2018 The etcd Authors 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package rpcpb 16 17 import ( 18 "reflect" 19 "testing" 20 ) 21 22 func TestEtcd(t *testing.T) { 23 e := &Etcd{ 24 Name: "s1", 25 DataDir: "/tmp/etcd-functionl-1/etcd.data", 26 WALDir: "/tmp/etcd-functionl-1/etcd.data/member/wal", 27 28 HeartbeatIntervalMs: 100, 29 ElectionTimeoutMs: 1000, 30 31 ListenClientURLs: []string{"https://127.0.0.1:1379"}, 32 AdvertiseClientURLs: []string{"https://127.0.0.1:13790"}, 33 ClientAutoTLS: true, 34 ClientCertAuth: false, 35 ClientCertFile: "", 36 ClientKeyFile: "", 37 ClientTrustedCAFile: "", 38 39 ListenPeerURLs: []string{"https://127.0.0.1:1380"}, 40 AdvertisePeerURLs: []string{"https://127.0.0.1:13800"}, 41 PeerAutoTLS: true, 42 PeerClientCertAuth: false, 43 PeerCertFile: "", 44 PeerKeyFile: "", 45 PeerTrustedCAFile: "", 46 47 InitialCluster: "s1=https://127.0.0.1:13800,s2=https://127.0.0.1:23800,s3=https://127.0.0.1:33800", 48 InitialClusterState: "new", 49 InitialClusterToken: "tkn", 50 51 SnapshotCount: 10000, 52 QuotaBackendBytes: 10740000000, 53 54 PreVote: true, 55 InitialCorruptCheck: true, 56 57 Logger: "zap", 58 LogOutputs: []string{"/tmp/etcd-functional-1/etcd.log"}, 59 LogLevel: "info", 60 SocketReuseAddress: true, 61 SocketReusePort: true, 62 } 63 64 exps := []string{ 65 "--name=s1", 66 "--data-dir=/tmp/etcd-functionl-1/etcd.data", 67 "--wal-dir=/tmp/etcd-functionl-1/etcd.data/member/wal", 68 "--heartbeat-interval=100", 69 "--election-timeout=1000", 70 "--listen-client-urls=https://127.0.0.1:1379", 71 "--advertise-client-urls=https://127.0.0.1:13790", 72 "--auto-tls=true", 73 "--client-cert-auth=false", 74 "--listen-peer-urls=https://127.0.0.1:1380", 75 "--initial-advertise-peer-urls=https://127.0.0.1:13800", 76 "--peer-auto-tls=true", 77 "--peer-client-cert-auth=false", 78 "--initial-cluster=s1=https://127.0.0.1:13800,s2=https://127.0.0.1:23800,s3=https://127.0.0.1:33800", 79 "--initial-cluster-state=new", 80 "--initial-cluster-token=tkn", 81 "--snapshot-count=10000", 82 "--quota-backend-bytes=10740000000", 83 "--pre-vote=true", 84 "--experimental-initial-corrupt-check=true", 85 "--logger=zap", 86 "--log-outputs=/tmp/etcd-functional-1/etcd.log", 87 "--log-level=info", 88 "--socket-reuse-address=true", 89 "--socket-reuse-port=true", 90 } 91 fs := e.Flags() 92 if !reflect.DeepEqual(exps, fs) { 93 t.Fatalf("expected %q, got %q", exps, fs) 94 } 95 }