Skip to content

Commit

Permalink
Allow device ID to be equal to 0 on OpenBSD (#1979)
Browse files Browse the repository at this point in the history
* Allow device ID to be equal to 0 on OpenBSD

* Use check_wait instead of check_kill_and_wait in certain Filebeat tests

In these tests the Filebeat process should die on its own due to the nature of the test cases. On OpenBSD python was failing due to `OSError: [Errno 3] No such process` and this fixes the issue.
  • Loading branch information
andrewkroh authored and ruflin committed Jul 6, 2016
1 parent 6460fce commit 4a3276d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
17 changes: 15 additions & 2 deletions filebeat/input/file/file_other_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package file
import (
"io/ioutil"
"os"
"runtime"
"testing"

"github.com/stretchr/testify/assert"
Expand All @@ -20,7 +21,13 @@ func TestGetOSFileState(t *testing.T) {
state := GetOSState(fileinfo)

assert.True(t, state.Inode > 0)
assert.True(t, state.Device > 0)

if runtime.GOOS == "openbsd" {
// The first device on OpenBSD has an ID of 0 so allow this.
assert.True(t, state.Device >= 0, "Device %d", state.Device)
} else {
assert.True(t, state.Device > 0, "Device %d", state.Device)
}
}

func TestGetOSFileStateStat(t *testing.T) {
Expand All @@ -33,5 +40,11 @@ func TestGetOSFileStateStat(t *testing.T) {
state := GetOSState(fileinfo)

assert.True(t, state.Inode > 0)
assert.True(t, state.Device > 0)

if runtime.GOOS == "openbsd" {
// The first device on OpenBSD has an ID of 0 so allow this.
assert.True(t, state.Device >= 0, "Device %d", state.Device)
} else {
assert.True(t, state.Device > 0, "Device %d", state.Device)
}
}
4 changes: 2 additions & 2 deletions filebeat/tests/system/test_prospector.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def test_shutdown_no_prospectors(self):
"Exiting"),
max_timeout=10)

filebeat.check_kill_and_wait(exit_code=1)
filebeat.check_wait(exit_code=1)

def test_no_paths_defined(self):
"""
Expand All @@ -274,7 +274,7 @@ def test_no_paths_defined(self):
"Exiting"),
max_timeout=10)

filebeat.check_kill_and_wait(exit_code=1)
filebeat.check_wait(exit_code=1)


def test_files_added_late(self):
Expand Down

0 comments on commit 4a3276d

Please sign in to comment.