Skip to content

Test PERSISTENCE env vars#195

Merged
anisaoshafi merged 4 commits intomainfrom
drg-763-make-sure-persistence1-works-with-lstk
Apr 27, 2026
Merged

Test PERSISTENCE env vars#195
anisaoshafi merged 4 commits intomainfrom
drg-763-make-sure-persistence1-works-with-lstk

Conversation

@anisaoshafi
Copy link
Copy Markdown
Contributor

@anisaoshafi anisaoshafi commented Apr 23, 2026

Persistence and related snapshot configuration vars may be passed in host env prefixed with LOCALSTACK* or through config.toml env vars.

This PR adds a couple of related tests.

@anisaoshafi anisaoshafi force-pushed the drg-763-make-sure-persistence1-works-with-lstk branch from 3a62f31 to 4077b74 Compare April 24, 2026 12:59
envVars := containerEnvToMap(inspect.Config.Env)
assert.Equal(t, "1", envVars["PERSISTENCE"])
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

praise: good call adding a test to make sure we can enable persistence from config

Comment thread internal/container/start.go Outdated
strings.HasPrefix(e, "PERSISTENCE=") ||
strings.HasPrefix(e, "SNAPSHOT_SAVE_STRATEGY=") ||
strings.HasPrefix(e, "SNAPSHOT_LOAD_STRATEGY=") ||
strings.HasPrefix(e, "SNAPSHOT_FLUSH_INTERVAL=") {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

issue: I'm not convinced we should explicitly forward PERSISTENCE (and the other vars here).

  1. We should already forward all vars prefixed with LOCALSTACK_ so LOCALSTACK_PERSISTENCE=1 should work without code changes (maybe worth adding an integration test)
  2. We can also set PERSISTENCE=1 in config.toml (and you've added a test for it)

Isn't this enough? My concern is that it does not really scale to whitelist env vars and we also don't want to blindly forward all vars in the env because it can contain secrets or other unrelated vars.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good point, I will take a look and adjust this 🏃🏼

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The PR is now just a couple of tests since these configurations were already supported - thanks for poining that out. Feel free to take another look.

@anisaoshafi anisaoshafi force-pushed the drg-763-make-sure-persistence1-works-with-lstk branch from 4077b74 to 8069e2a Compare April 27, 2026 11:07
@anisaoshafi anisaoshafi changed the title Forward PERSISTENCE and snapshot env vars to emulator container Test PERSISTENCE env vars Apr 27, 2026
Comment thread internal/container/start_test.go Outdated
@anisaoshafi anisaoshafi force-pushed the drg-763-make-sure-persistence1-works-with-lstk branch from e2ecf79 to 1a7e11c Compare April 27, 2026 14:01
@anisaoshafi anisaoshafi merged commit 66533da into main Apr 27, 2026
8 checks passed
@anisaoshafi anisaoshafi deleted the drg-763-make-sure-persistence1-works-with-lstk branch April 27, 2026 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants