Skip to content

Commit

Permalink
Replace gingko testing with go test - review comments addressed
Browse files Browse the repository at this point in the history
Signed-off-by: jubittajohn <jujohn@redhat.com>
  • Loading branch information
jubittajohn committed Jun 5, 2023
1 parent 144cbd6 commit a269e9e
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions internal/resolution/resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ func TestOperatorResolver(t *testing.T) {
"olm.package": "{\"packageName\":\"packageA\",\"version\":\"2.0.0\"}",
}),
}

testEntitySource := input.NewCacheQuerier(testEntityCache)

testResource := []client.Object{
Expand All @@ -64,14 +65,19 @@ func TestOperatorResolver(t *testing.T) {
Client client.Client
EntitySource input.EntitySource
SelectedVariableCnt int
SelectedVariables []deppy.Identifier
ExpectedError error
}{
{
Name: "should resolve the packages described by the available Operator resources",
Client: FakeClient(testResource...),
EntitySource: testEntitySource,
SelectedVariableCnt: 4,
ExpectedError: nil,
SelectedVariables: []deppy.Identifier{"operatorhub/packageA/2.0.0",
"operatorhub/prometheus/0.47.0",
"required package packageA",
"required package prometheus"},
ExpectedError: nil,
},
{
Name: "should not return an error if there are no Operator resources",
Expand Down Expand Up @@ -104,12 +110,8 @@ func TestOperatorResolver(t *testing.T) {
assert.Nil(t, solution)
} else {
assert.Len(t, solution.SelectedVariables(), tt.SelectedVariableCnt)
if len(solution.SelectedVariables()) == 4 {
assert.True(t, solution.IsSelected("operatorhub/packageA/2.0.0"))
assert.True(t, solution.IsSelected("operatorhub/prometheus/0.47.0"))
assert.True(t, solution.IsSelected("required package packageA"))
assert.True(t, solution.IsSelected("required package prometheus"))
assert.False(t, solution.IsSelected("operatorhub/prometheus/0.37.0"))
for _, identifier := range tt.SelectedVariables {
assert.True(t, solution.IsSelected(identifier))
}
assert.NoError(t, err)
}
Expand Down

0 comments on commit a269e9e

Please sign in to comment.