Skip to content

Commit

Permalink
Unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksmaus committed Jul 6, 2021
1 parent c6d7d4e commit b7876e3
Showing 1 changed file with 48 additions and 0 deletions.
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)
}
}

0 comments on commit b7876e3

Please sign in to comment.