Skip to content

[DOCS] Put Cloud snippets under test #10831

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

Closed
wants to merge 19 commits into from
Closed
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
35 changes: 21 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ jobs:
- docs-basic
- docs-spark
env:
# gx cloud
GX_CLOUD_BASE_URL: ${{vars.MERCURY_BASE_URL}}
GX_CLOUD_ORGANIZATION_ID: ${{secrets.MERCURY_ORGANIZATION_ID}}
GX_CLOUD_ACCESS_TOKEN: ${{secrets.MERCURY_ACCESS_TOKEN}}
# google
GE_TEST_GCP_CREDENTIALS: ${{secrets.GE_TEST_GCP_CREDENTIALS}}
GE_TEST_GCP_PROJECT: ${{secrets.GE_TEST_GCP_PROJECT}}
Expand Down Expand Up @@ -168,6 +172,9 @@ jobs:
SNOWFLAKE_SCHEMA: ${{secrets.SNOWFLAKE_SCHEMA}}
SNOWFLAKE_WAREHOUSE: ${{secrets.SNOWFLAKE_WAREHOUSE}}
SNOWFLAKE_ROLE: ${{secrets.SNOWFLAKE_ROLE}}
permissions:
id-token: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -178,10 +185,9 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Run docs_snippet_checker
run: |
yarn install
python ci/checks/validate_docs_snippets.py
cache: "pip"
cache-dependency-path: |
reqs/requirements-dev-test.txt

- name: Authenticate with GCP
uses: google-github-actions/auth@v2
Expand Down Expand Up @@ -209,24 +215,25 @@ jobs:
- name: Install mssql odbc driver
run: ./scripts/install_mssql_odbc_driver.sh

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.9"
cache: "pip"
cache-dependency-path: |
reqs/requirements-dev-test.txt

- name: Install dependencies
run: |
pip install $(grep -E '^(invoke)' reqs/requirements-dev-contrib.txt)
invoke deps --gx-install -m '${{ matrix.doc-step }}'

- name: Run docs_snippet_checker
run: |
yarn install
python ci/checks/validate_docs_snippets.py

- name: Configure ECR AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-east-1
role-to-assume: arn:aws:iam::258143015559:role/github-amazonec2containerregistryreadonly

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
with:
registries: "258143015559"

