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

PythonMutator: Fix relative path error #2253

Merged
merged 6 commits into from
Jan 29, 2025

Conversation

kanterov
Copy link
Contributor

@kanterov kanterov commented Jan 28, 2025

Changes

Fix relative path errors in the Python mutator that was failing during deployment since v0.239.1.

Before that:

% databricks bundle deploy  
Deploying resources...
Updating deployment state...
Error: failed to compute relative path for job jobs_as_code_project_job: Rel: can't make resources/jobs_as_code_project_job.py relative to /Users/$USER/jobs_as_code_project

As a result, the bundle was deployed, but the deployment state wasn't updated.

Tests

Unit tests, adding acceptance tests in #2254

Copy link
Contributor

@pietern pietern left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you elaborate on what was broken and/or how it manifested?

@@ -120,7 +126,7 @@ func TestPythonMutator_loadResources(t *testing.T) {

assert.Equal(t, []dyn.Location{
{
File: "src/examples/job1.py",
File: pathlib.Join(rootPath, "src/examples/job1.py"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect you need to use filepath here as well, or it won't test equal on Windows.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 , I keep forgetting which one is which

Copy link
Contributor

@pietern pietern left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The version referenced in the PR summary doesn't exist, can you update?

@@ -166,11 +166,11 @@ func TestLoadOutput(t *testing.T) {
}

func TestParsePythonLocations(t *testing.T) {
expected := dyn.Location{File: "foo.py", Line: 1, Column: 2}
expected := dyn.Location{File: "/tmp/my_project/foo.py", Line: 1, Column: 2}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can run filepath.Clean to make is platform native.

Copy link

An authorized user can trigger integration tests manually by following the instructions below:

Trigger:
go/deco-tests-run/cli

Inputs:

  • PR number: 2253
  • Commit SHA: d33ef358f17dbb38c4f0bc41d690b38c3b4011e7

Checks will be approved automatically on success.

@kanterov
Copy link
Contributor Author

@pietern I've updated comments for relative vs. absolute paths and added more tests covering both cases

@kanterov kanterov requested a review from pietern January 29, 2025 11:07
@pietern pietern enabled auto-merge January 29, 2025 13:37
@pietern pietern added this pull request to the merge queue Jan 29, 2025
Merged via the queue into databricks:main with commit 13596eb Jan 29, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants