mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
server: Move fatal calls out of internal function to make stacktrace cleaner
This commit is contained in:
parent
75449c075d
commit
7b04674d17
@ -104,28 +104,33 @@ func stopEtcd(t *testing.T, ep e2e.EtcdProcess) {
|
|||||||
func validateVersion(t *testing.T, epc *e2e.EtcdProcessCluster, expect version.Versions) {
|
func validateVersion(t *testing.T, epc *e2e.EtcdProcessCluster, expect version.Versions) {
|
||||||
t.Log("Validate version")
|
t.Log("Validate version")
|
||||||
// Two separate calls to expect as it doesn't support multiple matches on the same line
|
// Two separate calls to expect as it doesn't support multiple matches on the same line
|
||||||
|
var err error
|
||||||
testutils.ExecuteWithTimeout(t, 20*time.Second, func() {
|
testutils.ExecuteWithTimeout(t, 20*time.Second, func() {
|
||||||
if expect.Server != "" {
|
if expect.Server != "" {
|
||||||
err := e2e.SpawnWithExpects(e2e.CURLPrefixArgs(epc.Cfg, epc.Procs[rand.Intn(epc.Cfg.ClusterSize)], "GET", e2e.CURLReq{Endpoint: "/version"}), nil, `"etcdserver":"`+expect.Server)
|
err = e2e.SpawnWithExpects(e2e.CURLPrefixArgs(epc.Cfg, epc.Procs[rand.Intn(epc.Cfg.ClusterSize)], "GET", e2e.CURLReq{Endpoint: "/version"}), nil, `"etcdserver":"`+expect.Server)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if expect.Cluster != "" {
|
if expect.Cluster != "" {
|
||||||
err := e2e.SpawnWithExpects(e2e.CURLPrefixArgs(epc.Cfg, epc.Procs[rand.Intn(epc.Cfg.ClusterSize)], "GET", e2e.CURLReq{Endpoint: "/version"}), nil, `"etcdcluster":"`+expect.Cluster)
|
err = e2e.SpawnWithExpects(e2e.CURLPrefixArgs(epc.Cfg, epc.Procs[rand.Intn(epc.Cfg.ClusterSize)], "GET", e2e.CURLReq{Endpoint: "/version"}), nil, `"etcdcluster":"`+expect.Cluster)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func expectLog(t *testing.T, epc *e2e.EtcdProcessCluster, expectLog string) {
|
func expectLog(t *testing.T, epc *e2e.EtcdProcessCluster, expectLog string) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
|
var err error
|
||||||
testutils.ExecuteWithTimeout(t, 30*time.Second, func() {
|
testutils.ExecuteWithTimeout(t, 30*time.Second, func() {
|
||||||
_, err := epc.Procs[0].Logs().Expect(expectLog)
|
_, err = epc.Procs[0].Logs().Expect(expectLog)
|
||||||
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user