kuttl icon indicating copy to clipboard operation
kuttl copied to clipboard

Inconsistent $PWD between TestStep and TestAssert commands

Open porridge opened this issue 4 years ago • 1 comments

What happened:

I start some commands: from a TestAssert and a TestStep. Current working directory for the former is the directory I started kuttl from, while for the latter it's the directory where the step file is located.

What you expected to happen:

Current working directory should be the same for both cases.

How to reproduce it (as minimally and precisely as possible):

~ $ head -n 999 tests/quick/very/00-*
==> tests/quick/very/00-assert.yaml <==
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
commands:
- command: echo assert command
- command: pwd
- script: |
   echo assert script
   pwd

==> tests/quick/very/00-image-pull-secrets.yaml <==
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
# Set up operand image pull secrets for development.
- script: |
    echo step script
    pwd
- command: echo step command
- command: pwd
~ $ ./bin/kubectl-kuttl-0.11.0 test ./tests/quick
2021/09/14 08:58:56 kutt-test config testdirs is overridden with args: [ ./tests/quick ]
=== RUN   kuttl
    harness.go:457: starting setup
    harness.go:248: running tests using configured kubeconfig.
    harness.go:285: Successful connection to cluster at: https://kubernetes.docker.internal:6443
    harness.go:353: running tests
    harness.go:74: going to run test suite with timeout of 300 seconds for each step
    harness.go:365: testsuite: ./tests/quick has 1 tests
=== RUN   kuttl/harness
=== RUN   kuttl/harness/very
=== PAUSE kuttl/harness/very
=== CONT  kuttl/harness/very
    logger.go:42: 08:58:58 | very | Creating namespace: kuttl-test-smiling-doberman
    logger.go:42: 08:58:58 | very/0-image-pull-secrets | starting test step 0-image-pull-secrets
    logger.go:42: 08:58:58 | very/0-image-pull-secrets | running command: [sh -c echo step script
        pwd
        ]
    logger.go:42: 08:58:58 | very/0-image-pull-secrets | step script
    logger.go:42: 08:58:58 | very/0-image-pull-secrets | /Users/marcin/tests/quick/very
    logger.go:42: 08:58:58 | very/0-image-pull-secrets | running command: [echo step command]
    logger.go:42: 08:58:58 | very/0-image-pull-secrets | step command
    logger.go:42: 08:58:58 | very/0-image-pull-secrets | running command: [pwd]
    logger.go:42: 08:58:58 | very/0-image-pull-secrets | /Users/marcin/tests/quick/very
    logger.go:42: 08:58:58 | very/0-image-pull-secrets | running command: [echo assert command]
    logger.go:42: 08:58:58 | very/0-image-pull-secrets | assert command
    logger.go:42: 08:58:58 | very/0-image-pull-secrets | running command: [pwd]
    logger.go:42: 08:58:58 | very/0-image-pull-secrets | /Users/marcin
    logger.go:42: 08:58:58 | very/0-image-pull-secrets | running command: [sh -c echo assert script
        pwd
        ]
    logger.go:42: 08:58:58 | very/0-image-pull-secrets | assert script
    logger.go:42: 08:58:58 | very/0-image-pull-secrets | /Users/marcin
    logger.go:42: 08:58:58 | very/0-image-pull-secrets | test step completed 0-image-pull-secrets
    logger.go:42: 08:58:58 | very | very events from ns kuttl-test-smiling-doberman:
    logger.go:42: 08:58:58 | very | Deleting namespace: kuttl-test-smiling-doberman
=== CONT  kuttl
    harness.go:399: run tests finished
    harness.go:508: cleaning up
    harness.go:563: removing temp folder: ""
--- PASS: kuttl (2.76s)
    --- PASS: kuttl/harness (0.00s)
        --- PASS: kuttl/harness/very (0.78s)
PASS
~ $ 

Anything else we need to know?:

Environment:

  • KUTTL version (use kubectl kuttl version): 0.11.1
  • OS (e.g. from /etc/os-release): MacOS 11.6

porridge avatar Sep 14 '21 07:09 porridge

apologies for long delay... but on it! thanks for this issue... really appreciate your eagle eye and drive for consistency @porridge Thank you!

kensipe avatar Apr 14 '22 13:04 kensipe