def test_run_multiple(self):
        self.runner = ElasticsearchRunner()
        self.runner.install()
        self.runner.run()
        self.runner.wait_for_green()

        self.assertTrue(self.runner.is_running())

        self.runner2 = ElasticsearchRunner()
        self.runner2.install()
        self.runner2.run()
        self.runner2.wait_for_green()

        self.assertTrue(self.runner2.is_running())

        health_resp = requests.get('http://localhost:%d/_cluster/health' % self.runner.es_state.port)
        self.assertEqual(200, health_resp.status_code)
        health_data = json.loads(health_resp.text)
        self.assertEqual(health_data['status'], 'green')

        health_resp = requests.get('http://localhost:%d/_cluster/health' % self.runner2.es_state.port)
        self.assertEqual(200, health_resp.status_code)
        health_data = json.loads(health_resp.text)
        self.assertEqual(health_data['status'], 'green')

        server_pid = self.runner.es_state.server_pid

        self.runner.stop()

        self.assertFalse(process_exists(server_pid))
        self.assertFalse(self.runner.is_running())
        self.assertIsNone(self.runner.es_state)

        server_pid = self.runner2.es_state.server_pid

        self.runner2.stop()

        self.assertFalse(process_exists(server_pid))
        self.assertFalse(self.runner2.is_running())
        self.assertIsNone(self.runner2.es_state)
    def test_run_version2(self):
        es_version = '2.1.0'
        self.runner = ElasticsearchRunner(version=es_version)
        self.runner.install()
        self.runner.run()
        self.runner.wait_for_green()

        self.assertTrue(self.runner.is_running())

        health_resp = requests.get('http://localhost:%d/_cluster/health' % self.runner.es_state.port)
        self.assertEqual(200, health_resp.status_code)
        health_data = json.loads(health_resp.text)
        self.assertEqual(health_data['status'], 'green')
        status = requests.get('http://localhost:%d' % self.runner.es_state.port)
        status_data = json.loads(status.text)
        self.assertEqual(status_data['version']['number'], es_version)
        server_pid = self.runner.es_state.server_pid

        self.runner.stop()

        self.assertFalse(process_exists(server_pid))
        self.assertFalse(self.runner.is_running())
        self.assertIsNone(self.runner.es_state)