vitess.io/vitess@v0.16.2/go/vt/zkctl/zkctl_test.go (about) 1 /* 2 Copyright 2019 The Vitess Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package zkctl 18 19 import ( 20 "testing" 21 ) 22 23 // This test depend on starting and stopping a ZK instance, 24 // but may leave files/processes behind if they don't succeed, 25 // so some manual cleanup may be required. 26 27 func TestLifeCycle(t *testing.T) { 28 if testing.Short() { 29 t.Skip("skipping integration test in short mode.") 30 } 31 32 config := "255@voltron:2888:3888:2181" 33 myID := 255 34 35 zkConf := MakeZkConfigFromString(config, uint32(myID)) 36 zkd := NewZkd(zkConf) 37 if err := zkd.Init(); err != nil { 38 t.Fatalf("Init() err: %v", err) 39 } 40 41 if err := zkd.Shutdown(); err != nil { 42 t.Fatalf("Shutdown() err: %v", err) 43 } 44 45 if err := zkd.Start(); err != nil { 46 t.Fatalf("Start() err: %v", err) 47 } 48 49 if err := zkd.Teardown(); err != nil { 50 t.Fatalf("Teardown() err: %v", err) 51 } 52 }