コード例 #1
0
    def setUp(self):
        super(MonitorsTestCase, self).setUp()

        cluster = utils.get_test_cluster(node_addresses=['1.2.3.4'],
                                         api_address='https://5.6.7.8:2376',
                                         master_addresses=['10.0.0.6'])
        self.cluster = objects.Cluster(self.context, **cluster)
        self.monitor = swarm_monitor.SwarmMonitor(self.context, self.cluster)
        self.v2_monitor = swarm_v2_monitor.SwarmMonitor(
            self.context, self.cluster)
        self.k8s_monitor = k8s_monitor.K8sMonitor(self.context, self.cluster)
        self.mesos_monitor = mesos_monitor.MesosMonitor(
            self.context, self.cluster)
        p = mock.patch(
            'magnum.drivers.swarm_fedora_atomic_v1.monitor.'
            'SwarmMonitor.metrics_spec',
            new_callable=mock.PropertyMock)
        self.mock_metrics_spec = p.start()
        self.mock_metrics_spec.return_value = self.test_metrics_spec
        self.addCleanup(p.stop)

        p2 = mock.patch(
            'magnum.drivers.swarm_fedora_atomic_v2.monitor.'
            'SwarmMonitor.metrics_spec',
            new_callable=mock.PropertyMock)
        self.mock_metrics_spec_v2 = p2.start()
        self.mock_metrics_spec_v2.return_value = self.test_metrics_spec
        self.addCleanup(p2.stop)
コード例 #2
0
ファイル: test_monitors.py プロジェクト: stackhpc/magnum
    def setUp(self):
        super(MonitorsTestCase, self).setUp()
        self.requests_mock = self.useFixture(fixture.Fixture())
        cluster = utils.get_test_cluster(node_addresses=['1.2.3.4'],
                                         api_address='https://5.6.7.8:2376',
                                         master_addresses=['10.0.0.6'],
                                         labels={})
        self.cluster = objects.Cluster(self.context, **cluster)
        cluster_template = (utils.get_test_cluster_template(
            master_lb_enabled=False))
        self.cluster.cluster_template = (objects.ClusterTemplate(
            self.context, **cluster_template))
        nodegroups = utils.get_nodegroups_for_cluster(
            node_addresses=['1.2.3.4'], master_addresses=['10.0.0.6'])
        self.nodegroups = [
            objects.NodeGroup(self.context, **nodegroups['master']),
            objects.NodeGroup(self.context, **nodegroups['worker'])
        ]
        self.monitor = swarm_monitor.SwarmMonitor(self.context, self.cluster)
        self.v2_monitor = swarm_v2_monitor.SwarmMonitor(
            self.context, self.cluster)
        self.k8s_monitor = k8s_monitor.K8sMonitor(self.context, self.cluster)
        self.mesos_monitor = mesos_monitor.MesosMonitor(
            self.context, self.cluster)
        p = mock.patch(
            'magnum.drivers.swarm_fedora_atomic_v1.monitor.'
            'SwarmMonitor.metrics_spec',
            new_callable=mock.PropertyMock)
        self.mock_metrics_spec = p.start()
        self.mock_metrics_spec.return_value = self.test_metrics_spec
        self.addCleanup(p.stop)

        p2 = mock.patch(
            'magnum.drivers.swarm_fedora_atomic_v2.monitor.'
            'SwarmMonitor.metrics_spec',
            new_callable=mock.PropertyMock)
        self.mock_metrics_spec_v2 = p2.start()
        self.mock_metrics_spec_v2.return_value = self.test_metrics_spec
        self.addCleanup(p2.stop)
コード例 #3
0
 def get_monitor(self, context, cluster):
     return monitor.SwarmMonitor(context, cluster)