Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NR-170460: fix default NTP timeout to 5 seconds #1744

Merged
merged 2 commits into from Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions pkg/config/defaults.go
Expand Up @@ -35,7 +35,7 @@ const (

// Default configurable values
//
//nolint:gochecknoglobals
//nolint:gochecknoglobals,gomnd
var (
// public
DefaultContainerCacheMetadataLimit = 60
Expand Down Expand Up @@ -111,8 +111,8 @@ var (
defaultRegisterMaxRetryBoSecs = 60
defaultNtpPool = []string{} // i.e: []string{"time.cloudflare.com"}
defaultNtpEnabled = false
defaultNtpInterval = uint(15) // minutes
defaultNtpTimeout = uint(5000) // millisecods
defaultNtpInterval = uint(15) // minutes
defaultNtpTimeout = uint(5) // seconds
)

// Default internal values
Expand Down
2 changes: 1 addition & 1 deletion pkg/metrics/host_test.go
Expand Up @@ -11,7 +11,7 @@ import (
)

func TestHostSample_CachedNtpOffset(t *testing.T) {
timeout := uint(5000)
timeout := uint(5)
interval := uint(15)
ntpMonitor := NewNtp([]string{"one"}, timeout, interval)
ntpMonitor.ntpQuery = ntpQueryMock([]ntpResp{
Expand Down
10 changes: 5 additions & 5 deletions pkg/metrics/ntp_test.go
Expand Up @@ -155,7 +155,7 @@ func TestOffset_Interval(t *testing.T) {
}

func TestOffset_OffsetAverage(t *testing.T) {
timeout := uint(5000)
timeout := uint(5)
interval := uint(15)
ntpMonitor := NewNtp([]string{"one", "two", "three"}, timeout, interval)
ntpMonitor.ntpQuery = ntpQueryMock([]ntpResp{
Expand All @@ -179,7 +179,7 @@ func TestOffset_OffsetAverage(t *testing.T) {
}

func TestOffset_AnyHostErrorShouldNotReturnError(t *testing.T) {
timeout := uint(5000)
timeout := uint(5)
interval := uint(15)
ntpMonitor := NewNtp([]string{"one", "two", "three"}, timeout, interval)
ntpMonitor.ntpQuery = ntpQueryMock([]ntpResp{
Expand All @@ -202,7 +202,7 @@ func TestOffset_AnyHostErrorShouldNotReturnError(t *testing.T) {
}

func TestOffset_AllHostErrorShouldReturnError(t *testing.T) {
timeout := uint(5000)
timeout := uint(5)
interval := uint(15)
ntpMonitor := NewNtp([]string{"one", "two", "three"}, timeout, interval)
ntpMonitor.ntpQuery = ntpQueryMock([]ntpResp{
Expand All @@ -225,7 +225,7 @@ func TestOffset_AllHostErrorShouldReturnError(t *testing.T) {
func TestOffset_InvalidNtpResponse(t *testing.T) {
t.Parallel()

timeout := uint(5000)
timeout := uint(5)
interval := uint(15)
ntpMonitor := NewNtp([]string{"one", "two", "three"}, timeout, interval)
ntpMonitor.ntpQuery = ntpQueryMock([]ntpResp{
Expand All @@ -251,7 +251,7 @@ func TestOffset_InvalidNtpResponse(t *testing.T) {
func TestOffset_AnyHostInvalidShouldNotReturnError(t *testing.T) {
t.Parallel()

timeout := uint(5000)
timeout := uint(5)
interval := uint(15)
ntpMonitor := NewNtp([]string{"one", "two", "three"}, timeout, interval)
ntpMonitor.ntpQuery = ntpQueryMock([]ntpResp{
Expand Down