summaryrefslogtreecommitdiff
path: root/libpod/state_test.go
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@gmail.com>2018-02-12 11:48:20 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2018-02-16 16:46:09 +0000
commitf2041b51f39855f288f8feb486c5726587ebe90a (patch)
treee7b059b851c3cf3b46630f2ef778844322d74765 /libpod/state_test.go
parent445aaf87fae22fb38e68f2bc158e833fa58141bc (diff)
downloadpodman-f2041b51f39855f288f8feb486c5726587ebe90a.tar.gz
podman-f2041b51f39855f288f8feb486c5726587ebe90a.tar.bz2
podman-f2041b51f39855f288f8feb486c5726587ebe90a.zip
Add FFJSON encoding/decoding for our container structs
Signed-off-by: Matthew Heon <matthew.heon@gmail.com> Closes: #323 Approved by: mheon
Diffstat (limited to 'libpod/state_test.go')
-rw-r--r--libpod/state_test.go64
1 files changed, 11 insertions, 53 deletions
diff --git a/libpod/state_test.go b/libpod/state_test.go
index 53930f2d0..1b9a04d75 100644
--- a/libpod/state_test.go
+++ b/libpod/state_test.go
@@ -161,11 +161,7 @@ func TestAddAndGetContainer(t *testing.T) {
retrievedCtr, err := state.Container(testCtr.ID())
assert.NoError(t, err)
- // Use assert.EqualValues if the test fails to pretty print diff
- // between actual and expected
- if !testContainersEqual(testCtr, retrievedCtr) {
- assert.EqualValues(t, testCtr, retrievedCtr)
- }
+ testContainersEqual(t, testCtr, retrievedCtr)
})
}
@@ -185,11 +181,7 @@ func TestAddAndGetContainerFromMultiple(t *testing.T) {
retrievedCtr, err := state.Container(testCtr1.ID())
assert.NoError(t, err)
- // Use assert.EqualValues if the test fails to pretty print diff
- // between actual and expected
- if !testContainersEqual(testCtr1, retrievedCtr) {
- assert.EqualValues(t, testCtr1, retrievedCtr)
- }
+ testContainersEqual(t, testCtr1, retrievedCtr)
})
}
@@ -350,11 +342,7 @@ func TestLookupContainerByFullID(t *testing.T) {
retrievedCtr, err := state.LookupContainer(testCtr.ID())
assert.NoError(t, err)
- // Use assert.EqualValues if the test fails to pretty print diff
- // between actual and expected
- if !testContainersEqual(testCtr, retrievedCtr) {
- assert.EqualValues(t, testCtr, retrievedCtr)
- }
+ testContainersEqual(t, testCtr, retrievedCtr)
})
}
@@ -369,11 +357,7 @@ func TestLookupContainerByUniquePartialID(t *testing.T) {
retrievedCtr, err := state.LookupContainer(testCtr.ID()[0:8])
assert.NoError(t, err)
- // Use assert.EqualValues if the test fails to pretty print diff
- // between actual and expected
- if !testContainersEqual(testCtr, retrievedCtr) {
- assert.EqualValues(t, testCtr, retrievedCtr)
- }
+ testContainersEqual(t, testCtr, retrievedCtr)
})
}
@@ -406,11 +390,7 @@ func TestLookupContainerByName(t *testing.T) {
retrievedCtr, err := state.LookupContainer(testCtr.Name())
assert.NoError(t, err)
- // Use assert.EqualValues if the test fails to pretty print diff
- // between actual and expected
- if !testContainersEqual(testCtr, retrievedCtr) {
- assert.EqualValues(t, testCtr, retrievedCtr)
- }
+ testContainersEqual(t, testCtr, retrievedCtr)
})
}
@@ -504,11 +484,7 @@ func TestSaveAndUpdateContainer(t *testing.T) {
err = state.UpdateContainer(testCtr)
assert.NoError(t, err)
- // Use assert.EqualValues if the test fails to pretty print diff
- // between actual and expected
- if !testContainersEqual(testCtr, retrievedCtr) {
- assert.EqualValues(t, testCtr, retrievedCtr)
- }
+ testContainersEqual(t, testCtr, retrievedCtr)
})
}
@@ -600,11 +576,7 @@ func TestGetAllContainersWithOneContainer(t *testing.T) {
assert.NoError(t, err)
assert.Equal(t, 1, len(ctrs))
- // Use assert.EqualValues if the test fails to pretty print diff
- // between actual and expected
- if !testContainersEqual(testCtr, ctrs[0]) {
- assert.EqualValues(t, testCtr, ctrs[0])
- }
+ testContainersEqual(t, testCtr, ctrs[0])
})
}
@@ -1600,11 +1572,7 @@ func TestPodContainersOneContainer(t *testing.T) {
assert.NoError(t, err)
assert.Equal(t, 1, len(ctrs))
- // Use assert.EqualValues if the test fails to pretty print diff
- // between actual and expected
- if !testContainersEqual(testCtr, ctrs[0]) {
- assert.EqualValues(t, testCtr, ctrs[0])
- }
+ testContainersEqual(t, testCtr, ctrs[0])
})
}
@@ -1908,14 +1876,8 @@ func TestAddContainerToPodSucceeds(t *testing.T) {
assert.NoError(t, err)
assert.Equal(t, 1, len(allCtrs))
- // Use assert.EqualValues if the test fails to pretty print diff
- // between actual and expected
- if !testContainersEqual(testCtr, ctrs[0]) {
- assert.EqualValues(t, testCtr, ctrs[0])
- }
- if !testContainersEqual(allCtrs[0], ctrs[0]) {
- assert.EqualValues(t, allCtrs[0], ctrs[0])
- }
+ testContainersEqual(t, testCtr, ctrs[0])
+ testContainersEqual(t, ctrs[0], allCtrs[0])
})
}
@@ -1980,11 +1942,7 @@ func TestAddContainerToPodWithAddContainer(t *testing.T) {
assert.NoError(t, err)
assert.Equal(t, 2, len(allCtrs))
- // Use assert.EqualValues if the test fails to pretty print diff
- // between actual and expected
- if !testContainersEqual(testCtr1, ctrs[0]) {
- assert.EqualValues(t, testCtr1, ctrs[0])
- }
+ testContainersEqual(t, testCtr1, ctrs[0])
})
}