Skip to content

[Not for merging] Add a test for unmarshalling with incorrect type - #3645

Closed
denik wants to merge 1 commit into
mainfrom
denik/unmarshal_test
Closed

[Not for merging] Add a test for unmarshalling with incorrect type#3645
denik wants to merge 1 commit into
mainfrom
denik/unmarshal_test

Conversation

@denik

Copy link
Copy Markdown
Contributor

Test that shows that JSON unmarshaller in Go SDK is unpredictable when field have unexpected types (e.g. string like "$resources.jobs.foo.id" instead of a number). This makes JSON round trip approach introduced in https://github.com/databricks/cli/pull/2926/files#diff-b7bffa44a68a4b43193ab3157de6ff3844353f7b4903663a7552d1294dda1526R307 unsuitable for what it is used.

@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Sep 23, 2025

Copy link
Copy Markdown
Collaborator

Run: 17944743430

Env✅​pass🔄​flaky🙈​skip
✅​aws linux311529
✅​aws windows312528
✅​aws-ucws linux423427
✅​aws-ucws windows424426
✅​azure linux311528
✅​azure windows312527
🔄​azure-ucws linux4149426
🔄​azure-ucws windows4195425
🔄​gcp linux3082530
✅​gcp windows311529
11 failing tests:
Test Nameazure-ucws linuxazure-ucws windowsgcp linux
TestAccept✅​pass✅​pass🔄​flaky
TestAccept/bundle/deploy/dashboard/detect-change🔄​flaky✅​pass✅​pass
TestAccept/bundle/deploy/dashboard/generate_inplace🔄​flaky✅​pass✅​pass
TestAccept/bundle/deploy/dashboard/nested-folders🔄​flaky✅​pass✅​pass
TestAccept/bundle/deploy/dashboard/simple🔄​flaky🔄​flaky✅​pass
TestAccept/bundle/deploy/dashboard/simple_outside_bundle_root🔄​flaky🔄​flaky✅​pass
TestAccept/bundle/deploy/dashboard/simple_syncroot🔄​flaky🔄​flaky✅​pass
TestAccept/bundle/deployment/bind/dashboard🔄​flaky🔄​flaky✅​pass
TestAccept/bundle/deployment/bind/dashboard/recreation🔄​flaky✅​pass✅​pass
TestAccept/bundle/templates/default-python/combinations/serverless✅​pass✅​pass🔄​flaky
TestDashboardAssumptions_WorkspaceImport🔄​flaky🔄​flaky✅​pass

func TestUnmarshalResourceJob(t *testing.T) {
x := resources.Job{}
err := json.Unmarshal([]byte(inputJob), &x)
require.NoError(t, err)

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.

Do you know if/where this error gets swallowed?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

No, I did not debug this further than this.

github-merge-queueBot pushed a commit that referenced this pull request Sep 26, 2025
…N roundtrip (#3646)
## Why
For direct, we fetch configs as struct instances via GetResourceConfig,
which is using json roundtrip between dyn value and struct. That,
however, does not work well when there references in the config, see
#3645 for details.
This switches to converting dyn.Value with dyn/convert ToTyped function.
The function was not used previously because it did not handle
ForceSendFields correctly for embedded structs which caused JSON
marshaller in Go SDK to return error. This was fixed in
#3650 and
#3649
## Tests
Existing tests.
@github-actions

Copy link
Copy Markdown
Contributor

This PR has not received an update in a while. If you want to keep this PR open, please leave a comment below or push a new commit and auto-close will be canceled.

@denikdenik closed this Nov 26, 2025
denik added a commit that referenced this pull request May 20, 2026
…N roundtrip (#3646)
## Why
For direct, we fetch configs as struct instances via GetResourceConfig,
which is using json roundtrip between dyn value and struct. That,
however, does not work well when there references in the config, see
#3645 for details.
This switches to converting dyn.Value with dyn/convert ToTyped function.
The function was not used previously because it did not handle
ForceSendFields correctly for embedded structs which caused JSON
marshaller in Go SDK to return error. This was fixed in
#3650 and
#3649
## Tests
Existing tests.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@denik@eng-dev-ecosystem-bot@pietern