-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…6740) * Fix the configuration poll interval setting * Unit tests (cherry picked from commit 1e4971f) Co-authored-by: Aleksandr Maus <aleksandr.maus@elastic.co>
- Loading branch information
1 parent
0592c19
commit 8de032b
Showing
2 changed files
with
49 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} |