Commit 83f9d618 authored by Michael Gebhard's avatar Michael Gebhard

fix assert.Equal parameter order

some test cases had expected and actual value swapped.
parent b68e1f6d
......@@ -13,11 +13,11 @@ func TestVariablesJSON(t *testing.T) {
err := json.Unmarshal(data, &x)
assert.NoError(t, err)
assert.Equal(t, x.Key, "FOO")
assert.Equal(t, x.Value, "bar")
assert.Equal(t, x.Public, true)
assert.Equal(t, x.Internal, false) // cannot be set from the network
assert.Equal(t, x.File, true)
assert.Equal(t, "FOO", x.Key)
assert.Equal(t, "bar", x.Value)
assert.Equal(t, true, x.Public)
assert.Equal(t, false, x.Internal) // cannot be set from the network
assert.Equal(t, true, x.File)
}
func TestVariableString(t *testing.T) {
......@@ -72,10 +72,10 @@ func TestVariablesExpansion(t *testing.T) {
expanded := all.Expand()
assert.Len(t, expanded, 4)
assert.Equal(t, expanded.Get("key"), "value_of_value_of_$undefined")
assert.Equal(t, expanded.Get("public"), "value_of_")
assert.Equal(t, expanded.Get("private"), "value_of_value_of_$undefined")
assert.Equal(t, expanded.ExpandValue("${public} ${private}"), "value_of_ value_of_value_of_$undefined")
assert.Equal(t, "value_of_value_of_$undefined", expanded.Get("key"))
assert.Equal(t, "value_of_", expanded.Get("public"))
assert.Equal(t, "value_of_value_of_$undefined", expanded.Get("private"))
assert.Equal(t, "value_of_ value_of_value_of_$undefined", expanded.ExpandValue("${public} ${private}"))
}
func TestSpecialVariablesExpansion(t *testing.T) {
......@@ -88,8 +88,8 @@ func TestSpecialVariablesExpansion(t *testing.T) {
expanded := all.Expand()
assert.Len(t, expanded, 4)
assert.Equal(t, expanded.Get("key"), "$")
assert.Equal(t, expanded.Get("key2"), "/dsa")
assert.Equal(t, expanded.Get("key3"), "aabb")
assert.Equal(t, expanded.Get("key4"), "aabb")
assert.Equal(t, "$", expanded.Get("key"))
assert.Equal(t, "/dsa", expanded.Get("key2"))
assert.Equal(t, "aabb", expanded.Get("key3"))
assert.Equal(t, "aabb", expanded.Get("key4"))
}
......@@ -37,9 +37,9 @@ func TestParseDeviceStringOne(t *testing.T) {
device, err := e.parseDeviceString("/dev/kvm")
assert.NoError(t, err)
assert.Equal(t, device.PathOnHost, "/dev/kvm")
assert.Equal(t, device.PathInContainer, "/dev/kvm")
assert.Equal(t, device.CgroupPermissions, "rwm")
assert.Equal(t, "/dev/kvm", device.PathOnHost)
assert.Equal(t, "/dev/kvm", device.PathInContainer)
assert.Equal(t, "rwm", device.CgroupPermissions)
}
func TestParseDeviceStringTwo(t *testing.T) {
......@@ -48,9 +48,9 @@ func TestParseDeviceStringTwo(t *testing.T) {
device, err := e.parseDeviceString("/dev/kvm:/devices/kvm")
assert.NoError(t, err)
assert.Equal(t, device.PathOnHost, "/dev/kvm")
assert.Equal(t, device.PathInContainer, "/devices/kvm")
assert.Equal(t, device.CgroupPermissions, "rwm")
assert.Equal(t, "/dev/kvm", device.PathOnHost)
assert.Equal(t, "/devices/kvm", device.PathInContainer)
assert.Equal(t, "rwm", device.CgroupPermissions)
}
func TestParseDeviceStringThree(t *testing.T) {
......@@ -59,9 +59,9 @@ func TestParseDeviceStringThree(t *testing.T) {
device, err := e.parseDeviceString("/dev/kvm:/devices/kvm:r")
assert.NoError(t, err)
assert.Equal(t, device.PathOnHost, "/dev/kvm")
assert.Equal(t, device.PathInContainer, "/devices/kvm")
assert.Equal(t, device.CgroupPermissions, "r")
assert.Equal(t, "/dev/kvm", device.PathOnHost)
assert.Equal(t, "/devices/kvm", device.PathInContainer)
assert.Equal(t, "r", device.CgroupPermissions)
}
func TestParseDeviceStringFour(t *testing.T) {
......
......@@ -1181,20 +1181,20 @@ func TestSetupBuildPod(t *testing.T) {
VerifyFn: func(t *testing.T, test testDef, pod *api.Pod) {
require.Len(t, pod.Spec.Containers, 3)
assert.Equal(t, pod.Spec.Containers[0].Name, "build")
assert.Equal(t, pod.Spec.Containers[0].Image, "test-image")
assert.Equal(t, pod.Spec.Containers[0].Command, []string{"/init", "run"})
assert.Equal(t, "build", pod.Spec.Containers[0].Name)
assert.Equal(t, "test-image", pod.Spec.Containers[0].Image)
assert.Equal(t, []string{"/init", "run"}, pod.Spec.Containers[0].Command)
assert.Empty(t, pod.Spec.Containers[0].Args, "Build container args should be empty")
assert.Equal(t, pod.Spec.Containers[1].Name, "helper")
assert.Equal(t, pod.Spec.Containers[1].Image, "custom/helper-image")
assert.Equal(t, "helper", pod.Spec.Containers[1].Name)
assert.Equal(t, "custom/helper-image", pod.Spec.Containers[1].Image)
assert.Empty(t, pod.Spec.Containers[1].Command, "Helper container command should be empty")
assert.Empty(t, pod.Spec.Containers[1].Args, "Helper container args should be empty")
assert.Equal(t, pod.Spec.Containers[2].Name, "svc-0")
assert.Equal(t, pod.Spec.Containers[2].Image, "test-service")
assert.Equal(t, pod.Spec.Containers[2].Command, []string{"/init", "run"})
assert.Equal(t, pod.Spec.Containers[2].Args, []string{"application", "--debug"})
assert.Equal(t, "svc-0", pod.Spec.Containers[2].Name)
assert.Equal(t, "test-service", pod.Spec.Containers[2].Image)
assert.Equal(t, []string{"/init", "run"}, pod.Spec.Containers[2].Command)
assert.Equal(t, []string{"application", "--debug"}, pod.Spec.Containers[2].Args)
},
},
}
......
......@@ -22,6 +22,6 @@ func TestStart(t *testing.T) {
mi.On("Start", s).Return(errExample)
err := s.Run()
assert.Equal(t, err, errExample)
assert.Equal(t, errExample, err)
mi.AssertExpectations(t)
}
......@@ -493,7 +493,7 @@ func TestRequestJob(t *testing.T) {
res, ok = c.RequestJob(noJobsToken)
assert.Nil(t, res)
assert.True(t, ok, "If no jobs, runner is healthy")
assert.Equal(t, c.getLastUpdate(&noJobsToken.RunnerCredentials), "a nice timestamp", "Last-Update should be set")
assert.Equal(t, "a nice timestamp", c.getLastUpdate(&noJobsToken.RunnerCredentials), "Last-Update should be set")
res, ok = c.RequestJob(invalidToken)
assert.Nil(t, res)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment