diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 011878bb..bb29959c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,6 +17,14 @@ on: - '**/remove-old-artifacts.yml' jobs: + markdown-link-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - uses: gaurav-nelson/github-action-markdown-link-check@v1 + with: + use-quiet-mode: 'yes' + folder-path: 'docs' build: runs-on: ubuntu-latest strategy: diff --git a/docs/development-guide/DevelopmentGuide.md b/docs/development-guide/DevelopmentGuide.md index 578132fd..391b3237 100644 --- a/docs/development-guide/DevelopmentGuide.md +++ b/docs/development-guide/DevelopmentGuide.md @@ -26,10 +26,10 @@ The AWS Advanced Python Driver uses the following tests to verify its correctnes The AWS Advanced Python Driver has the following tests to verify its performance: -| Tests | Description | -|--------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| Connection plugin manager benchmarks | The [benchmarks](../../benchmarks/README.md) subproject measures the overhead from executing Python method calls with multiple connection plugins enabled. | -| Manually-triggered performance tests | The [failover plugin performance tests](../../tests/integration/container/test_failover_performance.py) and [enhanced failure monitoring performance tests](../..tests/integration/container/test_read_write_splitting_performance.py) measure the plugins' performance under different configurations | +| Tests | Description | +|--------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Connection plugin manager benchmarks | The [benchmarks](../../benchmarks/README.md) subproject measures the overhead from executing Python method calls with multiple connection plugins enabled. | +| Manually-triggered performance tests | The [failover plugin performance tests](../../tests/integration/container/test_failover_performance.py) and [enhanced failure monitoring performance tests](../../tests/integration/container/test_read_write_splitting_performance.py) measure the plugins' performance under different configurations | ### Running the Tests diff --git a/docs/development-guide/LoadablePlugins.md b/docs/development-guide/LoadablePlugins.md index 21181d70..51ebbe54 100644 --- a/docs/development-guide/LoadablePlugins.md +++ b/docs/development-guide/LoadablePlugins.md @@ -26,29 +26,29 @@ A short example of these steps is provided [below](#Example). ### Creating Custom Plugins -To create a custom plugin, create a new class that extends the [Plugin](/aws_advanced_python_wrapper/plugin.py) class. +To create a custom plugin, create a new class that extends the [Plugin](../../aws_advanced_python_wrapper/plugin.py) class. The `Plugin` class provides a simple implementation for all `Plugin` methods. By default, requested Python database methods will be called without additional operations. This is helpful when the custom plugin only needs to override one (or a few) methods from the `Plugin` interface. See the following classes for examples: -- [IamAuthPlugin](/aws_advanced_python_wrapper/iam_plugin.py) +- [IamAuthPlugin](../../aws_advanced_python_wrapper/iam_plugin.py) - The `IamAuthPlugin` class only overrides the `connect` method because the plugin is only concerned with creating database connections with IAM database credentials. -- [ExecuteTimePlugin](/aws_advanced_python_wrapper/execute_time_plugin.py) +- [ExecuteTimePlugin](../../aws_advanced_python_wrapper/execute_time_plugin.py) - The `ExecuteTimePlugin` only overrides the `execute` method because it is only concerned with elapsed time during execution. It does not establish new connections or set up any host list provider. -A `PluginFactory` implementation is also required for the new custom plugin. This factory class is used to register and initialize custom plugins. See [ExecuteTimePluginFactory](/aws_advanced_python_wrapper/execute_time_plugin.py) for a simple implementation example. +A `PluginFactory` implementation is also required for the new custom plugin. This factory class is used to register and initialize custom plugins. See [ExecuteTimePluginFactory](../../aws_advanced_python_wrapper/execute_time_plugin.py) for a simple implementation example. ### Subscribed Methods -When executing a Python method, the plugin manager will only call a specific plugin method if the Python method is within its set of subscribed methods. For example, the [ReadWriteSplittingPlugin](/aws_advanced_python_wrapper/read_write_splitting_plugin.py) subscribes to Python methods and setters that change the read-only value of the connection, but does not subscribe to other common `Connection` or `Cursor` methods. Consequently, this plugin will not be triggered by method calls like `Connection.commit` or `Cursor.execute`. +When executing a Python method, the plugin manager will only call a specific plugin method if the Python method is within its set of subscribed methods. For example, the [ReadWriteSplittingPlugin](../../aws_advanced_python_wrapper/read_write_splitting_plugin.py) subscribes to Python methods and setters that change the read-only value of the connection, but does not subscribe to other common `Connection` or `Cursor` methods. Consequently, this plugin will not be triggered by method calls like `Connection.commit` or `Cursor.execute`. The `subscribed_methods` attribute specifies the set of Python methods that a plugin is subscribed to in the form of a set of strings (`Set[str]`). All plugins must implement/define the `subscribed_methods` attribute. Plugins can subscribe to any of the standard PEP249 [Connection methods](https://peps.python.org/pep-0249/#connection-methods) or [Cursor methods](https://peps.python.org/pep-0249/#cursor-methods). They can also subscribe to the target driver methods listed in the corresponding driver dialect's `_network_bound_methods` attribute: -- [Postgres network bound methods](/aws_advanced_python_wrapper/pg_driver_dialect.py) -- [MySQL network bound methods](/aws_advanced_python_wrapper/mysql_driver_dialect.py) +- [Postgres network bound methods](../../aws_advanced_python_wrapper/pg_driver_dialect.py) +- [MySQL network bound methods](../../aws_advanced_python_wrapper/mysql_driver_dialect.py) Plugins can also subscribe to specific [pipelines](./Pipelines.md) by including the subscription key in their `subscribed_methods` attribute and implementing the equivalent pipeline method: diff --git a/docs/using-the-python-driver/SupportForRDSMultiAzDBCluster.md b/docs/using-the-python-driver/SupportForRDSMultiAzDBCluster.md index 28f74d30..45e77a47 100644 --- a/docs/using-the-python-driver/SupportForRDSMultiAzDBCluster.md +++ b/docs/using-the-python-driver/SupportForRDSMultiAzDBCluster.md @@ -61,9 +61,9 @@ We have created many examples in the [examples](../examples) folder demonstratin The following plugins have been tested and confirmed to work with Amazon RDS Multi-AZ DB Clusters: -* [Aurora Connection Tracker Plugin](/docs/using-the-python-driver/using-plugins/UsingTheAuroraConnectionTrackerPlugin.md) -* [Failover Connection Plugin](/docs/using-the-python-driver/using-plugins/UsingTheFailoverPlugin.md) -* [Host Monitoring Connection Plugin](/docs/using-the-python-driver/using-plugins/UsingTheHostMonitoringPlugin.md) +* [Aurora Connection Tracker Plugin](../using-the-python-driver/using-plugins/UsingTheAuroraConnectionTrackerPlugin.md) +* [Failover Connection Plugin](../using-the-python-driver/using-plugins/UsingTheFailoverPlugin.md) +* [Host Monitoring Connection Plugin](../using-the-python-driver/using-plugins/UsingTheHostMonitoringPlugin.md) The compatibility of other plugins has not been tested at this time. They may function as expected or potentially result in unhandled behavior. Use at your own discretion. diff --git a/tests/unit/test_verify_links.py b/tests/unit/test_verify_links.py deleted file mode 100644 index 97dcba41..00000000 --- a/tests/unit/test_verify_links.py +++ /dev/null @@ -1,71 +0,0 @@ -# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"). -# You may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from os import path, walk -from re import findall, search -from typing import List - -import pytest -from requests import request - - -@pytest.fixture -def docs_list(): - doc_list = [] - for root, dirs, files in walk("."): - for file in files: - if file.endswith(".md"): - file_path = str(path.join(root, file)) - file_list = [file_path] - doc_list = doc_list + file_list - return doc_list - - -@pytest.fixture -def docs_dict(docs_list): - doc_re = r".*\/" - doc_dict = {} - for doc in docs_list: - doc_dict[doc] = search(doc_re, doc).group(0) - return doc_dict - - -@pytest.fixture -def urls_list(docs_list: List[str]): - link_re = r"\((https?://(?!github.com/awslabs/aws-advanced-python-wrapper)[a-zA-Z.\\/-]+)\)" - new_list: List[str] = [] - for doc in docs_list: - with open(doc) as f: - list = findall(link_re, f.read()) - new_list = new_list + list - return new_list - - -def test_verify_relative_links(docs_dict, docs_list): - link_re = r"\((?P\./[\w\-\./]+)[#\w-]*\)" - for doc in docs_list: - with open(doc) as f: - list = findall(link_re, f.read()) - for link in list: - full_link = docs_dict[doc] + link - assert "jdbc" not in full_link - assert path.exists(full_link) - - -def test_verify_urls(urls_list: list): - for url in urls_list: - response = request("GET", url) - - assert "jdbc" not in url - assert response.status_code == 200