Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LocalstackContainer API enhancement #702

Closed

Conversation

lbroudoux
Copy link

@lbroudoux lbroudoux commented Jan 5, 2024

As discussed in #701

  • Align Localstack module API on Java version
  • Add environment variables retrieval after container startup

Thank you!

Signed-off-by: Laurent Broudoux [email protected]

…- Add environment variables retrieval after container startup

Signed-off-by: Laurent Broudoux <[email protected]>
Copy link

netlify bot commented Jan 5, 2024

Deploy Preview for testcontainers-node ready!

Name Link
🔨 Latest commit 02bd668
🔍 Latest deploy log https://app.netlify.com/sites/testcontainers-node/deploys/6598261d18de0500088593e3
😎 Deploy Preview https://deploy-preview-702--testcontainers-node.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Signed-off-by: Laurent Broudoux <[email protected]>
it("should use access environment variables and default creds", async () => {
const container = await new LocalstackContainer()
.withEnvironment({
DEFAULT_REGION: "eu-west-3",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Where does the DEFAULT_REGION convention come from? I had a quick look at the docs and found https://docs.localstack.cloud/references/configuration/#legacy, which says that it's no longer supported.

Copy link
Author

Choose a reason for hiding this comment

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

Yes, I think you're right. Many things have changed with 3.x and I should have refreshed my knowledge. The point is the default image is still localstack/localstack:2.2.0. As multi-region has been introduced incrementally, this may not affect the module, but it may be nice to upgrade to 3.x to definitely get rid of this question. What do you think?


/**
* Provides a default access key that is preconfigured to communicate with a given simulated service.
* <a href="https://github.com/localstack/localstack/blob/master/doc/interaction/README.md?plain=1#L32">AWS Access Key</a>
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm getting a 404 for these URLs. I also couldn't find reference to these environment variables in the LS config

Copy link
Author

Choose a reason for hiding this comment

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

Sorry, I blindly copy/paste here the comments coming from testcontainers-java/localstack


expect(container.getRegion()).toBe("eu-west-3");
expect(container.getAccessKey()).toBe("test");
expect(container.getSecretKey()).toBe("test");
Copy link
Collaborator

Choose a reason for hiding this comment

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

The container is mapping the environment variables to these getter methods, but this test is not checking that LS is actually using them. From the deprecation notices in the docs I get the impression they're not being used.

Copy link
Author

Choose a reason for hiding this comment

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

Yes, I think you're right... I see nothing in current documentation referencing these... Here again, I tried to reproduce the behavior of the test containers-java/local stack module, but this may be inappropriate.

@lbroudoux
Copy link
Author

lbroudoux commented Jan 12, 2024

I've done some other client tests with the amazon/aws-cli:2.7.27 image, and it seems that whatever the credentials - we should have at least AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY env var set but they could be totally random - things are working! This is because IAM enforcement is turned off by default.

So I tend to think this PR (and related issue) is, in fact, no longer needed with the recent version of localstack...

@cristianrgreco
Copy link
Collaborator

cristianrgreco commented Jan 12, 2024

Sounds good to me @lbroudoux, shall we close this PR and raise another for upgrading the LS version to v3?

@djakielski
Copy link
Contributor

Hey @lbroudoux could you also fix missing reference in mkdocs.yml to add localstack to the documentation? It was forgotten in PR #640.

@cristianrgreco or should I create a separate PR with this small fix for you?

 - Modules:
      - ....
      - Localstack: modules/localstack.md

@cristianrgreco
Copy link
Collaborator

Hey @lbroudoux could you also fix missing reference in mkdocs.yml to add localstack to the documentation? It was forgotten in PR #640.

@cristianrgreco or should I create a separate PR with this small fix for you?

 - Modules:
      - ....
      - Localstack: modules/localstack.md

If you could that would be much appreciated!

@djakielski
Copy link
Contributor

djakielski commented Jan 21, 2024

Hey @lbroudoux could you also fix missing reference in mkdocs.yml to add localstack to the documentation? It was forgotten in PR #640.
@cristianrgreco or should I create a separate PR with this small fix for you?

 - Modules:
      - ....
      - Localstack: modules/localstack.md

If you could that would be much appreciated!

@cristianrgreco Done, see #710

@lbroudoux
Copy link
Author

Sorry I was away from keyboard these last days. I think we can close that PR as unsolved and I'll submit another one tomorrow to upgrade to localstack latest 3.x.

@lbroudoux lbroudoux closed this Jan 21, 2024
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