Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add py3.10 to compatibility matrix across all services except for metadata #2242

Merged
merged 5 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/common_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: ['3.8.x', '3.9.x']
python-version: ['3.8.x', '3.9.x', '3.10.x']
steps:
- name: Checkout
uses: actions/checkout@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/databuilder_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: ['3.8.x', '3.9.x']
python-version: ['3.8.x', '3.9.x', '3.10.x']
steps:
- name: Checkout
uses: actions/checkout@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/frontend_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: ['3.8.x', '3.9.x']
python-version: ['3.8.x', '3.9.x', '3.10.x']
steps:
- name: Checkout
uses: actions/checkout@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/noop_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8.x', '3.9.x']
python-version: ['3.8.x', '3.9.x', '3.10.x']
steps:
- name: Do nothing
run: exit 0
2 changes: 1 addition & 1 deletion .github/workflows/search_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: ['3.8.x', '3.9.x']
python-version: ['3.8.x', '3.9.x', '3.10.x']
steps:
- name: Checkout
uses: actions/checkout@v1
Expand Down
1 change: 1 addition & 0 deletions common/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,6 @@
classifiers=[
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
],
)
1 change: 1 addition & 0 deletions databuilder/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,5 +142,6 @@
classifiers=[
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
],
)
3 changes: 2 additions & 1 deletion frontend/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def build_js() -> None:
jira = ['jira==3.0.1']
asana = ['asana==0.10.3']
oidc = ['flaskoidc>=1.0.0']
pyarrow = ['pyarrow==3.0.0']
pyarrow = ['pyarrow==15.0.0']
bigquery_preview = ['google-cloud-bigquery>=2.13.1,<3.0.0', 'flatten-dict==0.3.0']
all_deps = requirements + requirements_common + requirements_dev + oidc + pyarrow + bigquery_preview + jira + asana

Expand Down Expand Up @@ -83,5 +83,6 @@ def build_js() -> None:
classifiers=[
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
],
)
1 change: 1 addition & 0 deletions search/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,6 @@
classifiers=[
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
],
)
81 changes: 35 additions & 46 deletions search/tests/unit/proxy/test_elasticsearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from typing import ( # noqa: F401
Any, Iterable, List, Optional,
)
from unittest import mock
from unittest.mock import MagicMock, patch

from amundsen_common.models.api import health_check
Expand Down Expand Up @@ -548,7 +547,6 @@ def test_create_document(self, mock_uuid: MagicMock) -> None:
{
'index': {
'_index': new_index_name,
'_type': 'table',
'_id': 'snowflake://blue.test_schema/bank_accounts'
}
},
Expand All @@ -569,11 +567,11 @@ def test_create_document(self, mock_uuid: MagicMock) -> None:
'total_usage': 0,
'programmatic_descriptions': None,
'schema_description': 'schema description 1',
'resource_type': 'table',
},
{
'index': {
'_index': new_index_name,
'_type': 'table',
'_id': 'snowflake://blue.test_schema/bitcoin_wallets'
}
},
Expand All @@ -593,20 +591,17 @@ def test_create_document(self, mock_uuid: MagicMock) -> None:
'badges': [],
'total_usage': 0,
'schema_description': 'schema description 2',
'programmatic_descriptions': ["test"]
'programmatic_descriptions': ["test"],
'resource_type': 'table',
}
]

_get_alias = mock.create_autospec(mock_elasticsearch.indices.get_alias)
_get_alias.return_value = dict([(new_index_name, {})])

_bulk = mock.create_autospec(mock_elasticsearch.indices.get_alias)
_bulk.return_value = {'errors': False}

expected_alias = 'table_search_index'
result = self.es_proxy.create_document(data=start_data, index=expected_alias)
self.assertEqual(expected_alias, result)
_bulk.assert_called_with(body=expected_data)
with patch.object(mock_elasticsearch.indices, 'get_alias', return_value=dict([(new_index_name, {})])), \
patch.object(mock_elasticsearch, 'bulk', return_value={'errors': False}) as bulk:
result = self.es_proxy.create_document(data=start_data, index=expected_alias)
self.assertEqual(expected_alias, result)
bulk.assert_called_with(body=expected_data)

def test_update_document_with_no_data(self) -> None:
expected = ''
Expand All @@ -617,8 +612,6 @@ def test_update_document_with_no_data(self) -> None:
def test_update_document(self, mock_uuid: MagicMock) -> None:
mock_elasticsearch = self.es_proxy.elasticsearch
new_index_name = 'tester_index_name'
_get_alias = mock.create_autospec(mock_elasticsearch.indices.get_alias)
_get_alias.return_value = dict([(new_index_name, {})])
mock_uuid.return_value = new_index_name
table_key = 'snowflake://blue.test_schema/bitcoin_wallets'
expected_alias = 'table_search_index'
Expand All @@ -633,7 +626,6 @@ def test_update_document(self, mock_uuid: MagicMock) -> None:
{
'update': {
'_index': new_index_name,
'_type': 'table',
'_id': table_key
}
},
Expand All @@ -655,75 +647,72 @@ def test_update_document(self, mock_uuid: MagicMock) -> None:
'total_usage': 0,
'programmatic_descriptions': None,
'schema_description': 'schema description 1',
'resource_type': 'table',
}
}
]
result = self.es_proxy.update_document(data=data, index=expected_alias)
self.assertEqual(expected_alias, result)
_bulk = mock.create_autospec(mock_elasticsearch.bulk)
_bulk.assert_called_with(body=expected_data)
with patch.object(mock_elasticsearch.indices, 'get_alias', return_value=dict([(new_index_name, {})])), \
patch.object(mock_elasticsearch, 'bulk') as bulk:
result = self.es_proxy.update_document(data=data, index=expected_alias)
self.assertEqual(expected_alias, result)
bulk.assert_called_with(body=expected_data)

