Applied comments.

This commit is contained in:
Jerzy Szczepkowski
2015-02-05 20:32:51 +01:00
parent 0010e02148
commit 18c5fa1ae7
4 changed files with 20 additions and 17 deletions

View File

@@ -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)
}
}