CLI Setup

Run a shell command inside a service container before the test runs. This is useful for database migrations, cache clearing, file preparation, or any operation available through CLI tools.

setup:
  - cli:
      service: app
      command: bin/console migrations:migrate --no-interaction
      workingDir: /srv

Fields

FieldRequiredDescription
serviceyesWhich service container to execute in
commandyesShell command to run
workingDirnoWorking directory inside the container
The command runs with sh -c. This means you can use shell features like pipes and && chaining in your command strings.

Multiple CLI steps

Steps run sequentially in the order you define them. If one fails, Spark stops and marks the test as failed.

setup:
  - cli:
      service: app
      command: bin/console migrations:migrate --no-interaction
      workingDir: /srv
  - cli:
      service: app
      command: bin/console cache:clear
      workingDir: /srv