示例#1
0
    def setUp(self):
        super(TestSync, self).setUp()

        self.repo = RepositoryModel('repo1')
        self.conduit = mock.MagicMock()
        plugin_config = {
            importer_constants.KEY_FEED: 'http://example.com/deb',
            constants.CONFIG_REQUIRE_SIGNATURE: False,
        }
        self.config = PluginCallConfiguration({}, plugin_config)
        self._task_current = mock.patch("pulp.server.managers.repo._common.task.current")
        obj = self._task_current.__enter__()
        obj.request.id = 'aabb'
        worker_name = "worker01"
        obj.request.configure_mock(hostname=worker_name)
        os.makedirs(os.path.join(self.pulp_working_dir, worker_name))
        self.step = sync.RepoSync(repo=self.repo,
                                  conduit=self.conduit,
                                  config=self.config)
        open(self.step.release_files['stable'], "wb").write("""\
Architectures: amd64
Components: main
SHA256:
 0000000000000000000000000000000000000000000000000000000000000001            67863 main/binary-amd64/Packages
 0000000000000000000000000000000000000000000000000000000000000003             9144 main/binary-amd64/Packages.bz2
 0000000000000000000000000000000000000000000000000000000000000002            14457 main/binary-amd64/Packages.gz
""")  # noqa
        with open(self.step.release_files['stable'] + '.gpg', "wb") as f:
            f.write("")
示例#2
0
    def setUp(self):
        super(TestSyncStep, self).setUp()

        self.repo = RepositoryModel('repo1')
        self.conduit = mock.MagicMock()
        plugin_config = {
            constants.CONFIG_KEY_UPSTREAM_NAME: 'pulp/crane',
            importer_constants.KEY_FEED: 'http://pulpproject.org/',
        }
        self.config = PluginCallConfiguration({}, plugin_config)
        self.step = sync.SyncStep(self.repo, self.conduit, self.config, '/a/b/c')
示例#3
0
    def setUp(self):
        super(TestSaveUnits, self).setUp()
        self.working_dir = tempfile.mkdtemp()
        self.dest_dir = tempfile.mkdtemp()
        self.step = sync.SaveUnits(self.working_dir)
        self.step.repo = RepositoryModel('repo1')
        self.step.conduit = mock.MagicMock()
        self.step.parent = mock.MagicMock()
        self.step.parent.step_get_local_units.units_to_download = [{'image_id': 'abc123'}]

        self.unit = Unit(constants.IMAGE_TYPE_ID, {'image_id': 'abc123'},
                         {'parent': None, 'size': 2}, os.path.join(self.dest_dir, 'abc123'))
示例#4
0
 def setUp(self):
     super(TestSaveImages, self).setUp()
     self.working_dir = tempfile.mkdtemp()
     self.dest_dir = tempfile.mkdtemp()
     self.step = v1_sync.SaveImages(self.working_dir)
     self.step.repo = RepositoryModel('repo1')
     self.step.conduit = mock.MagicMock()
     self.step.parent = mock.MagicMock()
     self.step.parent.step_get_local_units.units_to_download = [{
         'image_id':
         'abc123'
     }]
     self.item = Image(image_id='abc123')
示例#5
0
    def setUp(self):
        super(TestSyncStep, self).setUp()

        self.repo = RepositoryModel('repo1')
        self.conduit = mock.MagicMock()
        plugin_config = {
            importer_constants.KEY_FEED: 'http://pulpproject.org/',
        }
        self.working_dir = tempfile.mkdtemp()
        self.config = PluginCallConfiguration({}, plugin_config)
        self.step = sync.SyncStep(repo=self.repo,
                                  conduit=self.conduit,
                                  config=self.config,
                                  working_dir=self.working_dir)
示例#6
0
    def setUp(self):
        self.working_dir = tempfile.mkdtemp()
        self.repo = RepositoryModel('repo1')
        self.repo.working_dir = self.working_dir
        self.conduit = mock.MagicMock()
        plugin_config = {
            importer_constants.KEY_FEED: 'http://ftp.fau.de/debian/dists/stable/main/binary-amd64/',
        }
        self.config = PluginCallConfiguration({}, plugin_config)

        self.step = sync.GetMetadataStep(repo=self.repo, conduit=self.conduit, config=self.config,
                                         working_dir=self.working_dir)
        self.step.parent = mock.MagicMock()
        self.index = self.step.parent.index_repository
示例#7
0
    def setUp(self):
        super(TestGerMetadataStep, self).setUp()
        self.working_dir = tempfile.mkdtemp()
        self.repo = RepositoryModel('repo1')
        self.repo.working_dir = self.working_dir
        self.conduit = mock.MagicMock()
        plugin_config = {
            constants.CONFIG_KEY_UPSTREAM_NAME: 'pulp/crane',
            importer_constants.KEY_FEED: 'http://pulpproject.org/',
        }
        self.config = PluginCallConfiguration({}, plugin_config)

        self.step = sync.GetMetadataStep(self.repo, self.conduit, self.config, self.working_dir)
        self.step.parent = mock.MagicMock()
        self.index = self.step.parent.index_repository