Skip to content

Conversation

@rqbazan
Copy link
Contributor

@rqbazan rqbazan commented Aug 22, 2025

Description

Hey there! ✋

I made a small change to the Valkey test container to allow passing a username option. Right now, my workaround is to create a generic container like this:

const container = new GenericContainer(image)
  .withName(name)
  .withStartupTimeout(120_000)
  .withWaitStrategy(Wait.forLogMessage('Ready to accept connections'))
  .withExposedPorts({
    container: 6379,
    host: port,
  })
  .withCommand([
    'valkey-server',
    ...(password ? [`--requirepass "${password}"`] : []),
    ...(username ? [`--user "${username}" on >${password} ~* +@all`] : [])
  ]);

But would be nice if @testcontainers/valkey support this natively

Changes

  • Add withUsername method to ValkeyContainer
  • Conditional apply --user if username was provided

@netlify
Copy link

netlify bot commented Aug 22, 2025

Deploy Preview for testcontainers-node ready!

Name Link
🔨 Latest commit 46a2ad8
🔍 Latest deploy log https://app.netlify.com/projects/testcontainers-node/deploys/68af88e17b919c0008411b56
😎 Deploy Preview https://deploy-preview-1117--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 project configuration.

@cristianrgreco cristianrgreco added enhancement New feature or request minor Backward compatible functionality labels Aug 23, 2025
@rqbazan rqbazan requested a review from cristianrgreco August 28, 2025 12:18
@cristianrgreco cristianrgreco changed the title feat: add username option to valkey test container Add username option to Valkey container Aug 28, 2025
@cristianrgreco cristianrgreco merged commit 553d238 into testcontainers:main Aug 28, 2025
316 checks passed
@rqbazan
Copy link
Contributor Author

rqbazan commented Sep 11, 2025

Hey @cristianrgreco ✋ I was wondering if you have any plans for the next release, as I’d love to use the changes from my recent contribution.

@cristianrgreco
Copy link
Collaborator

Hey @rqbazan, apologies for the delay I've been away for the last week. I'm going to cut a release today

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

Labels

enhancement New feature or request minor Backward compatible functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants