From 95e317ec223e439df9f632f2945325f511345dd0 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 14 Mar 2022 15:34:43 +0000 Subject: [PATCH 1/4] =?UTF-8?q?=E2=AC=86=EF=B8=8F(project)=20upgrade=20pyt?= =?UTF-8?q?hon=20dependencies?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit | datasource | package | from | to | | ---------- | ------------------ | ------ | ------ | | pypi | Faker | 12.3.0 | 13.3.2 | | pypi | bandit | 1.7.2 | 1.7.4 | | pypi | click | 8.0.3 | 8.0.4 | | pypi | elasticsearch | 7.17.0 | 8.1.0 | | pypi | fastapi | 0.73.0 | 0.75.0 | | pypi | hypothesis | 6.36.2 | 6.39.3 | | pypi | ipython | 8.0.1 | 8.1.1 | | pypi | mkdocs-material | 8.1.11 | 8.2.5 | | pypi | mkdocstrings | 0.18.0 | 0.18.1 | | pypi | pyfakefs | 4.5.4 | 4.5.5 | | pypi | pytest | 7.0.1 | 7.1.0 | | pypi | python-swiftclient | 3.13.0 | 3.13.1 | | pypi | sentry_sdk | 1.5.5 | 1.5.7 | | pypi | uvicorn | 0.17.4 | 0.17.6 | | pypi | websockets | 10.1 | 10.2 | --- setup.cfg | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/setup.cfg b/setup.cfg index bc8e85ac3..605fcd7bb 100644 --- a/setup.cfg +++ b/setup.cfg @@ -24,17 +24,17 @@ classifiers = include_package_data = True install_requires = bcrypt==3.2.0 - click==8.0.3 + click==8.0.4 click-option-group==0.5.3 - elasticsearch==7.17.0 - fastapi==0.73.0 + elasticsearch==8.1.0 + fastapi==0.75.0 gunicorn==20.1.0 Jinja2==3.0.3 ovh==0.5.0 pydantic==1.9.0 pyparsing==3.0.7 python-keystoneclient==4.4.0 - python-swiftclient==3.13.0 + python-swiftclient==3.13.1 pyyaml==6.0 requests==2.27.1 sentry_sdk==1.5.5 @@ -49,24 +49,24 @@ python_requires = >= 3.9 [options.extras_require] dev = - bandit==1.7.2 + bandit==1.7.4 black==22.1.0 factory-boy==3.2.1 - Faker==12.3.0 + Faker==13.3.2 flake8==4.0.1 - hypothesis==6.36.2 + hypothesis==6.39.3 ipdb==0.13.9 - ipython==8.0.1 + ipython==8.1.1 isort==5.10.1 logging-gelf==0.0.26 memory-profiler==0.60.0 mkdocs==1.2.3 mkdocs-click==0.5.0 - mkdocs-material==8.1.11 - mkdocstrings==0.18.0 - pyfakefs==4.5.4 + mkdocs-material==8.2.5 + mkdocstrings==0.18.1 + pyfakefs==4.5.5 pylint==2.12.2 - pytest==7.0.1 + pytest==7.1.0 pytest-cov==3.0.0 ci = twine==3.8.0 From 0c192b6734ec150a22ba2d5a70b6adfefd826172 Mon Sep 17 00:00:00 2001 From: Quitterie Lucas Date: Mon, 14 Mar 2022 17:57:21 +0100 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=90=9B(tests)=20fix=20tests=20with=20?= =?UTF-8?q?the=20new=20es=20version?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 8th version of elasticsearch was released. It implies to adapt some of the written tests to take into account the new features. --- src/ralph/backends/storage/fs.py | 2 +- src/ralph/defaults.py | 2 +- tests/api/test_statements_get.py | 2 +- tests/backends/database/test_es.py | 5 ++- tests/backends/storage/test_ldp.py | 4 +-- tests/fixtures/backends.py | 51 ++++++++++++++++-------------- tests/test_parsers.py | 2 +- 7 files changed, 35 insertions(+), 33 deletions(-) diff --git a/src/ralph/backends/storage/fs.py b/src/ralph/backends/storage/fs.py index 4b138ae2c..a91d9b135 100644 --- a/src/ralph/backends/storage/fs.py +++ b/src/ralph/backends/storage/fs.py @@ -78,7 +78,7 @@ def read(self, name, chunk_size=4096): logger.debug("Getting archive: %s", name) - with self._get_filepath(name).open("rb", encoding=LOCALE_ENCODING) as file: + with self._get_filepath(name).open("rb") as file: while chunk := file.read(chunk_size): sys.stdout.buffer.write(chunk) diff --git a/src/ralph/defaults.py b/src/ralph/defaults.py index 5d78efad6..91b03dbb9 100644 --- a/src/ralph/defaults.py +++ b/src/ralph/defaults.py @@ -124,7 +124,7 @@ def load_config(config_file_path): SWIFT_OS_IDENTITY_API_VERSION = config("RALPH_SWIFT_OS_IDENTITY_API_VERSION", "3") SWIFT_OS_PROJECT_DOMAIN_NAME = config("RALPH_SWIFT_OS_PROJECT_DOMAIN_NAME", "Default") SWIFT_OS_USER_DOMAIN_NAME = config("RALPH_SWIFT_OS_USER_DOMAIN_NAME", "Default") -ES_HOSTS = config("RALPH_ES_HOSTS", "localhost:9200").split(",") +ES_HOSTS = config("RALPH_ES_HOSTS", "http://localhost:9200").split(",") ES_MAX_SEARCH_HITS_COUNT = config("RALPH_ES_MAX_SEARCH_HITS_COUNT", 100) ES_POINT_IN_TIME_KEEP_ALIVE = config("RALPH_ES_POINT_IN_TIME_KEEP_ALIVE", "1m") CONVERTER_EDX_XAPI_UUID_NAMESPACE = config( diff --git a/tests/api/test_statements_get.py b/tests/api/test_statements_get.py index 1ed15334e..23beedbac 100644 --- a/tests/api/test_statements_get.py +++ b/tests/api/test_statements_get.py @@ -81,7 +81,7 @@ def teardown_es_index(): Clean up Elasticsearch after each test. """ yield - ES_INDICES_CLIENT.delete(ES_TEST_INDEX) + ES_INDICES_CLIENT.delete(index=ES_TEST_INDEX) # pylint: disable=invalid-name diff --git a/tests/backends/database/test_es.py b/tests/backends/database/test_es.py index 71f40f889..694a392cb 100644 --- a/tests/backends/database/test_es.py +++ b/tests/backends/database/test_es.py @@ -68,10 +68,9 @@ def test_backends_database_es_client_kwargs(es): client_options={"ca_certs": "/path/to/ca/bundle"}, ) - assert "ca_certs" in database.client.transport.kwargs - assert database.client.transport.kwargs.get("ca_certs") == "/path/to/ca/bundle" assert ( - database.client.transport.get_connection().pool.ca_certs == "/path/to/ca/bundle" + database.client.transport.node_pool.get().config.ca_certs + == "/path/to/ca/bundle" ) diff --git a/tests/backends/storage/test_ldp.py b/tests/backends/storage/test_ldp.py index 35b7ccead..5fd256e58 100644 --- a/tests/backends/storage/test_ldp.py +++ b/tests/backends/storage/test_ldp.py @@ -16,7 +16,7 @@ import requests from ralph.backends.storage.ldp import LDPStorage -from ralph.defaults import APP_DIR, HISTORY_FILE, LOCALE_ENCODING +from ralph.defaults import APP_DIR, HISTORY_FILE from ralph.exceptions import BackendParameterException @@ -382,7 +382,7 @@ def iter_content(self, chunk_size): """Fakes content file iteration.""" # pylint: disable=no-self-use - with archive_path.open("rb", encoding=LOCALE_ENCODING) as archive: + with archive_path.open("rb") as archive: while chunk := archive.read(chunk_size): yield chunk diff --git a/tests/fixtures/backends.py b/tests/fixtures/backends.py index 99b624e66..1cb87485e 100644 --- a/tests/fixtures/backends.py +++ b/tests/fixtures/backends.py @@ -67,37 +67,40 @@ def es_data_stream(): client = Elasticsearch(ES_TEST_HOSTS) # Create statements index template with enabled data stream - index_template = { - "index_patterns": [ES_TEST_INDEX_PATTERN], - "data_stream": {}, - "template": { - "mappings": { - "dynamic": True, - "dynamic_date_formats": [ - "strict_date_optional_time", - "yyyy/MM/dd HH:mm:ss Z||yyyy/MM/dd Z", - ], - "dynamic_templates": [], - "date_detection": True, - "numeric_detection": True, - }, - "settings": { - "index": { - "number_of_shards": "1", - "number_of_replicas": "1", - } - }, + index_patterns = [ES_TEST_INDEX_PATTERN] + data_stream = {} + template = { + "mappings": { + "dynamic": True, + "dynamic_date_formats": [ + "strict_date_optional_time", + "yyyy/MM/dd HH:mm:ss Z||yyyy/MM/dd Z", + ], + "dynamic_templates": [], + "date_detection": True, + "numeric_detection": True, + }, + "settings": { + "index": { + "number_of_shards": "1", + "number_of_replicas": "1", + } }, } - client.indices.put_index_template(name=ES_TEST_INDEX_TEMPLATE, body=index_template) + client.indices.put_index_template( + name=ES_TEST_INDEX_TEMPLATE, + index_patterns=index_patterns, + data_stream=data_stream, + template=template, + ) # Create a datastream matching the index template - client.indices.create_data_stream(ES_TEST_INDEX) + client.indices.create_data_stream(name=ES_TEST_INDEX) yield client - client.indices.delete_data_stream(ES_TEST_INDEX) - client.indices.delete_index_template(ES_TEST_INDEX_TEMPLATE) + client.indices.delete_data_stream(name=ES_TEST_INDEX) + client.indices.delete_index_template(name=ES_TEST_INDEX_TEMPLATE) @pytest.fixture diff --git a/tests/test_parsers.py b/tests/test_parsers.py index c232a4beb..ebcecbe9c 100644 --- a/tests/test_parsers.py +++ b/tests/test_parsers.py @@ -49,7 +49,7 @@ def test_parsers_gelfparser_parse_gzipped_file(fs, gelf_logger): # Compress the log file log_file_name = gelf_logger.handlers[0].stream.name gzipped_log_file_name = f"{log_file_name}.gz" - with open(log_file_name, "rb", encoding=LOCALE_ENCODING) as log_file: + with open(log_file_name, "rb") as log_file: with gzip.open(gzipped_log_file_name, "wb") as gzipped_log_file: shutil.copyfileobj(log_file, gzipped_log_file) From 7a4c16289e8449ad563e01ad0bc806b2784e0a0e Mon Sep 17 00:00:00 2001 From: Quitterie Lucas Date: Mon, 14 Mar 2022 18:06:00 +0100 Subject: [PATCH 3/4] =?UTF-8?q?=E2=AC=86=EF=B8=8F(project)=20upgrade=20ela?= =?UTF-8?q?sticsearch=20dependency?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://hub.docker.com/_/elasticsearch?tab=tags --- .circleci/config.yml | 3 ++- docker-compose.yml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 38080b86b..2c6c8ccac 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -176,12 +176,13 @@ jobs: password: $DOCKER_HUB_PASSWORD environment: RALPH_APP_DIR: ~/fun/.ralph - - image: elasticsearch:7.10.1 + - image: elasticsearch:8.1.0 auth: username: $DOCKER_HUB_USER password: $DOCKER_HUB_PASSWORD environment: discovery.type: single-node + xpack.security.enabled: "false" working_directory: ~/fun steps: - checkout diff --git a/docker-compose.yml b/docker-compose.yml index 0e4dfc466..0f31df503 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -20,9 +20,10 @@ services: # -- backends elasticsearch: - image: elasticsearch:7.16.3 + image: elasticsearch:8.1.0 environment: discovery.type: single-node + xpack.security.enabled: "false" ports: - "9200:9200" mem_limit: 2g From b9878708af9badf3ea494f653f7629e8321a3c51 Mon Sep 17 00:00:00 2001 From: Quitterie Lucas Date: Tue, 19 Apr 2022 11:24:21 +0200 Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=93=9D(project)=20update=20CHANGELOG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Upgrades: - `click` to `8.0.4` - `elasticsearch` to `8.1.0` - `fastapi` to `0.75.0` - `python-swiftclient` to `3.13.1` --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c8f61131..e1c84a329 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,13 @@ and this project adheres to ## [Unreleased] +### Changed + +- Upgrade `click` to `8.0.4` +- Upgrade `elasticsearch` to `8.1.0` +- Upgrade `fastapi` to `0.75.0` +- Upgrade `python-swiftclient` to `3.13.1` + ## [2.1.0] - 2022-04-13 ### Added