Skip to content

Migrate AWS emulator to localstack/localstack image#163

Closed
carole-lavillonniere wants to merge 1 commit intomainfrom
carole/drg-591
Closed

Migrate AWS emulator to localstack/localstack image#163
carole-lavillonniere wants to merge 1 commit intomainfrom
carole/drg-591

Conversation

@carole-lavillonniere
Copy link
Collaborator

@carole-lavillonniere carole-lavillonniere commented Mar 24, 2026

Motivation

LocalStack consolidated localstack/localstack-pro into localstack/localstack. The CLI needs to pull from the new image name.

Changes

  • Update emulatorImages map to use localstack instead of localstack-pro for the AWS emulator — affects both the Docker image pulled and the product name sent to the license API
  • Add integration test asserting the container is started from localstack/localstack:latest
  • Replace hardcoded real image/product names in unit tests with generic placeholders (test-image:latest, test-product:1.2.3) since those tests don't assert on the actual name
  • Document in CLAUDE.md that integration tests are black-box and must not import internal packages

Tests

  • Existing unit tests pass with test-image:latest placeholders
  • New image sub-test in TestStartCommandSetsUpContainerCorrectly verifies the container is started from localstack/localstack:latest
  • TestLicenseValidationSuccess updated to expect localstack as the product name in the license request

Closes DRG-591

@carole-lavillonniere carole-lavillonniere marked this pull request as ready for review March 24, 2026 07:56
@coderabbitai
Copy link

coderabbitai bot commented Mar 24, 2026

📝 Walkthrough

Walkthrough

Changes update the AWS emulator container image reference from localstack-pro to localstack, refactor the container start logic to hardcode the license product name while deriving image references dynamically, and update test fixtures throughout to use generic test-image:latest instead of specific product names. An integration test is added to verify the final image name, and a testing guideline is documented requiring integration tests to treat the CLI binary as a black box.

Changes

Cohort / File(s) Summary
Documentation & Testing Guidelines
CLAUDE.md
Added explicit rule requiring integration tests in test/integration/ to treat the compiled CLI binary as a black box, forbidding imports from internal packages and requiring hardcoded expected values.
Container Configuration
internal/config/containers.go
Changed AWS emulator container image product name from localstack-pro to localstack in the emulatorImages map, affecting ContainerConfig.ProductName() and Image() resolution for EmulatorAWS.
Container Start Logic
internal/container/start.go
Removed c.ProductName() call and stopped populating runtime.ContainerConfig.ProductName; hardcoded license request ProductInfo.Name to "localstack-pro" instead of deriving it from container config.
Test Fixtures - Image References
internal/container/telemetry_test.go, internal/ui/app_test.go, internal/ui/components/pull_progress_test.go
Updated mock container image values from "localstack/localstack-pro:latest" to "test-image:latest" across multiple test cases without altering assertions or control flow.
Test Fixtures - String Data
internal/ui/components/error_display_test.go
Replaced test input license identifier string from localstack-pro:4.14.1.dev206 to test-product:1.2.3 in title-wrapping test.
Integration Test Validation
test/integration/start_test.go
Added subtest asserting inspect.Config.Image equals localstack/localstack:latest within TestStartCommandSetsUpContainerCorrectly.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • Replace container name in command output #63: Modifies internal/container/start.go to change how container/product names are determined; the main PR removes ContainerConfig.ProductName usage while this PR replaces dynamic container names in start-related messages.
  • Update header information #65: Updates internal/config/containers.go around emulator naming and mappings; the main PR changes the EmulatorAWS image name while this PR adds emulator display names functionality.
  • Wrap error title to terminal width #128: Directly relates to the TestErrorDisplay_TitleWrapsToWidth test modified in the main PR by updating its test input.

Suggested reviewers

  • silv-io
  • anisaoshafi
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title directly reflects the main objective—migrating the AWS emulator from localstack-pro to localstack image—which is the primary change across the codebase.
Description check ✅ Passed The description clearly outlines the motivation, changes, and tests, providing context for the LocalStack image consolidation and the corresponding updates throughout the PR.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch carole/drg-591

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
internal/container/start.go (1)

359-359: ⚠️ Potential issue | 🟡 Minor

Error message will have empty product name.

containerConfig.ProductName is never populated in the Start function (see lines 141-152 where the runtime.ContainerConfig is built without setting ProductName). This will produce error messages like "license validation failed for :1.2.3: ..." with an empty product name.

🐛 Proposed fix

Either populate ProductName in the container config, or use a different identifier here:

-		return fmt.Errorf("license validation failed for %s:%s: %w", containerConfig.ProductName, version, err)
+		return fmt.Errorf("license validation failed for %s:%s: %w", containerConfig.Image, version, err)

Using containerConfig.Image would produce a more informative error message like "license validation failed for localstack/localstack:latest:1.2.3: ...".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@internal/container/start.go` at line 359, The error message in Start uses
containerConfig.ProductName which is never set, causing empty product names; fix
by either populating ProductName when building the runtime.ContainerConfig (the
code that assembles containerConfig in Start) or change the fmt.Errorf call that
returns "license validation failed for %s:%s: %w" to use a reliable identifier
such as containerConfig.Image (or fall back to containerConfig.Image when
ProductName is empty) so the error shows a meaningful image/product name; update
the code around the license validation return to reference the chosen field.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@internal/container/start.go`:
- Line 359: The error message in Start uses containerConfig.ProductName which is
never set, causing empty product names; fix by either populating ProductName
when building the runtime.ContainerConfig (the code that assembles
containerConfig in Start) or change the fmt.Errorf call that returns "license
validation failed for %s:%s: %w" to use a reliable identifier such as
containerConfig.Image (or fall back to containerConfig.Image when ProductName is
empty) so the error shows a meaningful image/product name; update the code
around the license validation return to reference the chosen field.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: eb37d7d3-ad52-4d25-95a7-9256dcb6b0fb

📥 Commits

Reviewing files that changed from the base of the PR and between 67d8336 and 5979bb6.

📒 Files selected for processing (8)
  • CLAUDE.md
  • internal/config/containers.go
  • internal/container/start.go
  • internal/container/telemetry_test.go
  • internal/ui/app_test.go
  • internal/ui/components/error_display_test.go
  • internal/ui/components/pull_progress_test.go
  • test/integration/start_test.go
✅ Files skipped from review due to trivial changes (5)
  • internal/ui/components/pull_progress_test.go
  • internal/ui/components/error_display_test.go
  • CLAUDE.md
  • internal/container/telemetry_test.go
  • internal/ui/app_test.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • test/integration/start_test.go
  • internal/config/containers.go

opts.Logger.Error("license server response (HTTP %d): %s", licErr.Status, licErr.Detail)
}
emitEmulatorStartError(ctx, tel, containerConfig, telemetry.ErrCodeLicenseInvalid, err.Error())
return fmt.Errorf("license validation failed for %s:%s: %w", containerConfig.ProductName, version, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Will containerConfig.ProductName be empty here? Can we hard-code as well?

@silv-io
Copy link
Member

silv-io commented Mar 24, 2026

I'm wondering, this change should then also block users from using versions lower than 2026.3, because that won't be the pro image anymore, no?

@carole-lavillonniere
Copy link
Collaborator Author

Closing for now because of the concern mentioned by @silv-io #163 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants