示例#1
0
# limitations under the License.

import fixtures
import itertools
import mock
import os
import requests

from kolla.cmd import build as build_cmd
from kolla import exception
from kolla.image import build
from kolla.tests import base

FAKE_IMAGE = build.Image('image-base',
                         'image-base:latest',
                         '/fake/path',
                         parent_name=None,
                         parent=None,
                         status=build.STATUS_MATCHED)
FAKE_IMAGE_CHILD = build.Image('image-child',
                               'image-child:latest',
                               '/fake/path2',
                               parent_name='image-base',
                               parent=FAKE_IMAGE,
                               status=build.STATUS_MATCHED)
FAKE_IMAGE_CHILD_UNMATCHED = build.Image('image-child1',
                                         'image-child:latest',
                                         '/fake/path3',
                                         parent_name='image-base',
                                         parent=FAKE_IMAGE,
                                         status=build.STATUS_UNMATCHED)
FAKE_IMAGE_CHILD_ERROR = build.Image('image-child2',
示例#2
0
import fixtures
import itertools
import os
import requests
import sys
from unittest import mock

from kolla.cmd import build as build_cmd
from kolla import exception
from kolla.image import build
from kolla.tests import base

FAKE_IMAGE = build.Image('image-base',
                         'image-base:latest',
                         '/fake/path',
                         parent_name=None,
                         parent=None,
                         status=build.Status.MATCHED)
FAKE_IMAGE_CHILD = build.Image('image-child',
                               'image-child:latest',
                               '/fake/path2',
                               parent_name='image-base',
                               parent=FAKE_IMAGE,
                               status=build.Status.MATCHED)
FAKE_IMAGE_CHILD_UNMATCHED = build.Image('image-child-unmatched',
                                         'image-child-unmatched:latest',
                                         '/fake/path3',
                                         parent_name='image-base',
                                         parent=FAKE_IMAGE,
                                         status=build.Status.UNMATCHED)
FAKE_IMAGE_CHILD_ERROR = build.Image('image-child-error',
示例#3
0
# limitations under the License.

import fixtures
import itertools
import mock
import os
import requests

from kolla.cmd import build as build_cmd
from kolla import exception
from kolla.image import build
from kolla.tests import base

FAKE_IMAGE = build.Image('image-base',
                         'image-base:latest',
                         '/fake/path',
                         parent_name=None,
                         parent=None,
                         status=build.STATUS_MATCHED)
FAKE_IMAGE_CHILD = build.Image('image-child',
                               'image-child:latest',
                               '/fake/path2',
                               parent_name='image-base',
                               parent=FAKE_IMAGE,
                               status=build.STATUS_MATCHED)


class TasksTest(base.TestCase):
    def setUp(self):
        super(TasksTest, self).setUp()
        self.image = FAKE_IMAGE.copy()
        # NOTE(jeffrey4l): use a real, temporary dir
示例#4
0
# See the License for the specific language governing permissions and
# limitations under the License.

import fixtures
import itertools
import mock
import os
import requests

from kolla.cmd import build as build_cmd
from kolla.image import build
from kolla.tests import base

FAKE_IMAGE = build.Image('image-base',
                         'image-base:latest',
                         '/fake/path',
                         parent_name=None,
                         parent=None,
                         status=build.STATUS_MATCHED)


class TasksTest(base.TestCase):
    def setUp(self):
        super(TasksTest, self).setUp()
        self.image = FAKE_IMAGE.copy()
        # NOTE(jeffrey4l): use a real, temporary dir
        self.image.path = self.useFixture(fixtures.TempDir()).path

    @mock.patch.dict(os.environ, clear=True)
    @mock.patch('docker.Client')
    def test_push_image(self, mock_client):
        pusher = build.PushTask(self.conf, self.image)