github.com/lfch/etcd-io/tests/v3@v3.0.0-20221004140520-eac99acd3e9d/functional/cmd/etcd-tester/etcd_tester_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 // etcd-tester is a program that runs functional-tester client. 16 package main 17 18 import ( 19 "flag" 20 "testing" 21 22 "github.com/lfch/etcd-io/client/pkg/v3/testutil" 23 "github.com/lfch/etcd-io/tests/v3/functional/tester" 24 "go.uber.org/zap" 25 "go.uber.org/zap/zapcore" 26 "go.uber.org/zap/zaptest" 27 ) 28 29 var config = flag.String("config", "../../functional.yaml", "path to tester configuration") 30 31 func TestFunctional(t *testing.T) { 32 testutil.SkipTestIfShortMode(t, "functional tests are skipped in --short mode") 33 34 lg := zaptest.NewLogger(t, zaptest.Level(zapcore.InfoLevel)).Named("tester") 35 36 clus, err := tester.NewCluster(lg, *config) 37 if err != nil { 38 t.Fatalf("failed to create a cluster: %v", err) 39 } 40 41 if err = clus.Send_INITIAL_START_ETCD(); err != nil { 42 t.Fatal("Bootstrap failed", zap.Error(err)) 43 } 44 defer clus.Send_SIGQUIT_ETCD_AND_REMOVE_DATA_AND_STOP_AGENT() 45 46 t.Log("wait health after bootstrap") 47 if err = clus.WaitHealth(); err != nil { 48 t.Fatal("WaitHealth failed", zap.Error(err)) 49 } 50 51 clus.Run(t) 52 }