Skip to content

Unable to get Variable value when exporting through envVars: #484

@rahulsyal92

Description

@rahulsyal92

Hello

Variable value is not reflecting in the response when running with CST . I am new for this testing and follow the CST official instruction to check test case against the docker image, but not able to get variable value when running through CST.

  1. Running the CST as:

container-structure-test test -i owasp/modsecurity-crs:4.0.0-nginx-alpine-202402261002 -c test.yaml

2 . root@kubernetes:~/CST# cat test.yaml
schemaVersion: 2.0.0

commandTests:

  • name: "Test"
    command: "/bin/sh"
    args:
    • -c
    • |
      echo "PROJECT_MODE is: ${PROJECT_MODE}"
      envVars:
    • key: "PROJECT_MODE"
      value: "yes"
  1. root@kubernetes:~/CST# container-structure-test test -i owasp/modsecurity-crs:4.0.0-nginx-alpine-202402261002 -c test.yaml

==================================
====== Test file: test.yaml ======

=== RUN: Command Test: Test
--- PASS
duration: 882.440353ms
stdout: PROJECT_MODE is:
PROJECT_MODE is:-

===================================
============= RESULTS =============

Passes: 1
Failures: 0
Duration: 882.440353ms
Total tests: 1

PASS
root@kubernetes:~/CST#

Please check and share steps (may be missing ) to get the variable value (PROJECT_MODE ) while running the CST .

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions