aboutsummaryrefslogtreecommitdiff
path: root/libpod/common_test.go
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@gmail.com>2018-05-14 19:30:11 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-05-17 23:10:12 +0000
commit018d2c6b1d23acf7fe67e809498bc354eaf6becf (patch)
tree7e4a605898905c0e0b259717d642ecbabf2516d3 /libpod/common_test.go
parentc45d4c6d5ce83a89f4c536e529c2a6e7a770837e (diff)
downloadpodman-018d2c6b1d23acf7fe67e809498bc354eaf6becf.tar.gz
podman-018d2c6b1d23acf7fe67e809498bc354eaf6becf.tar.bz2
podman-018d2c6b1d23acf7fe67e809498bc354eaf6becf.zip
Add pod state
Add a mutable state to pods, and database backend sutable for modifying and updating said state. Signed-off-by: Matthew Heon <matthew.heon@gmail.com> Closes: #784 Approved by: rhatdan
Diffstat (limited to 'libpod/common_test.go')
-rw-r--r--libpod/common_test.go30
1 files changed, 27 insertions, 3 deletions
diff --git a/libpod/common_test.go b/libpod/common_test.go
index 01dca7acb..a95d73926 100644
--- a/libpod/common_test.go
+++ b/libpod/common_test.go
@@ -94,9 +94,13 @@ func getTestContainer(id, name, locksDir string) (*Container, error) {
func getTestPod(id, name, locksDir string) (*Pod, error) {
pod := &Pod{
config: &PodConfig{
- ID: id,
- Name: name,
- Labels: map[string]string{"a": "b", "c": "d"},
+ ID: id,
+ Name: name,
+ Labels: map[string]string{"a": "b", "c": "d"},
+ CgroupParent: "/hello/world/cgroup/parent",
+ },
+ state: &podState{
+ CgroupPath: "/path/to/cgroups/hello/",
},
valid: true,
}
@@ -180,3 +184,23 @@ func testContainersEqual(t *testing.T, a, b *Container) {
assert.EqualValues(t, aState, bState)
}
+
+// Test if pods are equal
+func testPodsEqual(t *testing.T, a, b *Pod) {
+ if a == nil && b == nil {
+ return
+ }
+
+ assert.NotNil(t, a)
+ assert.NotNil(t, b)
+
+ assert.NotNil(t, a.config)
+ assert.NotNil(t, b.config)
+ assert.NotNil(t, a.state)
+ assert.NotNil(t, b.state)
+
+ assert.Equal(t, a.valid, b.valid)
+
+ assert.EqualValues(t, a.config, b.config)
+ assert.EqualValues(t, a.state, b.state)
+}