fix: complete endpoint coverage and the defects the new tests found - #4
Merged
Merged
Conversation
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.
Follow-up to #3, from a coverage and polish review of the endpoint resources. Three parts: acceptance coverage for what nothing exercised, the defects that coverage immediately found, and a prose pass.
Defects
All three were invisible to unit tests.
quicknode_endpoint_jwthas never worked.POST /v0/endpoints/{id}/security/jwtsrejects a body with nokid:The provider modelled
kidas a computed output and never sent one.kidis now a required input that forces replacement. That matches the API and matches what a caller needs: the same value goes in thekidheader of the tokens signed with the matching private key.quicknode_endpoint_domain_maskcould not survive a refresh. The create route answers withdomain_mask;GET /v0/endpoints/{id}/securityanswers withdomain. The client readdomain_maskin both places, so after a refresh thedomainattribute was empty and every plan proposed a replacement:Security entries disappear from state while their toggle is off.
GET /v0/endpoints/{id}/securityomits a list entirely when the matching toggle is disabled. An entry that was created successfully reads back asnulluntil the toggle is enabled. The entry resources read that as a deletion and dropped the resource from state, so the next apply created a duplicate. This is reachable by following the provider's own advice, which recommends building an allowlist before turning enforcement on.Readnow leaves state alone when a disabled toggle is the reason it cannot see the entry.Endpoint label
labelbecomesOptional + Computed.PATCH /v0/endpoints/{id}requires a label, so Quicknode has no way to clear one; removing the attribute used to send an empty string on the next apply. It now leaves the endpoint's label in place and Terraform stops tracking it, which settles into an empty plan.Acceptance coverage
Every resource now has a test. Before this branch the suite covered 5 of the 9 resources.
TestAccEndpoint_labelSurvivesRemovallabelleaves it aloneTestAccEndpoint_tagsStatusAndHeaderip_custom_headerTestAccEndpointToken_lifecyclequicknode_endpoint_token, import by idTestAccEndpointJWT_importByNamequicknode_endpoint_jwt, import by nameTestAccSecurityEntries_importByValuequicknode_endpoint_domain_maskand_referrer, import by valueTestAccSecurityEntry_survivesDisabledToggleAll 13 cases pass against the live API. The JWT case uses a throwaway RSA public key generated for it; the matching private key was discarded.
Prose
"rather than" appeared 63 times across 29 files, 13 of them in documentation published to the Registry. It is gone. Alongside that:
safe_http_urldescription no longer repeats URL-assembly advice that the provider index already gives.NOTESwere four-sentence paragraphs; they are one-liners.// Update exists only to satisfy the interfaceare one line each.Still unmodelled
Scope decisions, unchanged: account-level tag rename and delete, endpoint-to-team assignment,
GET /v0/endpoints/{id}/urls(the endpoint read already carries the URLs), and the metrics, logs, usage and billing read routes.