testcontainers / testcontainers/testcontainers-java

[Enhancement]: setCommand should allow space escaping

Open
#9,530 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type/enhancement
Dominant language
Java
Stars
8.7k
Forks
1.9k
Avg merge
2d 17h
Merged PRs (30d)
9

Description

Module

Core

Proposal

Currently, GenericContainer.setCommand(String) do a command.split(" ").
This doesn't allow escaping the space. It can be an issue for command lines like postgres -c max_connections=100 -c default_transaction_isolation=repeatable read

The alternative method setCommand(String... commandParts) is not always available, for example, when using testcontainers through quarkus dev-service which doesn't expose a way to set command through array/list of parameters.

As command.split() take a regexp, changing the implementation to command.split("[^\\]? ") should allow user to write postgres -c max_connections=100 -c default_transaction_isolation=repeatable\ read and get correct interpretation.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at GenericContainer.setCommand(String), where the issue reports command.split(" "), and reproduce the escaped-space example from the proposal. Done means an escaped space remains within one command argument while ordinary space-separated arguments continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, java
Domain
testing-qa
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.