kudobuilder / kuttl

KUbernetes Test TooL (kuttl)
https://kuttl.dev
Apache License 2.0
672 stars 86 forks source link

$NAMESPACE in TestSuite commands is always =default regardless of kuttl test --namespace option #475

Open gberche-orange opened 1 year ago

gberche-orange commented 1 year ago

What happened:

$NAMESPACE in TestSuite commands is always set to "default" regardless of the --namespace option passed to kuttl cli

What you expected to happen:

$NAMESPACE in TestSuite command to be filled with value passed in --namespace option passed to kuttl cli

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

suite.yaml

apiVersion: kuttl.dev/v1beta1
kind: TestSuite
metadata:
  name: name
commands:
  - script: |
     echo namespace=$NAMESPACE
$ kubectl kuttl test --namespace kuttl-test-2023-07-05-16h-26m-18s --config [...]/suite.yaml
[...]
namespace=default

Anything else we need to know?:

Environment:

iblancasa commented 1 year ago

Why don't you use the TestStep kind?

gberche-orange commented 1 year ago

thanks @iblancasa

Why don't you use the TestStep kind?

I was trying to preprocess kuttl TestStep yaml files using carvel ytt (https://carvel.dev/ytt/) as a workaround for https://github.com/kudobuilder/kuttl/issues/203

I tried to do it into a TestSuite within a script but hit this bug + the fact that the TestStep files references in TestSuite seem loaded immediately in memory once the TestSuite loads.

As a workaround, I'm now preprocessing kuttl files prior to executing kuttl. This also solves https://github.com/kudobuilder/kuttl/issues/379