예제 #1
0
    def setup_method(self, method):
        super(PHPFPMPoolMetricsCollectorTestCase, self).setup_method(method)
        context._setup_object_tank()

        self.phpfpm_obj = PHPFPMObject(
            local_id=123,
            pid=2,
            cmd='php-fpm: master process (/etc/php5/fpm/php-fpm.conf)',
            conf_path='/etc/php5/fpm/php-fpm.conf',
            workers=[3, 4])

        context.objects.register(self.phpfpm_obj)

        pool_data = {
            'status_path': '/status',
            'name': 'www',
            'file': '/etc/php5/fpm/pool.d/www.conf',
            'listen': '/run/php/php7.0-fpm.sock'
        }

        self.phpfpm_pool_obj = PHPFPMPoolObject(local_id=124,
                                                parent_local_id=123,
                                                **pool_data)

        context.objects.register(self.phpfpm_pool_obj,
                                 parent_obj=self.phpfpm_obj)
예제 #2
0
    def teardown_method(self, method):
        context.app_config['credentials']['imagename'] = None
        context.app_config['credentials']['uuid'] = DEFAULT_UUID
        context.setup(app='test', app_config=context.app_config)

        context.objects = None
        context._setup_object_tank()
        super(ContainerSystemManagerTestCase, self).teardown_method(method)
예제 #3
0
    def setup_method(self, method):
        super(ContainerSystemManagerTestCase, self).setup_method(method)
        context.objects = None
        context._setup_object_tank()

        context.app_config['credentials']['imagename'] = 'DockerTest'
        context.app_config['credentials']['uuid'] = None
        context.setup(app='test', app_config=context.app_config)
예제 #4
0
    def setup_method(self, method):
        super(ContainerSystemManagerTestCase, self).setup_method(method)
        context.objects = None
        context._setup_object_tank()

        context.app_config['credentials']['imagename'] = 'DockerTest'
        context.app_config['credentials']['uuid'] = None
        context.setup(app='test', app_config=context.app_config)
예제 #5
0
    def teardown_method(self, method):
        context.app_config['credentials']['imagename'] = None
        context.app_config['credentials']['uuid'] = DEFAULT_UUID
        context.setup(app='test', app_config=context.app_config)

        context.objects = None
        context._setup_object_tank()
        super(ContainerSystemManagerTestCase, self).teardown_method(method)
예제 #6
0
    def setup_method(self, method):
        super(PHPFPMMetaCollectorTestCase, self).setup_method(method)
        context._setup_object_tank()

        phpfpm_manager = PHPFPMManager()
        phpfpm_manager._discover_objects()
        found_masters = context.objects.find_all(types=phpfpm_manager.types)

        self.phpfpm_obj = found_masters[0]
예제 #7
0
    def setup_method(self, method):
        super(MySQLMetaCollectorTestCase, self).setup_method(method)
        context._setup_object_tank()

        mysql_manager = MySQLManager()
        mysql_manager._discover_objects()
        found_objects = context.objects.find_all(types=mysql_manager.types)

        self.mysql_object = found_objects[0]
예제 #8
0
    def setup_method(self, method):
        super(PHPFPMMetricsCollectorTestCase, self).setup_method(method)
        context._setup_object_tank()

        self.phpfpm_obj = PHPFPMObject(
            local_id=123,
            pid=2,
            cmd='php-fpm: master process (/etc/php5/fpm/php-fpm.conf)',
            conf_path='/etc/php5/fpm/php-fpm.conf',
            workers=[3, 4])

        context.objects.register(self.phpfpm_obj)
예제 #9
0
    def setup_method(self, method):
        super(MySQLMetricsCollectorTestCase, self).setup_method(method)
        context._setup_object_tank()

        self.mysql_obj = MySQLObject(
            local_id=123,
            pid=2,
            cmd='/usr/sbin/mysqld --basedir=/usr',
            conf_path='/etc/mysql/my.cnf',
        )

        context.objects.register(self.mysql_obj)
예제 #10
0
    def test_find_none(self):
        # Kill running NGINX so that it finds None
        subp.call('pgrep nginx |sudo xargs kill -SIGKILL', check=False)
        self.running = False

        # Setup dummy object
        context.objects.register(DummyRootObject())

        container = NginxManager()
        nginxes = container._find_all()
        assert_that(nginxes, has_length(0))

        root_object = context.objects.root_object
        assert_that(root_object.eventd.current, has_length(1))

        # Reset objects...
        context.objects = None
        context._setup_object_tank()
예제 #11
0
    def test_find_none(self):
        # Kill running NGINX so that it finds None
        subp.call('pgrep nginx |sudo xargs kill -SIGKILL', check=False)
        self.running = False

        # Setup dummy object
        context.objects.register(DummyRootObject())

        container = NginxManager()
        nginxes = container._find_all()
        assert_that(nginxes, has_length(0))

        root_object = context.objects.root_object
        assert_that(root_object.eventd.current, has_length(1))

        # Reset objects...
        context.objects = None
        context._setup_object_tank()
예제 #12
0
 def teardown_method(self, method):
     context.objects = None
     context._setup_object_tank()
     super(StatusManagerTestCase, self).teardown_method(method)
예제 #13
0
 def setup_method(self, method):
     super(StatusManagerTestCase, self).setup_method(method)
     context.objects = None
     context._setup_object_tank()
예제 #14
0
 def teardown_method(self, method):
     context._setup_object_tank()
     super(PHPFPMManagerTestCase, self).teardown_method(method)
예제 #15
0
 def setup_method(self, method):
     super(PHPFPMManagerTestCase, self).setup_method(method)
     context._setup_object_tank()
예제 #16
0
 def teardown_method(self, method):
     context._setup_object_tank()
     context.app_config['mysql'] = self.old
     super(MySQLMetaCollectorTestCase, self).teardown_method(method)
예제 #17
0
 def teardown_method(self, method):
     context.objects = None
     context._setup_object_tank()
     context.app_config['credentials']['imagename'] = None
     super(SystemManagerTestCase, self).teardown_method(method)
예제 #18
0
 def setup_method(self, method):
     super(SystemManagerTestCase, self).setup_method(method)
     context.objects = None
     context._setup_object_tank()
예제 #19
0
 def setup_method(self, method):
     super(MySQLManagerTestCase, self).setup_method(method)
     self.original_app_config = deepcopy(context.app_config['mysql'])
     context._setup_object_tank()
예제 #20
0
 def teardown_method(self, method):
     context._setup_object_tank()
     context.app_config['mysql'] = self.original_app_config
     super(MySQLManagerTestCase, self).teardown_method(method)
예제 #21
0
 def teardown_method(self, method):
     context._setup_object_tank()
     super(PHPFPMMetricsCollectorTestCase, self).setup_method(method)
예제 #22
0
 def teardown_method(self, method):
     context._setup_object_tank()
     super(MySQLMetaCollectorTestCase, self).teardown_method(method)
예제 #23
0
 def teardown_method(self, method):
     context.objects = None
     context._setup_object_tank()
     super(PlusManagerTestCase, self).teardown_method(method)
예제 #24
0
 def setup_method(self, method):
     super(PHPFPMPoolManagerTestCase, self).setup_method(method)
     context._setup_object_tank()
     self.phpfpm_manager = PHPFPMManager()
     self.phpfpm_manager._discover_objects()