summaryrefslogtreecommitdiff
path: root/libpod/test_common.go
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@gmail.com>2018-02-09 17:13:07 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2018-02-12 14:28:07 +0000
commit4f225b47c9be6f9d72997cea83c029275c3530db (patch)
tree5b9092449ca27777657e7baf1a880bb1c313ed5b /libpod/test_common.go
parentaa85ae212e4cc23df7a6bafe8992dc76770bac87 (diff)
downloadpodman-4f225b47c9be6f9d72997cea83c029275c3530db.tar.gz
podman-4f225b47c9be6f9d72997cea83c029275c3530db.tar.bz2
podman-4f225b47c9be6f9d72997cea83c029275c3530db.zip
Refactor Pod to use a Config struct
This allows us to JSON it and stuff it in the DB - previously, all pod fields were private, so JSON couldn't encode them. This allows us to keep all pod fields private by having a substruct with public fields. Signed-off-by: Matthew Heon <matthew.heon@gmail.com> Closes: #184 Approved by: baude
Diffstat (limited to 'libpod/test_common.go')
-rw-r--r--libpod/test_common.go31
1 files changed, 5 insertions, 26 deletions
diff --git a/libpod/test_common.go b/libpod/test_common.go
index ad3020b7e..0d4199037 100644
--- a/libpod/test_common.go
+++ b/libpod/test_common.go
@@ -77,9 +77,11 @@ func getTestContainer(id, name, locksDir string) (*Container, error) {
// nolint
func getTestPod(id, name, locksDir string) (*Pod, error) {
pod := &Pod{
- id: id,
- name: name,
- labels: map[string]string{"a": "b", "c": "d"},
+ config: &PodConfig{
+ ID: id,
+ Name: name,
+ Labels: map[string]string{"a": "b", "c": "d"},
+ },
valid: true,
}
@@ -133,26 +135,3 @@ func testContainersEqual(a, b *Container) bool {
return reflect.DeepEqual(aStateJSON, bStateJSON)
}
-
-// This tests pod equality
-// We cannot guarantee equality in lockfile objects so we can't simply compare
-// nolint
-func testPodsEqual(a, b *Pod) bool {
- if a == nil && b == nil {
- return true
- } else if a == nil || b == nil {
- return false
- }
-
- if a.id != b.id {
- return false
- }
- if a.name != b.name {
- return false
- }
- if a.valid != b.valid {
- return false
- }
-
- return reflect.DeepEqual(a.labels, b.labels)
-}