Skip to content

Commit 9d9b3c5

Browse files
authored
add additional test cases to the host os info analyzer (#1754)
1 parent 3665d25 commit 9d9b3c5

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

Diff for: examples/sdk/helm-template/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ require (
3333
github.com/gogo/protobuf v1.3.2 // indirect
3434
github.com/golang/protobuf v1.5.4 // indirect
3535
github.com/google/gnostic-models v0.6.8 // indirect
36-
github.com/google/go-cmp v0.6.0 // indirect
36+
github.com/google/go-cmp v0.7.0 // indirect
3737
github.com/google/gofuzz v1.2.0 // indirect
3838
github.com/google/uuid v1.6.0 // indirect
3939
github.com/huandu/xstrings v1.5.0 // indirect

Diff for: examples/sdk/helm-template/go.sum

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYu
4343
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
4444
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
4545
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
46+
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
4647
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
4748
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
4849
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=

Diff for: pkg/analyze/host_os_info_test.go

+20
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,26 @@ func TestAnalyzeHostOSCheckCondition(t *testing.T) {
160160
expected: false,
161161
expectErr: false,
162162
},
163+
{
164+
name: "multiple conditionals, outside the three",
165+
conditional: "redhat >= 8 && < 9 || == 9.1.0",
166+
osInfo: collect.HostOSInfo{
167+
Platform: "redhat",
168+
PlatformVersion: "9.2",
169+
},
170+
expected: false,
171+
expectErr: false,
172+
},
173+
{
174+
name: "multiple conditionals, matches the third",
175+
conditional: "redhat >= 8 && < 9 || == 9.2.0",
176+
osInfo: collect.HostOSInfo{
177+
Platform: "redhat",
178+
PlatformVersion: "9.2",
179+
},
180+
expected: true,
181+
expectErr: false,
182+
},
163183
}
164184

165185
for _, test := range tests {

0 commit comments

Comments
 (0)