Skip to content

Passing secret from the outside using env variables #284

Description

@gavvvr

Hi.
Suppose my test command needs a secret (The real-life command is a one-liner for making sure that the language runtime can successfully connect to a real database instance using db driver installed into the image under test). Is it possible to pass the secret to container under test?

I tried the following test:

schemaVersion: '2.0.0'
commandTests:
  - name: 'Env variable can be passed to CST from the outside'
    envVars:
      - key: "PASSWORD"
        value: "${PASSWORD}"
    command: "env"
    expectedOutput: ["s3cr3t"]

And executed the test with PASSWORD=s3cr3t container-structure-test test --config tests.yaml --image my-image-under-test. Unfortunately the test fails, because it does not substitute the ${PASSWORD} with the value I provide.

Would be very helpful to have an option to pass sensitive data to container under test from the outside.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions