Skip to content

Commit

Permalink
Replace predefined selected variable count with len function
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 9ce5ab4 commit c98acaf
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions internal/resolution/resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,30 +61,28 @@ func TestOperatorResolver(t *testing.T) {
}

for _, tt := range []struct {
Name string
Client client.Client
EntitySource input.EntitySource
SelectedVariableCnt int
SelectedVariables []deppy.Identifier
ExpectedError error
Name string
Client client.Client
EntitySource input.EntitySource
SelectedVariables []deppy.Identifier
ExpectedError error
}{
{
Name: "should resolve the packages described by the available Operator resources",
Client: FakeClient(testResource...),
EntitySource: testEntitySource,
SelectedVariableCnt: 4,
Name: "should resolve the packages described by the available Operator resources",
Client: FakeClient(testResource...),
EntitySource: testEntitySource,
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",
Client: FakeClient(),
EntitySource: testEntitySource,
SelectedVariableCnt: 0,
ExpectedError: nil,
Name: "should not return an error if there are no Operator resources",
Client: FakeClient(),
EntitySource: testEntitySource,
SelectedVariables: []deppy.Identifier{},
ExpectedError: nil,
},
{
Name: "should return an error if the entity source throws an error",
Expand All @@ -109,7 +107,7 @@ func TestOperatorResolver(t *testing.T) {
assert.Equal(t, err, tt.ExpectedError)
assert.Nil(t, solution)
} else {
assert.Len(t, solution.SelectedVariables(), tt.SelectedVariableCnt)
assert.Len(t, solution.SelectedVariables(), len(tt.SelectedVariables))
for _, identifier := range tt.SelectedVariables {
assert.True(t, solution.IsSelected(identifier))
}
Expand Down

0 comments on commit c98acaf

Please sign in to comment.