-
Notifications
You must be signed in to change notification settings - Fork 71
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
Add tests for default-python template on different Python versions #2025
Conversation
930057b
to
1f8896c
Compare
I've also considered https://pkg.go.dev/github.com/stretchr/testify/require#TestingT to avoid dependency on /internal/ but that one does not have Logf method that I use
Instead, store original WD on env var.
abcf45d
to
418564a
Compare
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.
Few remaining questions/suggestions.
} | ||
|
||
func AssertEqualTexts(t testutil.TestingT, filename1, filename2, expected, out string) { | ||
if len(out) < 1000 && len(expected) < 1000 { |
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.
Constants (used in multiple spots) can be a top level const
, e.g. textDiffCharacterThreshold
or smth.
} | ||
|
||
// compare strings and ignore forward vs backward slashes | ||
func almostSameStrings(v1, v2 any) bool { |
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.
Where is this needed? Didn't see it before.
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.
This is to fix slashes on windows. See below "whl" for example. https://github.com/databricks-eng/eng-dev-ecosystem/actions/runs/12432516778/job/34712095471
testdiff.go:49: Allowed differences between C:\a\eng-dev-ecosystem\eng-dev-ecosystem\ext\cli\integration\bundle\testdata\default_python\bundle_summary.txt and Output from [bundle summary --output json]:
==> replace /bundle/terraform/exec_path C:\Users\RUNNER~1\AppData\Local\Temp\TestDefaultPython3.<NUMID>\<NUMID>\project_name_$UNIQUE_PRJ\.databricks\bundle\dev\bin\terraform.exe old=/tmp/.../terraform
==> replace /include/0 resources\project_name_$UNIQUE_PRJ.job.yml old=resources/project_name_$UNIQUE_PRJ.job.yml
==> replace /include/1 resources\project_name_$UNIQUE_PRJ.pipeline.yml old=resources/project_name_$UNIQUE_PRJ.pipeline.yml
==> remove /resources/jobs/project_name_$UNIQUE_PRJ_job/email_notifications <nil> old=map[on_failure:[$USERNAME]]
==> replace /resources/jobs/project_name_$UNIQUE_PRJ_job/job_clusters/0/new_cluster/node_type_id Standard_D3_v2 old=i3.xlarge
==> replace /resources/jobs/project_name_$UNIQUE_PRJ_job/tasks/2/libraries/0/whl dist\*.whl old=dist/*.whl
==> replace /resources/jobs/project_name_$UNIQUE_PRJ_job/url https://$DATABRICKS_HOST/jobs/<NUMID> old=https://$DATABRICKS_HOST/jobs/<NUMID>?o=<NUMID>
==> remove /resources/pipelines/project_name_$UNIQUE_PRJ_pipeline/catalog <nil> old=main
==> replace /resources/pipelines/project_name_$UNIQUE_PRJ_pipeline/url https://$DATABRICKS_HOST/pipelines/<UUID> old=https://$DATABRICKS_HOST/pipelines/<UUID>?o=<NUMID>
==> add /workspace/current_user/externalId <UUID> old=<nil>
==> replace /workspace/current_user/groups/0/display admins old=team.engineering
==> remove /workspace/current_user/name/familyName <nil> old=$USERNAME
If integration tests don't run automatically, an authorized user can run them manually by following the instructions below: Trigger: Inputs:
Checks will be approved automatically on success. |
Changes
Add new type of test helpers that run the command and compare full output (golden files approach).
In case of JSON, there is also an option to ignore certain paths.
Add test for different versions of Python to go through bundle init default-python / validate / deploy / summary.
Tests
New integration tests.