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

Add support for explicitEmptyCollections payloadType #3540

Merged
merged 1 commit into from
Nov 12, 2023

Conversation

matthchr
Copy link
Member

This fixes #3522.

  • Use this new payloadType for AKS resources, because the AKS RP doesn't treat "myProperty": null any different than omission of "myProperty" entirely, which meaans that it doesn't correctly clear properties that it should.
  • Update test recordings.

How does this PR make you feel:
gif

If applicable:

  • this PR contains documentation
  • this PR contains tests

@matthchr matthchr added the capz Required for CAPZ ASO adoption label Nov 10, 2023
@matthchr matthchr added this to the v2.4.0 milestone Nov 10, 2023
@@ -418,6 +418,8 @@ func (c *armTypeCreator) createARMProperty(
// See https://azure.github.io/azure-service-operator/design/adr-2023-04-patch-collections/ for how we're solving it.
result = result.WithoutTag("json", "omitempty")

case config.ExplicitEmptyCollections:
fallthrough
Copy link
Member

Choose a reason for hiding this comment

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

don't see too many of these lol

codeGenerationContext: codeGenerationContext,
},
typeConversionBuilder: astmodel.NewConversionFunctionBuilder(c.idFactory, codeGenerationContext),
typeConversionBuilder: astmodel.NewConversionFunctionBuilder(c.idFactory, codeGenerationContext, false),
Copy link
Member

Choose a reason for hiding this comment

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

Is there a better option than passing a mysterious false here?

Copy link
Member Author

Choose a reason for hiding this comment

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

I've changed this somewhat so I think it's clearer

v2/internal/controllers/samples_test.go Outdated Show resolved Hide resolved
@matthchr matthchr force-pushed the feature/empty-collections branch 2 times, most recently from b8d786f to f57b138 Compare November 11, 2023 08:09
@codecov-commenter
Copy link

codecov-commenter commented Nov 11, 2023

Codecov Report

Merging #3540 (a5401ec) into main (311afed) will decrease coverage by 0.05%.
Report is 6 commits behind head on main.
The diff coverage is 58.44%.

@@            Coverage Diff             @@
##             main    #3540      +/-   ##
==========================================
- Coverage   54.04%   53.99%   -0.05%     
==========================================
  Files        1573     1578       +5     
  Lines      656726   657622     +896     
==========================================
+ Hits       354905   355103     +198     
- Misses     244338   244925     +587     
- Partials    57483    57594     +111     
Files Coverage Δ
...service/v1api20210501/managed_cluster_types_gen.go 53.58% <100.00%> (+0.06%) ⬆️
...i20210501/managed_clusters_agent_pool_types_gen.go 51.89% <100.00%> (+0.14%) ⬆️
...service/v1api20230201/managed_cluster_types_gen.go 45.76% <100.00%> (+0.06%) ⬆️
...i20230201/managed_clusters_agent_pool_types_gen.go 45.25% <100.00%> (+0.12%) ⬆️
.../v1api20230202preview/managed_cluster_types_gen.go 51.66% <100.00%> (+0.27%) ⬆️
...02preview/managed_clusters_agent_pool_types_gen.go 50.92% <100.00%> (+0.10%) ⬆️
...nerservice/v1api20230315preview/fleet_types_gen.go 62.37% <100.00%> (+0.12%) ⬆️
...ervice/v1beta20210501/managed_cluster_types_gen.go 51.93% <100.00%> (+0.06%) ⬆️
...a20210501/managed_clusters_agent_pool_types_gen.go 50.66% <100.00%> (+0.14%) ⬆️
.../internal/armconversion/arm_conversion_function.go 55.10% <ø> (ø)
... and 9 more

... and 46 files with indirect coverage changes

@matthchr
Copy link
Member Author

/ok-to-test sha=f57b138

1 similar comment
@matthchr
Copy link
Member Author

/ok-to-test sha=f57b138

This fixes Azure#3522.

* Use this new payloadType for AKS resources, because the AKS RP doesn't
  treat "myProperty": null any different than omission of "myProperty"
  entirely, which meaans that it doesn't correctly clear properties that
  it should.
* Update test recordings.
@matthchr matthchr force-pushed the feature/empty-collections branch from f57b138 to a5401ec Compare November 12, 2023 06:53
@matthchr
Copy link
Member Author

/ok-to-test sha=a5401ec

@@ -66,21 +66,101 @@ interactions:
code: 200
duration: ""
- request:
body: '{"location":"westus2","name":"asotest-keyvault-ngmgjs","properties":{"accessPolicies":[{"applicationId":"00000000-0000-0000-0000-000000000000","objectId":"00000000-0000-0000-0000-000000000000","permissions":{"certificates":["get"],"keys":["get"],"secrets":["get"],"storage":["get"]},"tenantId":"00000000-0000-0000-0000-000000000000"}],"enableSoftDelete":false,"sku":{"family":"A","name":"standard"},"tenantId":"00000000-0000-0000-0000-000000000000"}}'
body: ""
Copy link
Member

Choose a reason for hiding this comment

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

Is this payload change expected?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's for a different URL than before (though it doesn't look it, if you see down on line 76 the URL is new), so I think the answer is yes.

GET shouldn't have a request body, so this is right.

This is probably because I changed some of the KV-using tests to purge+create so that they didn't need a manual step to start.

@matthchr
Copy link
Member Author

/ok-to-test sha=a5401ec

@matthchr matthchr added this pull request to the merge queue Nov 12, 2023
Merged via the queue into Azure:main with commit e864652 Nov 12, 2023
9 checks passed
@matthchr matthchr deleted the feature/empty-collections branch November 12, 2023 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
capz Required for CAPZ ASO adoption
Projects
5 participants