Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: no-cluster option #2014

Merged
merged 2 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading