2023-01-12 10:57:44 +00:00
|
|
|
package suites
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
var multiCookieDomainSuiteName = "MultiCookieDomain"
|
|
|
|
|
|
|
|
var multiCookieDomainDockerEnvironment = NewDockerEnvironment([]string{
|
|
|
|
"internal/suites/docker-compose.yml",
|
|
|
|
"internal/suites/MultiCookieDomain/docker-compose.yml",
|
|
|
|
"internal/suites/example/compose/authelia/docker-compose.backend.{}.yml",
|
|
|
|
"internal/suites/example/compose/authelia/docker-compose.frontend.{}.yml",
|
|
|
|
"internal/suites/example/compose/nginx/backend/docker-compose.yml",
|
|
|
|
"internal/suites/example/compose/nginx/portal/docker-compose.yml",
|
|
|
|
"internal/suites/example/compose/smtp/docker-compose.yml",
|
|
|
|
})
|
|
|
|
|
|
|
|
func init() {
|
2023-02-26 02:22:22 +00:00
|
|
|
setup := func(suitePath string) (err error) {
|
|
|
|
if err = multiCookieDomainDockerEnvironment.Up(); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
if err = waitUntilAutheliaIsReady(multiCookieDomainDockerEnvironment, multiCookieDomainSuiteName); err != nil {
|
2023-01-12 10:57:44 +00:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2023-02-26 02:22:22 +00:00
|
|
|
return updateDevEnvFileForDomain(BaseDomain, true)
|
2023-01-12 10:57:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
displayAutheliaLogs := func() error {
|
|
|
|
backendLogs, err := multiCookieDomainDockerEnvironment.Logs("authelia-backend", nil)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
fmt.Println(backendLogs)
|
|
|
|
|
|
|
|
frontendLogs, err := multiCookieDomainDockerEnvironment.Logs("authelia-frontend", nil)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
fmt.Println(frontendLogs)
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
teardown := func(suitePath string) error {
|
|
|
|
err := multiCookieDomainDockerEnvironment.Down()
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
GlobalRegistry.Register(multiCookieDomainSuiteName, Suite{
|
|
|
|
SetUp: setup,
|
|
|
|
SetUpTimeout: 5 * time.Minute,
|
|
|
|
OnError: displayAutheliaLogs,
|
|
|
|
OnSetupTimeout: displayAutheliaLogs,
|
|
|
|
TearDown: teardown,
|
|
|
|
TestTimeout: 4 * time.Minute,
|
|
|
|
TearDownTimeout: 2 * time.Minute,
|
|
|
|
Description: `This suite is used to test Authelia in a multi cookie domain
|
|
|
|
configuration with in-memory sessions and a local sqlite db stored on disk`,
|
|
|
|
})
|
|
|
|
}
|