Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion x-pack/osquerybeat/internal/osqd/osqueryd.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func WithBinaryPath(binPath string) Option {

func WithConfigRefresh(refreshInterval int) Option {
return func(q *OSQueryD) {
q.extensionsTimeout = refreshInterval
q.configRefreshInterval = refreshInterval
}
}

Expand Down
48 changes: 48 additions & 0 deletions x-pack/osquerybeat/internal/osqd/osqueryd_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
// or more contributor license agreements. Licensed under the Elastic License;
// you may not use this file except in compliance with the Elastic License.

package osqd

import (
"testing"

"github.com/google/go-cmp/cmp"
)

func TestNew(t *testing.T) {

socketPath := "/var/run/foobar"

extensionsTimeout := 5
configurationRefreshIntervalSecs := 12
configPluginName := "config_plugin_test"
loggerPluginName := "logger_plugin_test"

osq := New(
socketPath,
WithExtensionsTimeout(extensionsTimeout),
WithConfigRefresh(configurationRefreshIntervalSecs),
WithConfigPlugin(configPluginName),
WithLoggerPlugin(loggerPluginName),
)

diff := cmp.Diff(extensionsTimeout, osq.extensionsTimeout)
if diff != "" {
t.Error(diff)
}

diff = cmp.Diff(configurationRefreshIntervalSecs, osq.configRefreshInterval)
if diff != "" {
t.Error(diff)
}
diff = cmp.Diff(configPluginName, osq.configPlugin)
if diff != "" {
t.Error(diff)
}

diff = cmp.Diff(loggerPluginName, osq.loggerPlugin)
if diff != "" {
t.Error(diff)
}
}