Repository navigation
[WIP] Add the testing property of pipelines to bundles #7300
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
base: tharun/pipelines-test-pr3-junit
Are you sure you want to change the base?
Changes from all commits
b427a6f
fcf3dfa
400f3b9
0632ee5
f59ee38
3d93063
e895d35
a72100d
093f7c8
286aa60
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| * Fix `-e ./folder` in environment dependencies, which failed before deploy. A local project folder after `-e`, with optional extras such as `-e ./project[test]`, now maps to its deployed folder. ([#7300](https://github.com/databricks/cli/pull/7300)) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| * `bundle plan` now shows a change to a pipeline's `testing` that was made outside the bundle, and `bundle deploy` undoes it. ([#7300](https://github.com/databricks/cli/pull/7300)) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| * Add the `testing` property of pipelines, which sets the test sources and test-only dependencies that `databricks pipelines test` runs with. ([#7300](https://github.com/databricks/cli/pull/7300)) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| bundle: | ||
| name: editable-folder | ||
|
|
||
| resources: | ||
| jobs: | ||
| my_job: | ||
| name: my job | ||
| tasks: | ||
| - task_key: main | ||
| python_wheel_task: | ||
| package_name: orders | ||
| entry_point: main | ||
| environment_key: default | ||
| environments: | ||
| - environment_key: default | ||
| spec: | ||
| client: "1" | ||
| dependencies: | ||
| - -e ./project | ||
|
|
||
| pipelines: | ||
| my_pipeline: | ||
| name: my pipeline | ||
| environment: | ||
| dependencies: | ||
| - -e ./project | ||
| testing: | ||
| sources: | ||
| - glob: | ||
| include: /Workspace/Shared/orders/tests/** | ||
| environment: | ||
| dependencies: | ||
| - -e ./project[test] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Cloud = false | ||
| EnvMatrix.DMS = ["", "true"] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
|
|
||
| >>> [CLI] bundle validate -o json | ||
| { | ||
| "job": [ | ||
| "-e /Workspace/Users/[USERNAME]/.bundle/editable-folder/default/files/project" | ||
| ], | ||
| "pipeline": [ | ||
| "-e /Workspace/Users/[USERNAME]/.bundle/editable-folder/default/files/project" | ||
| ], | ||
| "testing": [ | ||
| "-e /Workspace/Users/[USERNAME]/.bundle/editable-folder/default/files/project[test]" | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| [project] | ||
| name = "orders" | ||
| version = "0.1.0" | ||
|
|
||
| [project.optional-dependencies] | ||
| test = ["faker"] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| trace $CLI bundle validate -o json | jq '{job: .resources.jobs.my_job.environments[0].spec.dependencies, pipeline: .resources.pipelines.my_pipeline.environment.dependencies, testing: .resources.pipelines.my_pipeline.testing.environment.dependencies}' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Cloud = false | ||
| Env.DATABRICKS_BUNDLE_ENABLE_EXPERIMENTAL_PIPELINE_TESTING = "true" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| bundle: | ||
| name: pipeline-testing-dependencies | ||
|
|
||
| resources: | ||
| pipelines: | ||
| orders: | ||
| name: orders | ||
| testing: | ||
| sources: | ||
| - glob: | ||
| include: /Workspace/Shared/orders/tests/** | ||
| environment: | ||
| dependencies: | ||
| # Accepted, as by the API. | ||
| - --editable /Workspace/Shared/orders[test] | ||
| - --requirement=/Workspace/Shared/orders/requirements.txt | ||
| - -r ./orders/requirements.txt | ||
| # Rejected, as by the API. | ||
| - faker==33.0 | ||
| - git+https://github.com/example/helpers | ||
| - /Workspace/Shared/orders/requirements.txt | ||
| - --requirement ./orders/requirements.txt | ||
| - /Workspace/Shared/orders -i https://example.com/simple |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Cloud = false | ||
| EnvMatrix.DMS = ["", "true"] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
|
|
||
| >>> musterr [CLI] bundle validate | ||
| Error: testing.environment.dependencies must point at files, not "faker==33.0" | ||
| at resources.pipelines.orders.testing.environment.dependencies[3] | ||
| in databricks.yml:19:15 | ||
|
|
||
| A test dependency is a project folder, a wheel, or a requirements file after -r, in the bundle, under /Workspace/, or under /Volumes/. Declare test packages in a project file, such as the test extra of a pyproject.toml, and reference its folder, for example -e ./project[test]. For a path in the bundle, use -e or -r followed by a space. URLs, other pip options, and .. are not supported. | ||
|
|
||
| Error: testing.environment.dependencies must point at files, not "git+https://github.com/example/helpers" | ||
| at resources.pipelines.orders.testing.environment.dependencies[4] | ||
| in databricks.yml:20:15 | ||
|
|
||
| A test dependency is a project folder, a wheel, or a requirements file after -r, in the bundle, under /Workspace/, or under /Volumes/. Declare test packages in a project file, such as the test extra of a pyproject.toml, and reference its folder, for example -e ./project[test]. For a path in the bundle, use -e or -r followed by a space. URLs, other pip options, and .. are not supported. | ||
|
|
||
| Error: testing.environment.dependencies needs -r before the requirements file "/Workspace/Shared/orders/requirements.txt" | ||
| at resources.pipelines.orders.testing.environment.dependencies[5] | ||
| in databricks.yml:21:15 | ||
|
|
||
| Without -r, pip treats the file as a package to install. For example: -r ./tests/requirements.txt. | ||
|
|
||
| Error: testing.environment.dependencies must point at files, not "--requirement ./orders/requirements.txt" | ||
| at resources.pipelines.orders.testing.environment.dependencies[6] | ||
| in databricks.yml:22:15 | ||
|
|
||
| A test dependency is a project folder, a wheel, or a requirements file after -r, in the bundle, under /Workspace/, or under /Volumes/. Declare test packages in a project file, such as the test extra of a pyproject.toml, and reference its folder, for example -e ./project[test]. For a path in the bundle, use -e or -r followed by a space. URLs, other pip options, and .. are not supported. | ||
|
|
||
| Error: testing.environment.dependencies must point at files, not "/Workspace/Shared/orders -i https://example.com/simple" | ||
| at resources.pipelines.orders.testing.environment.dependencies[7] | ||
| in databricks.yml:23:15 | ||
|
|
||
| A test dependency is a project folder, a wheel, or a requirements file after -r, in the bundle, under /Workspace/, or under /Volumes/. Declare test packages in a project file, such as the test extra of a pyproject.toml, and reference its folder, for example -e ./project[test]. For a path in the bundle, use -e or -r followed by a space. URLs, other pip options, and .. are not supported. | ||
|
|
||
| Name: pipeline-testing-dependencies | ||
| Target: default | ||
| Workspace: | ||
| User: [USERNAME] | ||
| Path: /Workspace/Users/[USERNAME]/.bundle/pipeline-testing-dependencies/default | ||
|
|
||
| Found 5 errors | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| trace musterr $CLI bundle validate |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # Runs only against the local test server. | ||
| Cloud = false | ||
| Env.DATABRICKS_BUNDLE_ENABLE_EXPERIMENTAL_PIPELINE_TESTING = "true" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| bundle: | ||
| name: pipeline-testing-disabled | ||
|
|
||
| resources: | ||
| pipelines: | ||
| orders: | ||
| name: orders | ||
| testing: | ||
| sources: | ||
| - glob: | ||
| include: ./tests/** |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Cloud = false | ||
| EnvMatrix.DMS = ["", "true"] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
|
|
||
| >>> musterr [CLI] bundle validate | ||
| Error: the testing property of pipelines is experimental. Set DATABRICKS_BUNDLE_ENABLE_EXPERIMENTAL_PIPELINE_TESTING=true to enable it | ||
| at resources.pipelines.orders.testing | ||
| in databricks.yml:9:9 | ||
|
|
||
| Name: pipeline-testing-disabled | ||
| Target: default | ||
|
|
||
| Found 1 error |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| trace musterr $CLI bundle validate | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Non-blocking: this case is a single |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| # Runs only against the local test server. The experimental gate is off. | ||
| Cloud = false |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| def test_orders(): | ||
| pass |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| bundle: | ||
| name: pipeline-testing-same-name-libraries | ||
|
|
||
| resources: | ||
| pipelines: | ||
| orders: | ||
| name: orders | ||
| libraries: | ||
| - file: | ||
| path: ./transformations/orders.py | ||
| environment: | ||
| dependencies: | ||
| - ./pipeline/test_helpers-0.1-py3-none-any.whl | ||
| testing: | ||
| sources: | ||
| - glob: | ||
| include: ./tests/** | ||
| environment: | ||
| dependencies: | ||
| # A different wheel with the same file name would be uploaded to the same path. | ||
| - ./tests/test_helpers-0.1-py3-none-any.whl |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Cloud = false | ||
| EnvMatrix.DMS = ["", "true"] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
|
|
||
| >>> errcode [CLI] bundle deploy | ||
| Error: Duplicate local library names: test_helpers-0.1-py3-none-any.whl | ||
| at resources.pipelines.orders.environment.dependencies[0] | ||
| resources.pipelines.orders.testing.environment.dependencies[0] | ||
| in databricks.yml:13:13 | ||
| databricks.yml:21:15 | ||
|
|
||
| Local library names must be unique but found libraries with the same name: pipeline/test_helpers-0.1-py3-none-any.whl, tests/test_helpers-0.1-py3-none-any.whl | ||
|
|
||
|
|
||
| Exit code: 1 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| trace errcode $CLI bundle deploy |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| # Runs only against the local test server. | ||
| Cloud = false | ||
| Env.DATABRICKS_BUNDLE_ENABLE_EXPERIMENTAL_PIPELINE_TESTING = "true" | ||
|
|
||
| [[Repls]] | ||
| Old = '\\' | ||
| New = '/' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| def test_orders(): | ||
| pass |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| x = 1 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| bundle: | ||
| name: pipeline-testing | ||
|
|
||
| resources: | ||
| pipelines: | ||
| orders: | ||
| name: orders | ||
| libraries: | ||
| - glob: | ||
| include: ./transformations/** | ||
| testing: | ||
| sources: | ||
| - glob: | ||
| include: ./tests/** | ||
| environment: | ||
| dependencies: | ||
| - --editable ${workspace.file_path}[test] | ||
| - -r ./tests/requirements.txt | ||
| - ./dist/*.whl |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Cloud = false | ||
| EnvMatrix.DMS = ["", "true"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non-blocking: each of the five errors repeats the same three-line explanation, and which inputs are accepted or rejected is already unit-tested in
pipeline_testing_dependencies_test.go. One or two errors here would pin the message text, with less prose to keep in sync.