- name: Run the tests
run: invoke docs-snippet-tests '${{ matrix.doc-step }}' --up-services --verbose --reports
Expand Down
6 changes: 0 additions & 6 deletions docs/docusaurus/docs/cloud/connect/connect_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
# TODO: This needs to be put under test when the GX Cloud docs snippet testing environment has been created.
"""


def set_up_context_for_example(context):
pass


# EXAMPLE SCRIPT STARTS HERE:
# <snippet name="docs/docusaurus/docs/cloud/connect/connect_python.py - full code example">
# <snippet name="docs/docusaurus/docs/cloud/connect/connect_python.py - get cloud context">
Expand All @@ -24,7 +19,6 @@ def set_up_context_for_example(context):
# Hide this
assert type(context).__name__ == "CloudDataContext"
# Hide this
set_up_context_for_example(context)

# <snippet name="docs/docusaurus/docs/cloud/connect/connect_python.py - list data sources">
print(context.list_datasources())
Expand Down
61 changes: 27 additions & 34 deletions docs/docusaurus/docs/components/examples_under_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,20 @@
# data_context_dir="",
backend_dependencies=[],
),
# TODO: Re-enable this once a --docs-tests-cloud environment is available.
# IntegrationTestFixture(
# # To test, run:
# # pytest --docs-tests --cloud -k "create_a_cloud_data_context" tests/integration/test_script_runner.py
# name="create_a_cloud_data_context",
# user_flow_script="docs/docusaurus/docs/core/set_up_a_gx_environment/_create_a_data_context/cloud_data_context.py",
# # data_dir="",
# # data_context_dir="",
# backend_dependencies=[],
# ),
IntegrationTestFixture(
# To test, run:
# pytest --docs-tests --cloud -k "connect_python" tests/integration/test_script_runner.py
name="connect_python",
user_flow_script="docs/docusaurus/docs/cloud/connect/connect_python.py",
backend_dependencies=[BackendDependencies.CLOUD],
),
IntegrationTestFixture(
# To test, run:
# pytest --docs-tests --cloud -k "create_a_cloud_data_context" tests/integration/test_script_runner.py
name="create_a_cloud_data_context",
user_flow_script="docs/docusaurus/docs/core/set_up_a_gx_environment/_create_a_data_context/cloud_data_context.py",
backend_dependencies=[BackendDependencies.CLOUD],
),
IntegrationTestFixture(
# To test, run:
# pytest --docs-tests -k "create_a_file_data_context" tests/integration/test_script_runner.py
Expand Down Expand Up @@ -646,28 +650,17 @@

# Extend the docs_tests list with the above sublists (only the docs_tests list is imported
# into `test_script_runner.py` and actually used in CI checks).
docs_tests.extend(install_gx)

docs_tests.extend(try_gx)

# docs_tests.extend(install_gx)
# docs_tests.extend(try_gx)
docs_tests.extend(create_a_data_context)

docs_tests.extend(connect_to_filesystem_data_create_a_data_source)
docs_tests.extend(connect_to_filesystem_data_create_a_data_asset)
docs_tests.extend(connect_to_filesystem_data_create_a_batch_definition)

docs_tests.extend(connect_to_dataframe_data)

docs_tests.extend(docs_example_scripts_run_validations)

docs_tests.extend(example_scripts_for_define_expectations)

docs_tests.extend(docs_examples_customize_expectations)

docs_tests.extend(docs_examples_trigger_actions_based_on_validation_results)

docs_tests.extend(docs_example_configure_project_settings)

docs_tests.extend(docs_examples_configure_data_docs)

docs_tests.extend(learn_data_quality_use_cases)
# docs_tests.extend(connect_to_filesystem_data_create_a_data_source)
# docs_tests.extend(connect_to_filesystem_data_create_a_data_asset)
# docs_tests.extend(connect_to_filesystem_data_create_a_batch_definition)
# docs_tests.extend(connect_to_dataframe_data)
# docs_tests.extend(docs_example_scripts_run_validations)
# docs_tests.extend(example_scripts_for_define_expectations)
# docs_tests.extend(docs_examples_customize_expectations)
# docs_tests.extend(docs_examples_trigger_actions_based_on_validation_results)
# docs_tests.extend(docs_example_configure_project_settings)
# docs_tests.extend(docs_examples_configure_data_docs)
# docs_tests.extend(learn_data_quality_use_cases)
12 changes: 6 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -658,27 +658,27 @@ markers = [
"bigquery: mark test as bigquery-dependent.",
"clickhouse: mark a test as Clickhouse-dependent.",
"cloud: mark test as being relevant to Great Expectations Cloud.",
"databricks: mark test as requiring databricks.",
"docs-basic: mark a test as a docs test, that does not require additional credentials.",
"docs-creds-needed: mark a test as a docs test that needs additional cloud credentials (these will not run on public forks).",
"databricks: mark test as requiring databricks.",
"docs: mark a test as a docs test.",
"docs-spark: temporarily mark a test as a docs test that depends on spark.",
"integration: mark test as an integration test.",
"docs: mark a test as a docs test.",
"external_sqldialect: mark test as requiring install of an external sql dialect.",
"filesystem: mark tests using the filesystem as the storage backend.",
"integration: mark test as an integration test.",
"mssql: mark a test as mssql-dependent.",
"mysql: mark a test as mysql-dependent.",
"openpyxl: mark a test for openpyxl-dependent, which is for Excel files.",
"performance: mark a test as a performance test for BigQuery. These aren't run in our PR or release pipeline",
"postgresql: mark a test as postgresql-dependent.",
"project: mark a test that verifies properties of the gx project",
"pyarrow: mark a test as PyArrow-dependent.",
"snowflake: mark a test as snowflake-dependent.",
"sqlalchemy_version_compatibility: mark test as required for sqlalchemy version compatibility.",
"sqlite: mark test requiring sqlite",
"slow: mark tests taking longer than 1 second.",
"snowflake: mark a test as snowflake-dependent.",
"spark: mark a test as Spark-dependent.",
"spark_connect: mark a test as Spark Connect-dependent.",
"sqlalchemy_version_compatibility: mark test as required for sqlalchemy version compatibility.",
"sqlite: mark test requiring sqlite",
"trino: mark a test as trino-dependent.",
"unit: mark a test as a unit test.",
"v2_api: mark test as specific to the v2 api (e.g. pre Data Connectors).",
Expand Down
3 changes: 3 additions & 0 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -847,17 +847,20 @@ class TestDependencies(NamedTuple):
"reqs/requirements-dev-test.txt",
"reqs/requirements-dev-azure.txt",
"reqs/requirements-dev-bigquery.txt",
"reqs/requirements-dev-cloud.txt",
"reqs/requirements-dev-redshift.txt",
"reqs/requirements-dev-snowflake.txt",
# "Deprecated API features detected" warning/error for test_docs[split_data_on_whole_table_bigquery] when pandas>=2.0 # noqa: E501
"reqs/requirements-dev-sqlalchemy1.txt",
),
services=("mercury",),
extra_pytest_args=(
"--aws",
"--azure",
"--bigquery",
"--redshift",
"--snowflake",
"--cloud",
"--docs-tests",
),
),
Expand Down
1 change: 1 addition & 0 deletions tests/integration/backend_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ class BackendDependencies(enum.Enum):
SQLALCHEMY = "SQLALCHEMY"
SNOWFLAKE = "SNOWFLAKE"
TRINO = "TRINO"
CLOUD = "CLOUD"
Loading
Loading