@@ -26,30 +26,36 @@ def install
2626 end
2727
2828 test do
29- ENV [ "ETCDCTL_API" ] = "2 "
29+ ENV [ "ETCDCTL_API" ] = "3 "
3030 etcd_server = "localhost:#{ free_port } "
31+ peer_port = free_port
3132 cell = "testcell"
3233
3334 fork do
34- exec Formula [ "etcd" ] . opt_bin /"etcd" , "--enable-v2=true" ,
35- "--data-dir=#{ testpath } /etcd" ,
36- "--listen-client-urls=http://#{ etcd_server } " ,
37- "--advertise-client-urls=http://#{ etcd_server } "
35+ exec Formula [ "etcd" ] . opt_bin /"etcd" ,
36+ "--name=vitess_test" ,
37+ "--data-dir=#{ testpath } /etcd" ,
38+ "--listen-client-urls=http://#{ etcd_server } " ,
39+ "--advertise-client-urls=http://#{ etcd_server } " ,
40+ "--listen-peer-urls=http://localhost:#{ peer_port } " ,
41+ "--initial-advertise-peer-urls=http://localhost:#{ peer_port } " ,
42+ "--initial-cluster=vitess_test=http://localhost:#{ peer_port } " ,
43+ "--auto-compaction-retention=1"
3844 end
45+
3946 sleep 3
4047
41- fork do
42- exec Formula [ "etcd" ] . opt_bin /"etcdctl" , "--endpoints" , "http://#{ etcd_server } " ,
43- "mkdir" , testpath /"global"
44- end
45- sleep 1
48+ # Test etcd is responding before continuing
49+ system Formula [ "etcd" ] . opt_bin /"etcdctl" , "--endpoints" , "http://#{ etcd_server } " , "endpoint" , "health"
4650
47- fork do
48- exec Formula [ "etcd" ] . opt_bin /"etcdctl" , "--endpoints" , "http://#{ etcd_server } " ,
49- "mkdir" , testpath /cell
50- end
51- sleep 1
51+ # Create necessary directory structure using etcd v3 API
52+ system Formula [ "etcd" ] . opt_bin /"etcdctl" , "--endpoints" , "http://#{ etcd_server } " ,
53+ "put" , "/vitess/global" , ""
54+
55+ system Formula [ "etcd" ] . opt_bin /"etcdctl" , "--endpoints" , "http://#{ etcd_server } " ,
56+ "put" , "/vitess/#{ cell } " , ""
5257
58+ # Run vtctl with etcd2 implementation but using etcd v3 API
5359 fork do
5460 exec bin /"vtctl" , "--topo_implementation" , "etcd2" ,
5561 "--topo_global_server_address" , etcd_server ,
0 commit comments