fix(elasticache): serverless endpoint port + replication-group members + snapshot export (bug-hunt)#2300
Merged
Merged
Conversation
…s + snapshot export/temp-dir (bug-hunt)
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.
Summary
Bug-hunt batch fixing four ElastiCache compatibility issues in
fakecloud-elasticache. Behavior-only; no SDK/doc/count changes except a minimal cross-service S3 write surface for snapshot export.Port:0when no Docker runtime. In non-Docker setups (the default locally/CI)CreateServerlessCachecreates the cache directly asavailablebut leftendpoint.port = 0, because the port backfill only runs on the Docker-backed tick. Every connection string then ended in:0(unconnectable). Now, when there is no runtime, the endpoint (and reader endpoint) is assigned the conventional engine port at create time (6379 redis/valkey, 11211 memcached) via the existingengine_default_porthelper. The Docker path still backfills its real mapped host port.NodeGroupMemberregardless of replicas. Each<NodeGroup>emitted exactly one primary member, so the Terraform provider derivedreplicas_per_node_group = len(NodeGroupMembers) - 1 = 0and produced a perpetual plan diff. Now each shard emits 1 primary + N replica members (CurrentRoleprimary/replica) matching the group's configured replica count (current_replicas_per_shard), with synthesized<rg>-NNNcluster ids, clamped at AWS's 5-replica ceiling.ExportServerlessCacheSnapshotdiscardedS3BucketName. The required bucket was parsed then dropped (let _ = bucket;). It now performs a real cross-service S3 write: the snapshot export artifact is written into the target bucket via the shared S3 state (same pattern firehose/athena/config use), with a real MD5 ETag. A missing bucket is rejected withInvalidParameterValue, matching AWS. Wiredwith_s3(...)on the service inmain.rs./tmphardcode. Already resolved in the current tree:snapshot_rdb_temp_pathroots understd::env::temp_dir(). Verified no other hardcoded/tmpremains in the crate source.Test plan
fakecloud-elasticachelib, 240 pass):create_serverless_cache_without_runtime_assigns_default_port— no runtime → create + describe report<Port>6379</Port>, never<Port>0</Port>.replication_group_emits_primary_and_replica_members—NumCacheClusters=3→ describe shows 1 primary + 2 replica members with the expectedrg-repl-00Nids.export_serverless_cache_snapshot_writes_object_to_s3— export writessnap-x.rdbinto the target bucket (non-zero size, quoted ETag); missing bucket →InvalidParameterValue.elasticache_create_replication_group_round_trips_extended_fieldsto assert each shard exposes 1 primary + 1 replicaNodeGroupMemberover the real SDK.cargo clippy -p fakecloud-elasticache --all-targets -- -D warningsclean;cargo fmt;cargo build -p fakecloud(server) green. Docker-gated e2e tests are skipped in this environment (Docker unreachable); the e2e change is purely additive inside the existingrequire_docker_or_skipguard, so it is identical to main when Docker is absent, and the e2e crate compiles cleanly.Summary by cubic
Fixes three ElastiCache compatibility issues: serverless caches now get a real port when no runtime is present, replication groups report correct primary/replica members, and serverless snapshot export actually writes to S3. Adds minimal S3 wiring to support the export.
Bug Fixes
NodeGroupMembers per shard (clamped to 5) with stable IDs like<rg>-NNN, fixing Terraform’s perpetual diff.ExportServerlessCacheSnapshotwrites a*.rdbobject into the given S3 bucket and returnsInvalidParameterValuewhen the bucket is missing; snapshot temp files use the system temp dir.Dependencies
fakecloud-s3,bytes, andmd-5. Wired S3 into the service viawith_s3(...)so exports are visible through shared S3 state.Written for commit 3c6c948. Summary will update on new commits.