ctl_v2_test.go 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555
  1. // Copyright 2016 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. package e2e
  15. import (
  16. "io/ioutil"
  17. "os"
  18. "strings"
  19. "testing"
  20. "time"
  21. "go.etcd.io/etcd/pkg/fileutil"
  22. "go.etcd.io/etcd/pkg/testutil"
  23. )
  24. func TestCtlV2Set(t *testing.T) { testCtlV2Set(t, &configNoTLS, false) }
  25. func TestCtlV2SetQuorum(t *testing.T) { testCtlV2Set(t, &configNoTLS, true) }
  26. func TestCtlV2SetClientTLS(t *testing.T) { testCtlV2Set(t, &configClientTLS, false) }
  27. func TestCtlV2SetPeerTLS(t *testing.T) { testCtlV2Set(t, &configPeerTLS, false) }
  28. func TestCtlV2SetTLS(t *testing.T) { testCtlV2Set(t, &configTLS, false) }
  29. func testCtlV2Set(t *testing.T, cfg *etcdProcessClusterConfig, quorum bool) {
  30. os.Setenv("ETCDCTL_API", "2")
  31. defer os.Unsetenv("ETCDCTL_API")
  32. defer testutil.AfterTest(t)
  33. cfg.enableV2 = true
  34. epc := setupEtcdctlTest(t, cfg, quorum)
  35. defer func() {
  36. if errC := epc.Close(); errC != nil {
  37. t.Fatalf("error closing etcd processes (%v)", errC)
  38. }
  39. }()
  40. key, value := "foo", "bar"
  41. if err := etcdctlSet(epc, key, value); err != nil {
  42. t.Fatalf("failed set (%v)", err)
  43. }
  44. if err := etcdctlGet(epc, key, value, quorum); err != nil {
  45. t.Fatalf("failed get (%v)", err)
  46. }
  47. }
  48. func TestCtlV2Mk(t *testing.T) { testCtlV2Mk(t, &configNoTLS, false) }
  49. func TestCtlV2MkQuorum(t *testing.T) { testCtlV2Mk(t, &configNoTLS, true) }
  50. func TestCtlV2MkTLS(t *testing.T) { testCtlV2Mk(t, &configTLS, false) }
  51. func testCtlV2Mk(t *testing.T, cfg *etcdProcessClusterConfig, quorum bool) {
  52. os.Setenv("ETCDCTL_API", "2")
  53. defer os.Unsetenv("ETCDCTL_API")
  54. defer testutil.AfterTest(t)
  55. cfg.enableV2 = true
  56. epc := setupEtcdctlTest(t, cfg, quorum)
  57. defer func() {
  58. if errC := epc.Close(); errC != nil {
  59. t.Fatalf("error closing etcd processes (%v)", errC)
  60. }
  61. }()
  62. key, value := "foo", "bar"
  63. if err := etcdctlMk(epc, key, value, true); err != nil {
  64. t.Fatalf("failed mk (%v)", err)
  65. }
  66. if err := etcdctlMk(epc, key, value, false); err != nil {
  67. t.Fatalf("failed mk (%v)", err)
  68. }
  69. if err := etcdctlGet(epc, key, value, quorum); err != nil {
  70. t.Fatalf("failed get (%v)", err)
  71. }
  72. }
  73. func TestCtlV2Rm(t *testing.T) { testCtlV2Rm(t, &configNoTLS) }
  74. func TestCtlV2RmTLS(t *testing.T) { testCtlV2Rm(t, &configTLS) }
  75. func testCtlV2Rm(t *testing.T, cfg *etcdProcessClusterConfig) {
  76. os.Setenv("ETCDCTL_API", "2")
  77. defer os.Unsetenv("ETCDCTL_API")
  78. defer testutil.AfterTest(t)
  79. cfg.enableV2 = true
  80. epc := setupEtcdctlTest(t, cfg, true)
  81. defer func() {
  82. if errC := epc.Close(); errC != nil {
  83. t.Fatalf("error closing etcd processes (%v)", errC)
  84. }
  85. }()
  86. key, value := "foo", "bar"
  87. if err := etcdctlSet(epc, key, value); err != nil {
  88. t.Fatalf("failed set (%v)", err)
  89. }
  90. if err := etcdctlRm(epc, key, value, true); err != nil {
  91. t.Fatalf("failed rm (%v)", err)
  92. }
  93. if err := etcdctlRm(epc, key, value, false); err != nil {
  94. t.Fatalf("failed rm (%v)", err)
  95. }
  96. }
  97. func TestCtlV2Ls(t *testing.T) { testCtlV2Ls(t, &configNoTLS, false) }
  98. func TestCtlV2LsQuorum(t *testing.T) { testCtlV2Ls(t, &configNoTLS, true) }
  99. func TestCtlV2LsTLS(t *testing.T) { testCtlV2Ls(t, &configTLS, false) }
  100. func testCtlV2Ls(t *testing.T, cfg *etcdProcessClusterConfig, quorum bool) {
  101. os.Setenv("ETCDCTL_API", "2")
  102. defer os.Unsetenv("ETCDCTL_API")
  103. defer testutil.AfterTest(t)
  104. cfg.enableV2 = true
  105. epc := setupEtcdctlTest(t, cfg, quorum)
  106. defer func() {
  107. if errC := epc.Close(); errC != nil {
  108. t.Fatalf("error closing etcd processes (%v)", errC)
  109. }
  110. }()
  111. key, value := "foo", "bar"
  112. if err := etcdctlSet(epc, key, value); err != nil {
  113. t.Fatalf("failed set (%v)", err)
  114. }
  115. if err := etcdctlLs(epc, key, quorum); err != nil {
  116. t.Fatalf("failed ls (%v)", err)
  117. }
  118. }
  119. func TestCtlV2Watch(t *testing.T) { testCtlV2Watch(t, &configNoTLS, false) }
  120. func TestCtlV2WatchTLS(t *testing.T) { testCtlV2Watch(t, &configTLS, false) }
  121. func testCtlV2Watch(t *testing.T, cfg *etcdProcessClusterConfig, noSync bool) {
  122. os.Setenv("ETCDCTL_API", "2")
  123. defer os.Unsetenv("ETCDCTL_API")
  124. defer testutil.AfterTest(t)
  125. cfg.enableV2 = true
  126. epc := setupEtcdctlTest(t, cfg, true)
  127. defer func() {
  128. if errC := epc.Close(); errC != nil {
  129. t.Fatalf("error closing etcd processes (%v)", errC)
  130. }
  131. }()
  132. key, value := "foo", "bar"
  133. errc := etcdctlWatch(epc, key, value, noSync)
  134. if err := etcdctlSet(epc, key, value); err != nil {
  135. t.Fatalf("failed set (%v)", err)
  136. }
  137. select {
  138. case err := <-errc:
  139. if err != nil {
  140. t.Fatalf("failed watch (%v)", err)
  141. }
  142. case <-time.After(5 * time.Second):
  143. t.Fatalf("watch timed out")
  144. }
  145. }
  146. func TestCtlV2GetRoleUser(t *testing.T) {
  147. os.Setenv("ETCDCTL_API", "2")
  148. defer os.Unsetenv("ETCDCTL_API")
  149. defer testutil.AfterTest(t)
  150. copied := configNoTLS
  151. copied.enableV2 = true
  152. epc := setupEtcdctlTest(t, &copied, false)
  153. defer func() {
  154. if err := epc.Close(); err != nil {
  155. t.Fatalf("error closing etcd processes (%v)", err)
  156. }
  157. }()
  158. if err := etcdctlRoleAdd(epc, "foo"); err != nil {
  159. t.Fatalf("failed to add role (%v)", err)
  160. }
  161. if err := etcdctlUserAdd(epc, "username", "password"); err != nil {
  162. t.Fatalf("failed to add user (%v)", err)
  163. }
  164. if err := etcdctlUserGrant(epc, "username", "foo"); err != nil {
  165. t.Fatalf("failed to grant role (%v)", err)
  166. }
  167. if err := etcdctlUserGet(epc, "username"); err != nil {
  168. t.Fatalf("failed to get user (%v)", err)
  169. }
  170. // ensure double grant gives an error; was crashing in 2.3.1
  171. regrantArgs := etcdctlPrefixArgs(epc)
  172. regrantArgs = append(regrantArgs, "user", "grant", "--roles", "foo", "username")
  173. if err := spawnWithExpect(regrantArgs, "duplicate"); err != nil {
  174. t.Fatalf("missing duplicate error on double grant role (%v)", err)
  175. }
  176. }
  177. func TestCtlV2UserListUsername(t *testing.T) { testCtlV2UserList(t, "username") }
  178. func TestCtlV2UserListRoot(t *testing.T) { testCtlV2UserList(t, "root") }
  179. func testCtlV2UserList(t *testing.T, username string) {
  180. os.Setenv("ETCDCTL_API", "2")
  181. defer os.Unsetenv("ETCDCTL_API")
  182. defer testutil.AfterTest(t)
  183. copied := configNoTLS
  184. copied.enableV2 = true
  185. epc := setupEtcdctlTest(t, &copied, false)
  186. defer func() {
  187. if err := epc.Close(); err != nil {
  188. t.Fatalf("error closing etcd processes (%v)", err)
  189. }
  190. }()
  191. if err := etcdctlUserAdd(epc, username, "password"); err != nil {
  192. t.Fatalf("failed to add user (%v)", err)
  193. }
  194. if err := etcdctlUserList(epc, username); err != nil {
  195. t.Fatalf("failed to list users (%v)", err)
  196. }
  197. }
  198. func TestCtlV2RoleList(t *testing.T) {
  199. os.Setenv("ETCDCTL_API", "2")
  200. defer os.Unsetenv("ETCDCTL_API")
  201. defer testutil.AfterTest(t)
  202. copied := configNoTLS
  203. copied.enableV2 = true
  204. epc := setupEtcdctlTest(t, &copied, false)
  205. defer func() {
  206. if err := epc.Close(); err != nil {
  207. t.Fatalf("error closing etcd processes (%v)", err)
  208. }
  209. }()
  210. if err := etcdctlRoleAdd(epc, "foo"); err != nil {
  211. t.Fatalf("failed to add role (%v)", err)
  212. }
  213. if err := etcdctlRoleList(epc, "foo"); err != nil {
  214. t.Fatalf("failed to list roles (%v)", err)
  215. }
  216. }
  217. func TestCtlV2Backup(t *testing.T) { testCtlV2Backup(t, 0, false) }
  218. func TestCtlV2BackupSnapshot(t *testing.T) { testCtlV2Backup(t, 1, false) }
  219. func TestCtlV2BackupV3(t *testing.T) { testCtlV2Backup(t, 0, true) }
  220. func TestCtlV2BackupV3Snapshot(t *testing.T) { testCtlV2Backup(t, 1, true) }
  221. func testCtlV2Backup(t *testing.T, snapCount int, v3 bool) {
  222. os.Setenv("ETCDCTL_API", "2")
  223. defer os.Unsetenv("ETCDCTL_API")
  224. defer testutil.AfterTest(t)
  225. backupDir, err := ioutil.TempDir("", "testbackup0.etcd")
  226. if err != nil {
  227. t.Fatal(err)
  228. }
  229. defer os.RemoveAll(backupDir)
  230. etcdCfg := configNoTLS
  231. etcdCfg.snapshotCount = snapCount
  232. etcdCfg.enableV2 = true
  233. epc1 := setupEtcdctlTest(t, &etcdCfg, false)
  234. // v3 put before v2 set so snapshot happens after v3 operations to confirm
  235. // v3 data is preserved after snapshot.
  236. os.Setenv("ETCDCTL_API", "3")
  237. if err := ctlV3Put(ctlCtx{t: t, epc: epc1}, "v3key", "123", ""); err != nil {
  238. t.Fatal(err)
  239. }
  240. os.Setenv("ETCDCTL_API", "2")
  241. if err := etcdctlSet(epc1, "foo1", "bar1"); err != nil {
  242. t.Fatal(err)
  243. }
  244. if v3 {
  245. // v3 must lock the db to backup, so stop process
  246. if err := epc1.Stop(); err != nil {
  247. t.Fatal(err)
  248. }
  249. }
  250. if err := etcdctlBackup(epc1, epc1.procs[0].Config().dataDirPath, backupDir, v3); err != nil {
  251. t.Fatal(err)
  252. }
  253. if err := epc1.Close(); err != nil {
  254. t.Fatalf("error closing etcd processes (%v)", err)
  255. }
  256. // restart from the backup directory
  257. cfg2 := configNoTLS
  258. cfg2.dataDirPath = backupDir
  259. cfg2.keepDataDir = true
  260. cfg2.forceNewCluster = true
  261. cfg2.enableV2 = true
  262. epc2 := setupEtcdctlTest(t, &cfg2, false)
  263. // check if backup went through correctly
  264. if err := etcdctlGet(epc2, "foo1", "bar1", false); err != nil {
  265. t.Fatal(err)
  266. }
  267. os.Setenv("ETCDCTL_API", "3")
  268. ctx2 := ctlCtx{t: t, epc: epc2}
  269. if v3 {
  270. if err := ctlV3Get(ctx2, []string{"v3key"}, kv{"v3key", "123"}); err != nil {
  271. t.Fatal(err)
  272. }
  273. } else {
  274. if err := ctlV3Get(ctx2, []string{"v3key"}); err != nil {
  275. t.Fatal(err)
  276. }
  277. }
  278. os.Setenv("ETCDCTL_API", "2")
  279. // check if it can serve client requests
  280. if err := etcdctlSet(epc2, "foo2", "bar2"); err != nil {
  281. t.Fatal(err)
  282. }
  283. if err := etcdctlGet(epc2, "foo2", "bar2", false); err != nil {
  284. t.Fatal(err)
  285. }
  286. if err := epc2.Close(); err != nil {
  287. t.Fatalf("error closing etcd processes (%v)", err)
  288. }
  289. }
  290. func TestCtlV2AuthWithCommonName(t *testing.T) {
  291. os.Setenv("ETCDCTL_API", "2")
  292. defer os.Unsetenv("ETCDCTL_API")
  293. defer testutil.AfterTest(t)
  294. copiedCfg := configClientTLS
  295. copiedCfg.clientCertAuthEnabled = true
  296. copiedCfg.enableV2 = true
  297. epc := setupEtcdctlTest(t, &copiedCfg, false)
  298. defer func() {
  299. if err := epc.Close(); err != nil {
  300. t.Fatalf("error closing etcd processes (%v)", err)
  301. }
  302. }()
  303. if err := etcdctlRoleAdd(epc, "testrole"); err != nil {
  304. t.Fatalf("failed to add role (%v)", err)
  305. }
  306. if err := etcdctlRoleGrant(epc, "testrole", "--rw", "--path=/foo"); err != nil {
  307. t.Fatalf("failed to grant role (%v)", err)
  308. }
  309. if err := etcdctlUserAdd(epc, "root", "123"); err != nil {
  310. t.Fatalf("failed to add user (%v)", err)
  311. }
  312. if err := etcdctlUserAdd(epc, "Autogenerated CA", "123"); err != nil {
  313. t.Fatalf("failed to add user (%v)", err)
  314. }
  315. if err := etcdctlUserGrant(epc, "Autogenerated CA", "testrole"); err != nil {
  316. t.Fatalf("failed to grant role (%v)", err)
  317. }
  318. if err := etcdctlAuthEnable(epc); err != nil {
  319. t.Fatalf("failed to enable auth (%v)", err)
  320. }
  321. if err := etcdctlSet(epc, "foo", "bar"); err != nil {
  322. t.Fatalf("failed to write (%v)", err)
  323. }
  324. }
  325. func TestCtlV2ClusterHealth(t *testing.T) {
  326. os.Setenv("ETCDCTL_API", "2")
  327. defer os.Unsetenv("ETCDCTL_API")
  328. defer testutil.AfterTest(t)
  329. copied := configNoTLS
  330. copied.enableV2 = true
  331. epc := setupEtcdctlTest(t, &copied, true)
  332. defer func() {
  333. if err := epc.Close(); err != nil {
  334. t.Fatalf("error closing etcd processes (%v)", err)
  335. }
  336. }()
  337. // all members available
  338. if err := etcdctlClusterHealth(epc, "cluster is healthy"); err != nil {
  339. t.Fatalf("cluster-health expected to be healthy (%v)", err)
  340. }
  341. // missing members, has quorum
  342. epc.procs[0].Stop()
  343. for i := 0; i < 3; i++ {
  344. err := etcdctlClusterHealth(epc, "cluster is degraded")
  345. if err == nil {
  346. break
  347. } else if i == 2 {
  348. t.Fatalf("cluster-health expected to be degraded (%v)", err)
  349. }
  350. // possibly no leader yet; retry
  351. time.Sleep(time.Second)
  352. }
  353. // no quorum
  354. epc.procs[1].Stop()
  355. if err := etcdctlClusterHealth(epc, "cluster is unavailable"); err != nil {
  356. t.Fatalf("cluster-health expected to be unavailable (%v)", err)
  357. }
  358. epc.procs[0], epc.procs[1] = nil, nil
  359. }
  360. func etcdctlPrefixArgs(clus *etcdProcessCluster) []string {
  361. endpoints := strings.Join(clus.EndpointsV2(), ",")
  362. cmdArgs := []string{ctlBinPath, "--endpoints", endpoints}
  363. if clus.cfg.clientTLS == clientTLS {
  364. cmdArgs = append(cmdArgs, "--ca-file", caPath, "--cert-file", certPath, "--key-file", privateKeyPath)
  365. }
  366. return cmdArgs
  367. }
  368. func etcdctlClusterHealth(clus *etcdProcessCluster, val string) error {
  369. cmdArgs := append(etcdctlPrefixArgs(clus), "cluster-health")
  370. return spawnWithExpect(cmdArgs, val)
  371. }
  372. func etcdctlSet(clus *etcdProcessCluster, key, value string) error {
  373. cmdArgs := append(etcdctlPrefixArgs(clus), "set", key, value)
  374. return spawnWithExpect(cmdArgs, value)
  375. }
  376. func etcdctlMk(clus *etcdProcessCluster, key, value string, first bool) error {
  377. cmdArgs := append(etcdctlPrefixArgs(clus), "mk", key, value)
  378. if first {
  379. return spawnWithExpect(cmdArgs, value)
  380. }
  381. return spawnWithExpect(cmdArgs, "Error: 105: Key already exists")
  382. }
  383. func etcdctlGet(clus *etcdProcessCluster, key, value string, quorum bool) error {
  384. cmdArgs := append(etcdctlPrefixArgs(clus), "get", key)
  385. if quorum {
  386. cmdArgs = append(cmdArgs, "--quorum")
  387. }
  388. return spawnWithExpect(cmdArgs, value)
  389. }
  390. func etcdctlRm(clus *etcdProcessCluster, key, value string, first bool) error {
  391. cmdArgs := append(etcdctlPrefixArgs(clus), "rm", key)
  392. if first {
  393. return spawnWithExpect(cmdArgs, "PrevNode.Value: "+value)
  394. }
  395. return spawnWithExpect(cmdArgs, "Error: 100: Key not found")
  396. }
  397. func etcdctlLs(clus *etcdProcessCluster, key string, quorum bool) error {
  398. cmdArgs := append(etcdctlPrefixArgs(clus), "ls")
  399. if quorum {
  400. cmdArgs = append(cmdArgs, "--quorum")
  401. }
  402. return spawnWithExpect(cmdArgs, key)
  403. }
  404. func etcdctlWatch(clus *etcdProcessCluster, key, value string, noSync bool) <-chan error {
  405. cmdArgs := append(etcdctlPrefixArgs(clus), "watch", "--after-index=1", key)
  406. if noSync {
  407. cmdArgs = append(cmdArgs, "--no-sync")
  408. }
  409. errc := make(chan error, 1)
  410. go func() {
  411. errc <- spawnWithExpect(cmdArgs, value)
  412. }()
  413. return errc
  414. }
  415. func etcdctlRoleAdd(clus *etcdProcessCluster, role string) error {
  416. cmdArgs := append(etcdctlPrefixArgs(clus), "role", "add", role)
  417. return spawnWithExpect(cmdArgs, role)
  418. }
  419. func etcdctlRoleGrant(clus *etcdProcessCluster, role string, perms ...string) error {
  420. cmdArgs := append(etcdctlPrefixArgs(clus), "role", "grant")
  421. cmdArgs = append(cmdArgs, perms...)
  422. cmdArgs = append(cmdArgs, role)
  423. return spawnWithExpect(cmdArgs, role)
  424. }
  425. func etcdctlRoleList(clus *etcdProcessCluster, expectedRole string) error {
  426. cmdArgs := append(etcdctlPrefixArgs(clus), "role", "list")
  427. return spawnWithExpect(cmdArgs, expectedRole)
  428. }
  429. func etcdctlUserAdd(clus *etcdProcessCluster, user, pass string) error {
  430. cmdArgs := append(etcdctlPrefixArgs(clus), "user", "add", user+":"+pass)
  431. return spawnWithExpect(cmdArgs, "User "+user+" created")
  432. }
  433. func etcdctlUserGrant(clus *etcdProcessCluster, user, role string) error {
  434. cmdArgs := append(etcdctlPrefixArgs(clus), "user", "grant", "--roles", role, user)
  435. return spawnWithExpect(cmdArgs, "User "+user+" updated")
  436. }
  437. func etcdctlUserGet(clus *etcdProcessCluster, user string) error {
  438. cmdArgs := append(etcdctlPrefixArgs(clus), "user", "get", user)
  439. return spawnWithExpect(cmdArgs, "User: "+user)
  440. }
  441. func etcdctlUserList(clus *etcdProcessCluster, expectedUser string) error {
  442. cmdArgs := append(etcdctlPrefixArgs(clus), "user", "list")
  443. return spawnWithExpect(cmdArgs, expectedUser)
  444. }
  445. func etcdctlAuthEnable(clus *etcdProcessCluster) error {
  446. cmdArgs := append(etcdctlPrefixArgs(clus), "auth", "enable")
  447. return spawnWithExpect(cmdArgs, "Authentication Enabled")
  448. }
  449. func etcdctlBackup(clus *etcdProcessCluster, dataDir, backupDir string, v3 bool) error {
  450. cmdArgs := append(etcdctlPrefixArgs(clus), "backup", "--data-dir", dataDir, "--backup-dir", backupDir)
  451. if v3 {
  452. cmdArgs = append(cmdArgs, "--with-v3")
  453. }
  454. proc, err := spawnCmd(cmdArgs)
  455. if err != nil {
  456. return err
  457. }
  458. return proc.Close()
  459. }
  460. func mustEtcdctl(t *testing.T) {
  461. if !fileutil.Exist(binDir + "/etcdctl") {
  462. t.Fatalf("could not find etcdctl binary")
  463. }
  464. }
  465. func setupEtcdctlTest(t *testing.T, cfg *etcdProcessClusterConfig, quorum bool) *etcdProcessCluster {
  466. mustEtcdctl(t)
  467. if !quorum {
  468. cfg = configStandalone(*cfg)
  469. }
  470. epc, err := newEtcdProcessCluster(cfg)
  471. if err != nil {
  472. t.Fatalf("could not start etcd process cluster (%v)", err)
  473. }
  474. return epc
  475. }