Fix HighAvailability suite randomness.

pull/482/head
Clement Michaud 2019-12-08 13:16:13 +01:00 committed by Clément Michaud
parent 3d20142292
commit 6f1ec2094d
2 changed files with 7 additions and 21 deletions

View File

@ -4,7 +4,6 @@ import (
"context"
"fmt"
"net/http"
"strings"
"testing"
"time"
@ -64,30 +63,17 @@ func (s *HighAvailabilityWebDriverSuite) TestShouldKeepUserDataInDB() {
}
func (s *HighAvailabilityWebDriverSuite) TestShouldKeepSessionAfterAutheliaRestart() {
ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
defer cancel()
secret := s.doRegisterAndLogin2FA(ctx, s.T(), "john", "password", false, "")
s.verifyIsSecondFactorPage(ctx, s.T())
err := haDockerEnvironment.Restart("authelia-backend")
s.Assert().NoError(err)
s.Require().NoError(err)
loop := true
for loop {
logs, err := haDockerEnvironment.Logs("authelia-backend", []string{"--tail", "10"})
s.Assert().NoError(err)
select {
case <-time.After(1 * time.Second):
if strings.Contains(logs, "Authelia is listening on :9091") {
loop = false
}
break
case <-ctx.Done():
loop = false
break
}
}
err = waitUntilAutheliaBackendIsReady(haDockerEnvironment)
s.Require().NoError(err)
s.doVisit(s.T(), HomeBaseURL)
s.verifyIsHome(ctx, s.T())

View File

@ -4,7 +4,7 @@ import (
"context"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/tebeka/selenium"
)
@ -18,5 +18,5 @@ func (wds *WebDriverSession) verifyURLIs(ctx context.Context, t *testing.T, url
return currentURL == url, nil
})
assert.NoError(t, err)
require.NoError(t, err)
}