Пример #1
0
    def test_calculate_update_existing_version_data(self, rcs_getter, conf):
        # checks that existing data will be overwritten with update
        # preserving data for other versions

        # put default data with some updates into memory storage
        dd = _read_sample_default_data()
        main.transform_default_data(dd)
        key = ('openstack/neutron', 'Cisco', 'Cisco Nexus Plugin')
        dd['drivers'][key]['releases'].update({
            'juno': {
                'comment': 'Build succeeded.',
                'timestamp': 1234567890,
                'review_url': 'https://review.openstack.org/11111'
            },
            'havana': {
                'comment': 'Build succeeded.',
                'timestamp': 1234567890,
                'review_url': 'https://review.openstack.org/22222'
            }
        })

        # put hash from default data to emulate that file is not changed
        default_data_from_file = _read_sample_default_data()

        memcached_inst = self._make_test_memcached({
            'driverlog:default_data':
            dd,
            'driverlog:default_data_hash':
            utils.calc_hash(default_data_from_file)
        })
        self._patch_rcs(rcs_getter)

        # run!
        main.process(memcached_inst, default_data_from_file, False)

        # verify
        update = memcached_inst.get('driverlog:default_data')['drivers']

        driver_key = ('openstack/neutron', 'Cisco', 'Cisco Nexus Plugin')
        self.assertIn(driver_key, update.keys())
        self.assertIn('juno', update[driver_key]['releases'])
        self.assertEqual(
            'https://review.openstack.org/92468',
            (update[driver_key]['releases']['juno']['review_url']))

        self.assertIn('havana', update[driver_key]['releases'])
        self.assertEqual(
            'https://review.openstack.org/22222',
            (update[driver_key]['releases']['havana']['review_url']))
Пример #2
0
    def test_transform_default_data(self):
        driver = {
            "project_id": "openstack/neutron",
            "vendor": "Cisco",
            "name": "Cisco Nexus Plugin",
            "releases": ["Grizzly", "Havana", "Icehouse"],
        }
        dd = {"drivers": [driver]}

        main.transform_default_data(dd)

        self.assertIn(("openstack/neutron", "Cisco", "Cisco Nexus Plugin"), dd["drivers"].keys())
        driver = dd["drivers"][("openstack/neutron", "Cisco", "Cisco Nexus Plugin")]
        self.assertTrue(
            "grizzly" in driver["releases"], "Grizzly should be copied from releases into " "os_version_map"
        )
Пример #3
0
    def test_transform_default_data(self):
        driver = {
            'project_id': 'openstack/neutron',
            'vendor': 'Cisco',
            'name': 'Cisco Nexus Plugin',
            'releases': ['Grizzly', 'Havana', 'Icehouse'], }
        dd = {'drivers': [driver]}

        main.transform_default_data(dd)

        self.assertIn(('openstack/neutron', 'Cisco', 'Cisco Nexus Plugin'),
                      dd['drivers'].keys())
        driver = dd['drivers'][
            ('openstack/neutron', 'Cisco', 'Cisco Nexus Plugin')]
        self.assertTrue('grizzly' in driver['releases'],
                        'Grizzly should be copied from releases into '
                        'os_version_map')
Пример #4
0
    def test_calculate_update_existing_version_data(self, rcs_getter, conf):
        # checks that existing data will be overwritten with update
        # preserving data for other versions

        # put default data with some updates into memory storage
        dd = _read_sample_default_data()
        main.transform_default_data(dd)
        key = ('openstack/neutron', 'Cisco', 'Cisco Nexus Plugin')
        dd['drivers'][key]['releases'].update({
            'juno': {
                'comment': 'Build succeeded.',
                'timestamp': 1234567890,
                'review_url': 'https://review.openstack.org/11111'
            },
            'havana': {
                'comment': 'Build succeeded.',
                'timestamp': 1234567890,
                'review_url': 'https://review.openstack.org/22222'
            }})

        # put hash from default data to emulate that file is not changed
        default_data_from_file = _read_sample_default_data()

        memcached_inst = self._make_test_memcached({
            'driverlog:default_data': dd,
            'driverlog:default_data_hash': utils.calc_hash(
                default_data_from_file)})
        self._patch_rcs(rcs_getter)

        # run!
        main.process(memcached_inst, default_data_from_file, False)

        # verify
        update = memcached_inst.get('driverlog:default_data')['drivers']

        driver_key = ('openstack/neutron', 'Cisco', 'Cisco Nexus Plugin')
        self.assertIn(driver_key, update.keys())
        self.assertIn('juno', update[driver_key]['releases'])
        self.assertEqual('https://review.openstack.org/92468',
                         (update[driver_key]['releases']['juno']
                          ['review_url']))

        self.assertIn('havana', update[driver_key]['releases'])
        self.assertEqual('https://review.openstack.org/22222',
                         (update[driver_key]['releases']
                          ['havana']['review_url']))
Пример #5
0
    def test_calculate_update_existing_version_data(self, rcs_getter, conf):
        # checks that existing data will be overwritten with update
        # preserving data for other versions

        # put default data with some updates into memory storage
        dd = _read_sample_default_data()
        main.transform_default_data(dd)
        key = ("openstack/neutron", "Cisco", "Cisco Nexus Plugin")
        dd["drivers"][key]["releases"].update(
            {
                "juno": {
                    "comment": "Build succeeded.",
                    "timestamp": 1234567890,
                    "review_url": "https://review.openstack.org/11111",
                },
                "havana": {
                    "comment": "Build succeeded.",
                    "timestamp": 1234567890,
                    "review_url": "https://review.openstack.org/22222",
                },
            }
        )

        # put hash from default data to emulate that file is not changed
        default_data_from_file = _read_sample_default_data()

        memcached_inst = self._make_test_memcached(
            {"driverlog:default_data": dd, "driverlog:default_data_hash": utils.calc_hash(default_data_from_file)}
        )
        self._patch_rcs(rcs_getter)

        # run!
        main.process(memcached_inst, default_data_from_file, False)

        # verify
        update = memcached_inst.get("driverlog:default_data")["drivers"]

        driver_key = ("openstack/neutron", "Cisco", "Cisco Nexus Plugin")
        self.assertIn(driver_key, update.keys())
        self.assertIn("juno", update[driver_key]["releases"])
        self.assertEqual("https://review.openstack.org/92468", (update[driver_key]["releases"]["juno"]["review_url"]))

        self.assertIn("havana", update[driver_key]["releases"])
        self.assertEqual("https://review.openstack.org/22222", (update[driver_key]["releases"]["havana"]["review_url"]))
Пример #6
0
    def test_transform_default_data(self):
        driver = {
            'project_id': 'openstack/neutron',
            'vendor': 'Cisco',
            'name': 'Cisco Nexus Plugin',
            'releases': ['Grizzly', 'Havana', 'Icehouse'],
        }
        dd = {'drivers': [driver]}

        main.transform_default_data(dd)

        self.assertIn(('openstack/neutron', 'Cisco', 'Cisco Nexus Plugin'),
                      dd['drivers'].keys())
        driver = dd['drivers'][('openstack/neutron', 'Cisco',
                                'Cisco Nexus Plugin')]
        self.assertTrue(
            'grizzly' in driver['releases'],
            'Grizzly should be copied from releases into '
            'os_version_map')