Repository navigation
Fail a create that returns no resource id - #7358
Draft
janniklasrose wants to merge 1 commit into
Draft
janniklasrose wants to merge 1 commit into
janniklasrose wants to merge 1 commit into
Conversation
An empty id would be saved as-is, and the next plan would treat the resource as missing and create it again. Co-authored-by: Isaac <no-reply@databricks.com>
Collaborator
Integration test reportCommit: 6173eec
Top 3 slowest tests (at least 2 minutes):
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
DeploymentUnit.Createsaved whatever idDoCreatereturned, including an empty string, andUpdateWithIDdid the same forDoUpdateWithID. An empty id is stored as-is, and on the next planGetResourceIDreturns nothing, so the engine treats the resource as missing and creates it again. Both paths now return an error before saving state when the id is empty.Two unit tests with a minimal fake adapter cover the create and update-with-id paths and assert that no state is written.
Why
The resource README describes this check as a framework guarantee; the engine did not implement it, so an adapter that trusted the README could leave untracked resources behind.
Tests
go test ./bundle/direct/... -count=1, including the two new tests../task lint-q,./task ws.This pull request and its description were written by Isaac.