Пример #1
0
    def test_create_cluster(self, version, config, check_call):
        version.return_value = '9.9'
        config.return_value = {
            'locale': sentinel.locale,
            'encoding': sentinel.encoding
        }
        postgresql.create_cluster()
        check_call.assert_called_once_with([
            'pg_createcluster', '-e', sentinel.encoding, '--locale',
            sentinel.locale, '9.9', 'main', '--', '--data-checksums'
        ],
                                           universal_newlines=True)

        # No data checksums with earlier PostgreSQL versions.
        version.return_value = '9.2'
        config.return_value = {
            'locale': sentinel.locale,
            'encoding': sentinel.encoding
        }
        check_call.reset_mock()
        postgresql.create_cluster()
        check_call.assert_called_once_with([
            'pg_createcluster', '-e', sentinel.encoding, '--locale',
            sentinel.locale, '9.2', 'main', '--', '--data-checksums'
        ],
                                           universal_newlines=True)
Пример #2
0
    def test_create_cluster(self, version, config, check_call):
        version.return_value = "9.9"
        config.return_value = {"locale": sentinel.locale, "encoding": sentinel.encoding}
        postgresql.create_cluster()
        check_call.assert_called_once_with(
            [
                "pg_createcluster",
                "-e",
                sentinel.encoding,
                "--locale",
                sentinel.locale,
                "9.9",
                "main",
                "--",
                "--data-checksums",
            ],
            universal_newlines=True,
        )

        # No data checksums with earlier PostgreSQL versions.
        version.return_value = "9.2"
        config.return_value = {"locale": sentinel.locale, "encoding": sentinel.encoding}
        check_call.reset_mock()
        postgresql.create_cluster()
        check_call.assert_called_once_with(
            ["pg_createcluster", "-e", sentinel.encoding, "--locale", sentinel.locale, "9.2", "main"],
            universal_newlines=True,
        )
Пример #3
0
def create_cluster():
    '''Sets the postgresql.cluster.created state.'''
    assert not os.path.exists(postgresql.postgresql_conf_path()), \
        'inhibit_default_cluster_creation() failed'
    assert not os.path.exists(postgresql.data_dir())
    postgresql.create_cluster()
    reactive.set_state('postgresql.cluster.created')
Пример #4
0
def create_cluster():
    """Sets the postgresql.cluster.created state."""
    # Initial cluster creation now correctly inhibited.
    # postgresql.drop_cluster(stop=True)
    postgresql.create_cluster()
    reactive.set_state("postgresql.cluster.created")