Applied comments.
This commit is contained in:
@@ -41,11 +41,11 @@ func podWithContainers(containers ...api.Container) api.BoundPod {
|
||||
|
||||
func TestAllowed(t *testing.T) {
|
||||
table := []struct {
|
||||
err error
|
||||
err string
|
||||
pods []api.BoundPod
|
||||
}{
|
||||
{
|
||||
err: nil,
|
||||
err: "[]",
|
||||
pods: []api.BoundPod{
|
||||
podWithContainers(
|
||||
containerWithHostPorts(1, 2, 3),
|
||||
@@ -58,7 +58,7 @@ func TestAllowed(t *testing.T) {
|
||||
},
|
||||
},
|
||||
{
|
||||
err: nil,
|
||||
err: "[]",
|
||||
pods: []api.BoundPod{
|
||||
podWithContainers(
|
||||
containerWithHostPorts(0, 0),
|
||||
@@ -71,7 +71,7 @@ func TestAllowed(t *testing.T) {
|
||||
},
|
||||
},
|
||||
{
|
||||
err: fmt.Errorf("conflicting ports"),
|
||||
err: "[host port 3 is already in use]",
|
||||
pods: []api.BoundPod{
|
||||
podWithContainers(
|
||||
containerWithHostPorts(3, 3),
|
||||
@@ -79,7 +79,7 @@ func TestAllowed(t *testing.T) {
|
||||
},
|
||||
},
|
||||
{
|
||||
err: fmt.Errorf("conflicting ports"),
|
||||
err: "[host port 6 is already in use]",
|
||||
pods: []api.BoundPod{
|
||||
podWithContainers(
|
||||
containerWithHostPorts(6),
|
||||
@@ -92,7 +92,7 @@ func TestAllowed(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, item := range table {
|
||||
if e, a := item.err, Allowed(item.pods); e != a && e.Error() != a.Error() {
|
||||
if e, a := item.err, Allowed(item.pods); e != fmt.Sprintf("%v", a) {
|
||||
t.Errorf("Expected %v, got %v: \n%v\v", e, a, item.pods)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user