mirror of
https://github.com/containers/podman.git
synced 2025-06-21 01:19:15 +08:00
Refactor unittest for change in history API
* test_images.TestImages.test_history changed to allow '<missing>' as legal image ID. Previously all layers used the image ID. Now layer 0 reports '<missing>'. Signed-off-by: Jhon Honce <jhonce@redhat.com> Closes: #1056 Approved by: jwhonce
This commit is contained in:
@ -1,6 +1,7 @@
|
|||||||
import itertools
|
import itertools
|
||||||
import os
|
import os
|
||||||
import unittest
|
import unittest
|
||||||
|
from collections import Counter
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
from test.podman_testcase import PodmanTestCase
|
from test.podman_testcase import PodmanTestCase
|
||||||
|
|
||||||
@ -81,9 +82,15 @@ class TestImages(PodmanTestCase):
|
|||||||
self.assertEqual(actual, self.alpine_image)
|
self.assertEqual(actual, self.alpine_image)
|
||||||
|
|
||||||
def test_history(self):
|
def test_history(self):
|
||||||
for count, record in enumerate(self.alpine_image.history()):
|
records = []
|
||||||
self.assertEqual(record.id, self.alpine_image.id)
|
bucket = Counter()
|
||||||
self.assertGreater(count, 0)
|
for record in self.alpine_image.history():
|
||||||
|
self.assertIn(record.id, (self.alpine_image.id, '<missing>'))
|
||||||
|
bucket[record.id] += 1
|
||||||
|
records.append(record)
|
||||||
|
|
||||||
|
self.assertGreater(bucket[self.alpine_image.id], 0)
|
||||||
|
self.assertEqual(sum(bucket.values()), len(records))
|
||||||
|
|
||||||
def test_inspect(self):
|
def test_inspect(self):
|
||||||
actual = self.alpine_image.inspect()
|
actual = self.alpine_image.inspect()
|
||||||
|
Reference in New Issue
Block a user