<commit_before>from fuel_test.cobbler.cobbler_test_case import CobblerTestCase
from fuel_test.helpers import is_not_essex
import unittest
from fuel_test.manifest import Manifest, Template
from fuel_test.settings import CREATE_SNAPSHOTS


class CompactTestCase(CobblerTestCase):
    def deploy_compact(self, quantum_node=True, loopback=True):
        self.do(self.nodes().controllers[:1], 'puppet agent --test 2>&1')
        self.do(self.nodes().controllers[1:], 'puppet agent --test 2>&1')
        if loopback:
            self.do(self.nodes().controllers, 'puppet agent --test 2>&1')
        self.do(self.nodes().controllers[:1], 'puppet agent --test 2>&1')
        self.do(self.nodes().controllers[1:], 'puppet agent --test 2>&1')
        self.validate(self.nodes().controllers, 'puppet agent --test 2>&1')
        if quantum_node:
            self.validate(self.nodes().quantums, 'puppet agent --test 2>&1')
        self.validate(self.nodes().computes, 'puppet agent --test 2>&1')

    @unittest.skipUnless(is_not_essex(), 'Quantum in essex is not supported')
    def test_deploy_compact_quantum(self):
        Manifest().write_openstack_manifest(
            remote=self.remote(),
            template=Template.compact(), ci=self.ci(),
            controllers=self.nodes().controllers,
            quantums=self.nodes().quantums,
            quantum=True)
        self.deploy_compact(quantum_node=False)
        if CREATE_SNAPSHOTS:
            self.environment().snapshot('compact', force=True)

    def test_deploy_compact_quantum_standalone(self):
        Manifest().write_openstack_manifest(
            remote=self.remote(),
            template=Template.compact(), ci=self.ci(),
            controllers=self.nodes().controllers,
            quantums=self.nodes().quantums,
            quantum=True, quantum_netnode_on_cnt=False, ha_provider=False)
        self.deploy_compact(quantum_node=True)
        if CREATE_SNAPSHOTS:
            self.environment().snapshot('compact', force=True)

    def test_deploy_compact_wo_quantum(self):
        Manifest().write_openstack_manifest(
            remote=self.remote(),
            template=Template.compact(), ci=self.ci(),
            controllers=self.nodes().controllers,
            quantums=self.nodes().quantums,
            quantum=False)
        self.deploy_compact(quantum_node=False)
        if CREATE_SNAPSHOTS:
            self.environment().snapshot('compact_wo_quantum', force=True)

    def test_deploy_compact_wo_loopback(self):
        Manifest().write_openstack_manifest(
            remote=self.remote(),
            template=Template.compact(), ci=self.ci(),
            controllers=self.nodes().controllers,
            quantums=self.nodes().quantums,
            quantum=False, loopback=False, use_syslog=False)
        self.deploy_compact(quantum_node=False, loopback=False)
        if CREATE_SNAPSHOTS:
            self.environment().snapshot('compact_woloopback', force=True)


if __name__ == '__main__':
    unittest.main()<commit_msg>Add test wo ha_provider<commit_after>from fuel_test.cobbler.cobbler_test_case import CobblerTestCase
from fuel_test.helpers import is_not_essex
import unittest
from fuel_test.manifest import Manifest, Template
from fuel_test.settings import CREATE_SNAPSHOTS


class CompactTestCase(CobblerTestCase):
    def deploy_compact(self, quantum_node=True, loopback=True):
        self.do(self.nodes().controllers[:1], 'puppet agent --test 2>&1')
        self.do(self.nodes().controllers[1:], 'puppet agent --test 2>&1')
        if loopback:
            self.do(self.nodes().controllers, 'puppet agent --test 2>&1')
        self.do(self.nodes().controllers[:1], 'puppet agent --test 2>&1')
        self.do(self.nodes().controllers[1:], 'puppet agent --test 2>&1')
        self.validate(self.nodes().controllers, 'puppet agent --test 2>&1')
        if quantum_node:
            self.validate(self.nodes().quantums, 'puppet agent --test 2>&1')
        self.validate(self.nodes().computes, 'puppet agent --test 2>&1')

    @unittest.skipUnless(is_not_essex(), 'Quantum in essex is not supported')
    def test_deploy_compact_quantum(self):
        Manifest().write_openstack_manifest(
            remote=self.remote(),
            template=Template.compact(), ci=self.ci(),
            controllers=self.nodes().controllers,
            quantums=self.nodes().quantums,
            quantum=True)
        self.deploy_compact(quantum_node=False)
        if CREATE_SNAPSHOTS:
            self.environment().snapshot('compact', force=True)

    def test_deploy_compact_quantum_standalone(self):
        Manifest().write_openstack_manifest(
            remote=self.remote(),
            template=Template.compact(), ci=self.ci(),
            controllers=self.nodes().controllers,
            quantums=self.nodes().quantums,
            quantum=True, quantum_netnode_on_cnt=False, ha_provider=False)
        self.deploy_compact(quantum_node=True)
        if CREATE_SNAPSHOTS:
            self.environment().snapshot('compact', force=True)

    def test_deploy_compact_wo_quantum(self):
        Manifest().write_openstack_manifest(
            remote=self.remote(),
            template=Template.compact(), ci=self.ci(),
            controllers=self.nodes().controllers,
            quantums=self.nodes().quantums,
            quantum=False)
        self.deploy_compact(quantum_node=False)
        if CREATE_SNAPSHOTS:
            self.environment().snapshot('compact_wo_quantum', force=True)

    def test_deploy_compact_wo_loopback(self):
        Manifest().write_openstack_manifest(
            remote=self.remote(),
            template=Template.compact(), ci=self.ci(),
            controllers=self.nodes().controllers,
            quantums=self.nodes().quantums,
            quantum=False, loopback=False, use_syslog=False)
        self.deploy_compact(quantum_node=False, loopback=False)
        if CREATE_SNAPSHOTS:
            self.environment().snapshot('compact_woloopback', force=True)

    def test_deploy_compact_wo_ha_provider(self):
        Manifest().write_openstack_manifest(
            remote=self.remote(),
            template=Template.compact(), ci=self.ci(),
            controllers=self.nodes().controllers,
            quantums=self.nodes().quantums,
            quantum=False, use_syslog=False, ha_provider=False)
        self.deploy_compact(quantum_node=False)
        if CREATE_SNAPSHOTS:
            self.environment().snapshot('compact_wo_ha_provider', force=True)


if __name__ == '__main__':
    unittest.main()
{'fraction_non_alphanumeric': 0.12347001223990207, 'fraction_numerical': 0.006119951040391677, 'mean_word_length': 3.055210918114144, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5810692', 'n_tokens_mistral': 2042, 'n_tokens_neox': 1935, 'n_words': 300}