2023-06-01 06:43:35 -07:00
|
|
|
package elect_test
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"testing"
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
|
)
|
|
|
|
|
|
2023-06-04 10:43:32 -07:00
|
|
|
func TestOne(t *testing.T) {
|
2023-06-01 06:43:35 -07:00
|
|
|
t.Parallel()
|
|
|
|
|
|
2023-06-04 10:43:32 -07:00
|
|
|
ts := NewTestSystem(t, 1)
|
2023-06-04 10:31:26 -07:00
|
|
|
defer ts.Stop()
|
2023-06-01 06:43:35 -07:00
|
|
|
|
2023-06-04 10:43:32 -07:00
|
|
|
require.Eventually(t, ts.Candidate(0).IsLeader, 15*time.Second, 100*time.Millisecond)
|
2023-06-01 06:43:35 -07:00
|
|
|
}
|