mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
Fix HighAvailability suite randomness.
This commit is contained in:
parent
3d20142292
commit
6f1ec2094d
|
@ -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())
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user