Skip to content

Commit

Permalink
fix: no-cluster option (#2014)
Browse files Browse the repository at this point in the history
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
  • Loading branch information
eddycharly authored Sep 26, 2024
1 parent c33abdd commit a31cbd4
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,21 @@ jobs:
set -e
make e2e-tests
e2e-tests-no-cluster:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Setup Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version-file: go.mod
cache-dependency-path: go.sum
- name: Run tests
run: |
set -e
make e2e-tests-no-cluster
e2e-test-ko:
runs-on: ubuntu-latest
steps:
Expand Down
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,14 @@ tests: $(CLI_BIN)
e2e-tests: ## Run e2e tests
e2e-tests: $(CLI_BIN)
@echo Running e2e tests... >&2
@./$(CLI_BIN) test --test-dir ./testdata/e2e --remarshal --config ./testdata/e2e/config.yaml --values ./testdata/e2e/values.yaml
@./$(CLI_BIN) test ./testdata/e2e --remarshal --config ./testdata/e2e/config.yaml --values ./testdata/e2e/values.yaml

.PHONY: e2e-tests-no-cluster
e2e-tests-no-cluster: ## Run e2e tests with --no-cluster
e2e-tests-no-cluster: $(CLI_BIN)
@echo Running e2e tests with --no-cluster... >&2
@./$(CLI_BIN) test testdata/e2e/examples/script-env --no-cluster --remarshal --config ./testdata/e2e/config.yaml --values ./testdata/e2e/values.yaml
@./$(CLI_BIN) test testdata/e2e/examples/dynamic-clusters --no-cluster --remarshal --config ./testdata/e2e/config.yaml --values ./testdata/e2e/values.yaml

.PHONY: e2e-tests-ko
e2e-tests-ko: ## Run e2e tests from a docker container
Expand Down
6 changes: 4 additions & 2 deletions pkg/runner/processors/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func setupContextData(ctx context.Context, tc engine.Context, data contextData)
return tc, nil, err
} else if _, clusterClient, err := tc.CurrentClusterClient(); err != nil {
return tc, nil, err
} else {
} else if clusterClient != nil {
if err := clusterClient.Get(ctx, client.Key(namespace), namespace.DeepCopy()); err != nil {
if !errors.IsNotFound(err) {
return tc, nil, err
Expand All @@ -56,7 +56,9 @@ func setupContextData(ctx context.Context, tc engine.Context, data contextData)
}
ns = namespace
}
tc = engine.WithNamespace(ctx, tc, ns.GetName())
if ns != nil {
tc = engine.WithNamespace(ctx, tc, ns.GetName())
}
}
if _tc, err := engine.WithBindings(ctx, tc, data.bindings...); err != nil {
return tc, ns, err
Expand Down

0 comments on commit a31cbd4

Please sign in to comment.