Repository navigation
Make examples/ uptestable and E2E test them - #206
Merged
fernandezcuesta merged 5 commits intoOct 15, 2026
Merged
Conversation
The Terraform-converted examples pointed projectIdSelector and orgIdSelector at labels that no Project or Organization in the same file carries, or hardcoded Atlas IDs, so uptest could not run them. Take the project and organization from the uptest datasource keys mongodbatlas.project_id and mongodbatlas.org_id instead, in both scopes, and document the keys in the Makefile and CLAUDE.md. Signed-off-by: Jonasz Małecki <jonasz@upbound.io>
…import IDs - project_api_key: use api_key_id only (project IDs are only in project_assignment) - cloud_user_team_assignment: template uses user_id; add userId reference to UserOrgAssignment - resource_policy, encryption_at_rest_private_endpoint: use the plain provider-assigned ID - ai_model_api_key, cloud_backup_collection_restore_job, metric_integration, stream_connection_failover, log_integration: new computedKeyID constructor for plugin-framework resources without an id attribute - ai_model_rate_limit: read the external name from model_group_name - x509_authentication_database_user: add username to the state ID - cluster: add provider_name to the state ID - encodedStateGetIDFn: decode external names written as full state IDs by v1.1.x - remove GetImportIDFn and the separator argument; the no-fork connectors never run terraform import - refs.ExtractParamPath: rename the second parameter to isObservation Signed-off-by: Jesús Fernández <7312236+fernandezcuesta@users.noreply.github.com> (cherry picked from commit 89194cc) Signed-off-by: Jonasz Małecki <jonasz@upbound.io>
Make every example runnable with uptest, alone or in one batch: - Add the missing cross-resource references the Terraform examples expressed as expressions (service account client_id, IAM role IDs, cluster names, team_id, processor workspace_name, x509 username, query limit tenant_name) and fix the OutageSimulation cluster_name reference, which resolved to "<projectId>-<name>". - Resolve references through a runtime scheme (upjet cmd/resolver, internal/apis) so cross API-group references cannot form import cycles. - make generate now copies only new generated examples, so it no longer overwrites the hand-maintained examples/. - Rewrite the examples: datasource project, org and user IDs, the cheapest cluster tier each resource supports, random cluster names and emails, in-file targets for every selector, file-prefixed names and labels, uptest timeouts, and manual-intervention on examples that need infrastructure outside Atlas or cannot be cleaned up. - Add a pre-assert hook that loads the Atlas sample datasets for the OnlineArchive and search Index examples, and drop the stale metric integration example. - Bump golangci-lint to v2.14.0, which reads Go 1.27.2 export data. Signed-off-by: Jonasz Małecki <jonasz@upbound.io>
jonasz-lasut
marked this pull request as ready for review
October 13, 2026 18:48
jonasz-lasut
force-pushed
the
uptestable-examples
branch
from
October 13, 2026 18:48
97ba7fc to
5fac590
Compare
Selectors resolved before their target was created picked up the target's metadata.name, because service accounts, database users and federated database instances start with the name initializer's external name, and the value is cached once resolved. Read service-account client_id from status.atProvider and the x509 username and query limit tenant_name from the target's spec instead. The outage simulation reads its cluster name from the cluster's observation, so the simulation starts only after the cluster is created: a simulation started earlier keeps the cluster UPDATING and its create never ends. Project, resource policy and encryption at rest private endpoint external names stay empty until Create instead of starting as metadata.name. References to a Project cached that placeholder as the project ID, and Atlas answers a resource policy read with it with 400 instead of 404, so the policy was never created. The Atlas SDK rejects the empty ID client-side, which now counts as not found. Federated database instances never became up to date: Terraform Read sets cloud_provider_config and data_process_region only when Atlas returns them, so every plan reported them as unknown. Drop those unknown-only diffs while the blocks are unset in config and state. The third-party integration uses the provider-assigned integration ID as external name. Terraform Read sets the ID to that value, so the templated <project_id>-<type> name caused a diff on every observe. Example fixes from the e2e runs: - The network container takes its region from the new mongodbatlas.aws_container_region datasource key, so it does not collide with an existing AWS container in the test project. - The global cluster config uses an M30 cluster because Atlas does not shard M10 clusters. - A pre-delete hook deletes the search Deployment before its cluster: once the cluster is gone, Atlas answers search deployment calls with 400 ATLAS_SEARCH_DEPLOYMENT_INVALID_ATTRIBUTE and the Deployment never finalizes. - The outage simulation runs on a two-region cluster, as Atlas no longer supports simulating an outage on a single-region cluster, and uptest asserts only Synced for that cluster while it is UPDATING. - The snapshot restore job uses download delivery, so it does not overwrite its cluster, and the snapshot example no longer repeats it. - The sample data hook reads the load job ID from _id, the field the Atlas CLI returns. - The Datadog metric and third-party integrations take the API key, region and OTLP endpoint from new datadog.* datasource keys and create their own Secret, so they no longer need manual intervention. Signed-off-by: Jonasz Małecki <jonasz@upbound.io>
jonasz-lasut
force-pushed
the
uptestable-examples
branch
from
October 13, 2026 18:49
5fac590 to
e450924
Compare
…able Signed-off-by: Jonasz Małecki <jonasz@upbound.io>
jonasz-lasut
force-pushed
the
uptestable-examples
branch
from
October 15, 2026 07:47
540906c to
bb071a4
Compare
fernandezcuesta
approved these changes
Oct 15, 2026
Collaborator
|
Thanks for your huge effort here 🥇 |
This was referenced Oct 15, 2026
Closed
This was referenced Oct 15, 2026
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.
Description of your changes
Makes the examples in
examples/runnable with uptest, alone or in one batch, and fixes the provider issues the e2e runs uncovered.Builds on #201, cherry-picked here as
b7c3f2c: merge #201 first or supersede it with this PRFixes #196
Provider
clientId, IAM role IDs, cluster names,teamId, stream processorworkspaceName, x509usernameand query limittenantName. Fixes the OutageSimulationclusterNamereference, whichresolved to
<projectId>-<name>.metadata.name, and a selector that resolved early cached that name. The outage simulation waits for the cluster'sobserved name: a simulation started during creation keeps the cluster
UPDATING, and its create never finishes.cmd/resolverfor both scopes (internal/apis), so cross-group references no longer form import cycles.cloud_provider_configanddata_process_regiondiffs.idat every observe.Examples
upjet.upbound.io/manual-interventionwith the reason.make generatecopies only new generated examples, so it no longer overwritesexamples/.I have:
make reviewable testto ensure this PR is ready for review.How has this code been tested
make generate,make lintandgo test ./config/... ./internal/....Batch 1 (no clusters):
Batch 2 (clusters and datadog):
Batch 3 (organization level MRs):
Omitted the following due to lack of required integrations: