Skip to content

Update linter integration tests to ensure notebook source is linted#2853

Merged
nfx merged 13 commits intomainfrom
fix/accidental-integration-test-success
Oct 9, 2024
Merged

Update linter integration tests to ensure notebook source is linted#2853
nfx merged 13 commits intomainfrom
fix/accidental-integration-test-success

Conversation

@asnare
Copy link
Copy Markdown
Contributor

@asnare asnare commented Oct 7, 2024

Changes

This PR updates some linting related integration tests that weren't testing what they expected:

  • The tests were intending to verify linting of notebooks, and set up a notebook with code to trigger a linting record.
  • The linting code was failing prematurely due to the notebook extension, not due to the problem in source.

Some usage of greenlet has also been replaced: it was previously unknown to the linter and various integration tests assumed this. Since #2830 these tests have no longer been working correctly.

Related Issues

Overlaps with #2852.
Overlaps with #2867.
Overlaps with #2868.
Resolves #2843.
Resolves #2844.
Resolves #2845.
Resolves #2846.

Tests

  • updated integration tests

Includes improved verification to ensure it's passing for the right reason.
@asnare asnare self-assigned this Oct 7, 2024
@asnare asnare requested a review from a team as a code owner October 7, 2024 13:58
@asnare asnare added bug internal this pull request won't appear in release notes labels Oct 7, 2024
@github-actions
Copy link
Copy Markdown

github-actions bot commented Oct 7, 2024

✅ 42/42 passed, 25m58s total

Running from acceptance #6538

@asnare asnare changed the title Update test_running_real_workflow_linter_job fixture: it wasn't testing what it thought it was Update linter integration tests to ensure notebook source is linted Oct 7, 2024
Copy link
Copy Markdown
Contributor

@JCZuurmond JCZuurmond left a comment

Choose a reason for hiding this comment

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

Has overlapping changes with #2852

Comment thread tests/integration/source_code/test_jobs.py Outdated
Comment thread tests/integration/source_code/test_jobs.py Outdated
Comment thread tests/integration/source_code/test_jobs.py Outdated
Copy link
Copy Markdown
Contributor

@JCZuurmond JCZuurmond left a comment

Choose a reason for hiding this comment

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

Some changes to use the latest version of the fixtures, otherwise looks good

Comment thread tests/integration/source_code/test_jobs.py Outdated
installation_ctx.deployed_workflows.relay_logs("experimental-workflow-linter")
assert False, "No workflow problems found"
dfsa_records = installation_ctx.directfs_access_crawler_for_paths.snapshot()
assert dfsa_records
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

just some record? Or a specific amount?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
assert dfsa_records
assert dfsa_records == [...]

can we please assert for specific values?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It was intended to just check for the presence of records, like the check above.

I've added a comment (cf544c1) to this effect.

Comment thread tests/integration/source_code/test_jobs.py Outdated
Comment thread tests/integration/source_code/test_jobs.py Outdated
Comment thread tests/integration/source_code/test_jobs.py Outdated
),
notebook_task=jobs.NotebookTask(notebook_path=str(notebook)),
)
j = make_job(tasks=[task])
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Remove most of the above and use make_job(content=...)

libraries=[compute.Library(pypi=compute.PythonPyPiLibrary(package="greenlet"))],
libraries=[compute.Library(pypi=compute.PythonPyPiLibrary(package="dbt-core==1.8.7"))],
)
j = make_job(tasks=[task])
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
j = make_job(tasks=[task])
j = make_job(content="import greenlet", task_type=jobs.SparkPythonTask)

libraries=[compute.Library(pypi=compute.PythonPyPiLibrary(package="greenlet"))],
libraries=[compute.Library(pypi=compute.PythonPyPiLibrary(package="dbt-core==1.8.7"))],
)
j = make_job(tasks=[task])
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

same here

installation_ctx.deployed_workflows.relay_logs("experimental-workflow-linter")
assert False, "No workflow problems found"
dfsa_records = installation_ctx.directfs_access_crawler_for_paths.snapshot()
assert dfsa_records
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
assert dfsa_records
assert dfsa_records == [...]

can we please assert for specific values?

assert False, "No workflow problems found"
dfsa_records = installation_ctx.directfs_access_crawler_for_paths.snapshot()
used_table_records = installation_ctx.used_tables_crawler_for_paths.snapshot()
assert dfsa_records and used_table_records
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

could we assert for exact values? e.g. assert dfsa_records == [...]

Comment thread tests/integration/source_code/test_jobs.py
@nfx nfx merged commit 444d474 into main Oct 9, 2024
@nfx nfx deleted the fix/accidental-integration-test-success branch October 9, 2024 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal this pull request won't appear in release notes

Projects

None yet

3 participants