mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00

ExpectProcess and ExpectFunc now take the exit code of the process into account, not just the matching of the tty output. This also refactors the many tests that were previously succeeding on matching an output from a failing cmd execution. Signed-off-by: Thomas Jungblut <tjungblu@redhat.com>
46 lines
1.5 KiB
Go
46 lines
1.5 KiB
Go
// Copyright 2021 The etcd Authors
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
package e2e
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"go.etcd.io/etcd/tests/v3/framework/e2e"
|
|
)
|
|
|
|
func TestInitDaemonNotifyWithoutQuorum(t *testing.T) {
|
|
// Initialize a cluster with 3 members
|
|
epc, err := e2e.InitEtcdProcessCluster(t, e2e.NewConfigAutoTLS())
|
|
if err != nil {
|
|
t.Fatalf("Failed to initilize the etcd cluster: %v", err)
|
|
}
|
|
|
|
defer epc.Close()
|
|
|
|
// Remove two members, so that only one etcd will get started
|
|
epc.Procs = epc.Procs[:1]
|
|
|
|
// Start the etcd cluster with only one member
|
|
if err := epc.Start(context.TODO()); err != nil {
|
|
t.Fatalf("Failed to start the etcd cluster: %v", err)
|
|
}
|
|
|
|
// Expect log message indicating time out waiting for quorum hit
|
|
e2e.AssertProcessLogs(t, epc.Procs[0], "startEtcd: timed out waiting for the ready notification")
|
|
// Expect log message indicating systemd notify message has been sent
|
|
e2e.AssertProcessLogs(t, epc.Procs[0], "notifying init daemon")
|
|
}
|