@patch('uuid.uuid4')
def test_delete_table_document(self, mock_uuid: MagicMock) -> None:
mock_elasticsearch = self.es_proxy.elasticsearch
new_index_name = 'tester_index_name'
mock_uuid.return_value = new_index_name

_get_alias = mock.create_autospec(mock_elasticsearch.indices.get_alias)
_get_alias.return_value = dict([(new_index_name, {})])

expected_alias = 'table_search_index'
data = ['id1', 'id2']

expected_data = [
{'delete': {'_index': new_index_name, '_id': 'id1', '_type': 'table'}},
{'delete': {'_index': new_index_name, '_id': 'id2', '_type': 'table'}}
{'delete': {'_index': new_index_name, '_id': 'id1'}},
{'delete': {'_index': new_index_name, '_id': 'id2'}}
]
result = self.es_proxy.delete_document(data=data, index=expected_alias)

self.assertEqual(expected_alias, result)
_bulk = mock.create_autospec(mock_elasticsearch.bulk)
_bulk.assert_called_with(body=expected_data)
with patch.object(mock_elasticsearch.indices, 'get_alias', return_value=dict([(new_index_name, {})])), \
patch.object(mock_elasticsearch, 'bulk') as bulk:
result = self.es_proxy.delete_document(data=data, index=expected_alias)
self.assertEqual(expected_alias, result)
bulk.assert_called_with(body=expected_data)

@patch('uuid.uuid4')
def test_delete_user_document(self, mock_uuid: MagicMock) -> None:
mock_elasticsearch = self.es_proxy.elasticsearch
new_index_name = 'tester_index_name'
mock_uuid.return_value = new_index_name
_get_alias = mock.create_autospec(mock_elasticsearch.indices.get_alias)
_get_alias.return_value = dict([(new_index_name, {})])
expected_alias = 'user_search_index'
data = ['id1', 'id2']

expected_data = [
{'delete': {'_index': new_index_name, '_id': 'id1', '_type': 'user'}},
{'delete': {'_index': new_index_name, '_id': 'id2', '_type': 'user'}}
{'delete': {'_index': new_index_name, '_id': 'id1'}},
{'delete': {'_index': new_index_name, '_id': 'id2'}}
]
result = self.es_proxy.delete_document(data=data, index=expected_alias)

self.assertEqual(expected_alias, result)
_bulk = mock.create_autospec(mock_elasticsearch.bulk)
_bulk.assert_called_with(body=expected_data)
with patch.object(mock_elasticsearch.indices, 'get_alias', return_value=dict([(new_index_name, {})])), \
patch.object(mock_elasticsearch, 'bulk') as bulk:
result = self.es_proxy.delete_document(data=data, index=expected_alias)
self.assertEqual(expected_alias, result)
bulk.assert_called_with(body=expected_data)

@patch('uuid.uuid4')
def test_delete_feature_document(self, mock_uuid: MagicMock) -> None:
mock_elasticsearch = self.es_proxy.elasticsearch
new_index_name = 'test_indx'
mock_uuid.return_value = new_index_name
_get_alias = mock.create_autospec(mock_elasticsearch.indices.get_alias)
_get_alias.return_value = dict([(new_index_name, {})])
expected_alias = 'feature_search_index'
data = ['id1', 'id2']

expected_data = [
{'delete': {'_index': new_index_name, '_id': 'id1', '_type': 'feature'}},
{'delete': {'_index': new_index_name, '_id': 'id2', '_type': 'feature'}}
{'delete': {'_index': new_index_name, '_id': 'id1'}},
{'delete': {'_index': new_index_name, '_id': 'id2'}}
]
result = self.es_proxy.delete_document(data=data, index=expected_alias)

self.assertEqual(expected_alias, result)
_bulk = mock.create_autospec(mock_elasticsearch.bulk)
_bulk.assert_called_with(body=expected_data)
with patch.object(mock_elasticsearch.indices, 'get_alias', return_value=dict([(new_index_name, {})])), \
patch.object(mock_elasticsearch, 'bulk') as bulk:
result = self.es_proxy.delete_document(data=data, index=expected_alias)
self.assertEqual(expected_alias, result)
bulk.assert_called_with(body=expected_data)

def test_get_instance_string(self) -> None:
result = self.es_proxy._get_instance('column', 'value')
Expand Down
Loading