Beispiel #1
0
    def test_raises_if_icu_analysis_plugin_unavailable(self, client):
        client.conn.cat.plugins.return_value = ''

        with pytest.raises(RuntimeError) as e:
            init(client)

        assert 'plugin is not installed' in str(e.value)
Beispiel #2
0
    def test_does_not_recreate_extant_index(self, client, configure_index):
        """Exits early if the index (or an alias) already exists."""
        client.conn.indices.exists.return_value = True

        init(client)

        assert not configure_index.called
Beispiel #3
0
    def test_does_not_recreate_extant_index(self, client, configure_index):
        """Exits early if the index (or an alias) already exists."""
        client.conn.indices.exists.return_value = True

        init(client)

        assert not configure_index.called
Beispiel #4
0
    def test_raises_if_icu_analysis_plugin_unavailable(self, client):
        client.conn.cat.plugins.return_value = ''

        with pytest.raises(RuntimeError) as e:
            init(client)

        assert 'plugin is not installed' in str(e.value)
Beispiel #5
0
    def test_configures_alias(self, mock_es_client):
        """Adds an alias to the newly-created index."""
        init(mock_es_client)

        mock_es_client.conn.indices.put_alias.assert_called_once_with(
            index="foo-abcd1234", name=mock_es_client.index
        )
Beispiel #6
0
    def test_raises_if_icu_analysis_plugin_unavailable(self, mock_es_client):
        mock_es_client.conn.cat.plugins.return_value = ""

        with pytest.raises(RuntimeError) as e:
            init(mock_es_client)

        assert "plugin is not installed" in str(e.value)
Beispiel #7
0
    def test_configures_alias(self, client):
        """Adds an alias to the newly-created index."""
        init(client)

        client.conn.indices.put_alias.assert_called_once_with(
            index="foo-abcd1234", name="foo"
        )
Beispiel #8
0
    def test_configures_alias(self, client):
        """Adds an alias to the newly-created index."""
        init(client)

        client.conn.indices.put_alias.assert_called_once_with(index='foo-abcd1234', name='foo')
Beispiel #9
0
    def test_configures_index_when_index_missing(self, client, configure_index):
        """Calls configure_index when one doesn't exist."""
        init(client)

        configure_index.assert_called_once_with(client)
Beispiel #10
0
    def test_skips_plugin_check(self, client, configure_index):
        client.conn.cat.plugins.return_value = ''

        init(client, check_icu_plugin=False)

        configure_index.assert_called_once_with(client)
Beispiel #11
0
    def test_configures_index_when_index_missing(self, client, configure_index):
        """Calls configure_index when one doesn't exist."""
        init(client)

        configure_index.assert_called_once_with(client)
Beispiel #12
0
    def test_skips_plugin_check(self, client, configure_index):
        client.conn.cat.plugins.return_value = ""

        init(client, check_icu_plugin=False)

        configure_index.assert_called_once_with(client)