示例#1
0
    def test_calculate_update(self, rcs_getter, conf):
        memcached_inst = self._make_test_memcached()
        self._patch_rcs(rcs_getter)

        # run!
        main.process(memcached_inst, _read_sample_default_data(), 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("havana", update[driver_key]["releases"].keys())
        self.assertEqual("https://review.openstack.org/92468", (update[driver_key]["releases"]["juno"]["review_url"]))
示例#2
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']))
示例#3
0
    def test_calculate_update(self, rcs_getter, conf):
        memcached_inst = self._make_test_memcached()
        self._patch_rcs(rcs_getter)

        # run!
        main.process(memcached_inst, _read_sample_default_data(), 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('havana', update[driver_key]['releases'].keys())
        self.assertEqual(
            'https://review.openstack.org/92468',
            (update[driver_key]['releases']['juno']['review_url']))
示例#4
0
    def test_calculate_update(self, rcs_getter, conf):
        memcached_inst = self._make_test_memcached()
        self._patch_rcs(rcs_getter)

        # run!
        main.process(memcached_inst, _read_sample_default_data(), 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('havana', update[driver_key]['releases'].keys())
        self.assertEqual('https://review.openstack.org/92468',
                         (update[driver_key]['releases']['juno']
                          ['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_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"]))