Ejemplo n.º 1
0
func TestAll(t *testing.T) {

	s1 := &TestStarter{}
	s2 := &TestStarter{}
	s3 := &TestStarter{}

	errs := start.All(s1, s2, s3)
	require.Equal(t, 0, len(errs))

	require.True(t, s1.running)
	require.True(t, s2.running)
	require.True(t, s3.running)

}
Ejemplo n.º 2
0
func TestStopAll(t *testing.T) {

	s1 := &TestStarter{}
	s2 := &TestStarter{}
	s3 := &ErrorStarter{}

	start.All(s1, s2, s3)

	<-start.StopAll(1*time.Second, s1, s2, s3)

	require.False(t, s1.running)
	require.False(t, s2.running)
	require.False(t, s3.running)

}
Ejemplo n.º 3
0
func TestAllErr(t *testing.T) {

	s1 := &TestStarter{}
	s2 := &TestStarter{}
	s3 := &ErrorStarter{}

	errs := start.All(s1, s2, s3)
	require.Equal(t, 1, len(errs))

	require.Equal(t, errs[s3].Error(), "something went wrong")

	require.True(t, s1.running)
	require.True(t, s2.running)
	require.False(t, s3.running)

}