Skip to content

Commit f5b073a

Browse files
committed
alternative
1 parent 736bc1b commit f5b073a

File tree

1 file changed

+6
-21
lines changed

1 file changed

+6
-21
lines changed

pkg/acquisition/config_test.go

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -52,21 +52,6 @@ func wantErrFromYAML(t *testing.T, fileContent []byte) (want string, found bool)
5252
return strings.TrimSpace(string(m[1])), true
5353
}
5454

55-
func shouldSkip(t *testing.T, parsed *ParsedSourceConfig, gotErr error) bool {
56-
t.Helper()
57-
58-
if parsed == nil {
59-
return false
60-
}
61-
62-
// not supported in windows and will raise an error we are ignoring here.
63-
if parsed.Common.Source == "journalctl" && runtime.GOOS == "windows" && strings.Contains(gotErr.Error(), "executable file not found") {
64-
return true
65-
}
66-
67-
return false
68-
}
69-
7055
func TestParseSourceConfig(t *testing.T) {
7156
ctx := t.Context()
7257

@@ -93,14 +78,16 @@ func TestParseSourceConfig(t *testing.T) {
9378
require.NoError(t, err, "read %q", path)
9479

9580
t.Run(filepath.ToSlash(rel), func(t *testing.T) {
81+
if runtime.GOOS == "windows" && strings.Contains(path, "journalctl") {
82+
return
83+
}
84+
9685
wantErr, hasWant := wantErrFromYAML(t, fileContent)
9786

9887
if s.expectValid {
9988
require.False(t, hasWant, "valid config must not include # wantErr: directive")
10089
parsed, err := ParseSourceConfig(ctx, fileContent, metrics.AcquisitionMetricsLevelNone, nil)
101-
if shouldSkip(t, parsed, err) {
102-
return
103-
}
90+
require.NotNil(t, parsed)
10491
require.NoError(t, err)
10592
return
10693
}
@@ -111,9 +98,7 @@ func TestParseSourceConfig(t *testing.T) {
11198
require.NotEmpty(t, wantErr, "wantErr directive found but empty")
11299

113100
parsed, err := ParseSourceConfig(ctx, fileContent, metrics.AcquisitionMetricsLevelNone, nil)
114-
if shouldSkip(t, parsed, err) {
115-
return
116-
}
101+
require.Nil(t, parsed)
117102
require.Error(t, err, "got no error, expected %q", wantErr)
118103
assert.Equal(t, wantErr, err.Error())
119104
})

0 commit comments

Comments
 (0)