Skip to content

Commit

Permalink
add unit test for two kube components
Browse files Browse the repository at this point in the history
Signed-off-by: Stephanie <yangcao@redhat.com>
  • Loading branch information
yangcao77 committed Apr 12, 2023
1 parent d5e6745 commit 459031e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pkg/validation/components_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,12 +341,19 @@ func TestValidateComponents(t *testing.T) {
wantErr: []string{sameEndpointNameErr},
},
{
name: "Valid Kube components with the same endpoint target ports",
name: "Valid Kube component with the same endpoint target ports as the container component's",
components: []v1alpha2.Component{
generateDummyContainerComponent("name1", nil, []v1alpha2.Endpoint{endpointUrl18080}, nil, v1alpha2.Annotation{}, false),
generateDummyKubernetesComponent("name2", []v1alpha2.Endpoint{endpointUrl28080}, ""),
},
},
{
name: "Invalid Kube components with the same endpoint names",
components: []v1alpha2.Component{
generateDummyKubernetesComponent("name1", []v1alpha2.Endpoint{endpointUrl18080}, ""),
generateDummyKubernetesComponent("name2", []v1alpha2.Endpoint{endpointUrl28080}, ""),
},
},
{
name: "Valid containers with valid resource requirement",
components: []v1alpha2.Component{
Expand Down Expand Up @@ -555,7 +562,7 @@ func TestValidateComponents(t *testing.T) {
}
}
} else {
assert.Equal(t, nil, err, "Error should be nil")
t.Errorf("Error should be nil, got %v", err)
}
} else if tt.wantErr != nil {
t.Errorf("Error should not be nil, want %v, got %v", tt.wantErr, err)
Expand Down

0 comments on commit 459031e

Please sign in to comment.