5083328751c013f64038e046ce541e366001f53e — Sam Whited 9 months ago bdb9a80
internal/integration/ejabberd: wait after stop

The "ejabberdctl stop" command was run asynchronously which was causing
a race condition that would sometimes cause the next tests to fail with
an error about ejabberd already being started.
Block until its completely stopped with a second call to the
"ejabberdctl stopped" command.

This doesn't appear to actually fix the issue (on FreeBSD at least), but
it should be done either way and will likely help.

Signed-off-by: Sam Whited <sam@samwhited.com>
1 files changed, 7 insertions(+), 1 deletions(-)

M internal/integration/ejabberd/ejabberd.go
M internal/integration/ejabberd/ejabberd.go => internal/integration/ejabberd/ejabberd.go +7 -1
@@ 211,6 211,12 @@ func CreateUser(ctx context.Context, addr, pass string) integration.Option {
// When all subtests have completed, the daemon is stopped.
func Test(ctx context.Context, t *testing.T, opts ...integration.Option) integration.SubtestRunner {
	opts = append(opts, defaultConfig, inetrcFile, foreground,
		integration.Shutdown(ctlFunc(ctx, "stop")))
		integration.Shutdown(func(cmd *integration.Cmd) error {
			err := ctlFunc(ctx, "stop")(cmd)
			if err != nil {
				return err
			return ctlFunc(ctx, "stopped")(cmd)
	return integration.Test(ctx, cmdName, t, opts...)