2021-09-17 04:44:35 +00:00
|
|
|
package ntp
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
|
|
|
|
"github.com/authelia/authelia/v4/internal/configuration/schema"
|
|
|
|
"github.com/authelia/authelia/v4/internal/configuration/validator"
|
2021-09-17 09:53:59 +00:00
|
|
|
"github.com/authelia/authelia/v4/internal/logging"
|
2021-09-17 04:44:35 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestShouldCheckNTP(t *testing.T) {
|
|
|
|
config := schema.NTPConfiguration{
|
|
|
|
Address: "time.cloudflare.com:123",
|
|
|
|
Version: 4,
|
|
|
|
MaximumDesync: "3s",
|
|
|
|
DisableStartupCheck: false,
|
|
|
|
}
|
|
|
|
sv := schema.NewStructValidator()
|
|
|
|
validator.ValidateNTP(&config, sv)
|
|
|
|
|
2021-09-17 09:53:59 +00:00
|
|
|
ntp := NewProvider(&config)
|
2021-09-17 04:44:35 +00:00
|
|
|
|
2021-09-17 09:53:59 +00:00
|
|
|
assert.NoError(t, ntp.StartupCheck(logging.Logger()))
|
2021-09-17 04:44:35 +00:00
|
|
|
}
|