Skip to content

m3-live-smoke.test.ts defaults to the stale kube context kind-kagenti #192

Closed

Description

@pdettori

Problem

packages/k8s-sandbox/test/m3-live-smoke.test.ts:27:

context: process.env.KAGENTI_SANDBOX_CONTEXT ?? "kind-kagenti",

The default no longer matches what the setup scripts produce. On a current local bring-up the context is kind-sh-knative, so running the gated suite without setting KAGENTI_SANDBOX_CONTEXT targets a context that does not exist, and every kubectl call fails with a connection error rather than a clear "wrong context" message.

Why it matters

This suite is skip-by-default (M3_LIVE_SMOKE), so it is run rarely and usually by someone who did not write it. A stale default turns "I ran the live gate and it failed" into a misleading signal about the code under test rather than about the environment.

It matters slightly more right now because PR #188 adds a live assertion ("Claim 6") that was committed unrun, with a documented command for someone to run later. That command sets the variable explicitly — but anyone invoking the suite the obvious way will hit the stale default first.

Options

  1. Drop the default and fail fast with a message naming the variable, e.g. KAGENTI_SANDBOX_CONTEXT must be set (current: $(kubectl config current-context)). Most honest — the suite cannot guess.
  2. Default to the current context (kubectl config current-context) rather than a hardcoded name, so it follows whatever the operator has selected.
  3. Update the literal to match today's setup scripts. Cheapest, and stale again after the next rename — which is how it got here.

Option 1 or 2 is preferable; the value is environment-specific and hardcoding any name reintroduces the problem.

Refs

Noticed while executing #188 (ST6); pre-existing and deliberately not changed there to keep that branch scoped.

Activity

  1. added 2 commits that reference this issue on Sep 6, 2026
  2. pdettori commented on Sep 6, 2026

    @pdettori
    MemberAuthor

    Done in #226 (1386a98), merged as 1b5d4ef.

    Took option 2 (default to the current context), and it turned out to need no kubectl config current-context call — just deleting the literal:

    context: process.env.KAGENTI_SANDBOX_CONTEXT || undefined,

    kubectlExecRaw and buildKubectlArgs both append --context only when cfg.context is truthy, so undefined omits the flag and kubectl uses current-context by itself. That also makes the suite agree with three things it was already disagreeing with:

    • packages/k8s-sandbox/src/config.ts:25 and src/resolve-pod.ts:69, which already map an unset variable to undefined
    • harness/src/select-sandbox.ts:82, same
    • packages/k8s-sandbox/README.md, which already documented the default as current-context

    So the literal was the odd one out repo-wide, not just stale — which is a point in favour of option 2 over option 1 that wasn't obvious from the issue.

    No new test, deliberately. The changed line is inside describe.skipIf(!LIVE) gated on M3_LIVE_SMOKE, so nothing in CI can observe it — a test asserting on it would be asserting on a suite CI never runs. The behaviour it now matches is pinned, by packages/k8s-sandbox/test/config.test.ts.

    SMOKE.md needed no change: its two kind-kagenti mentions record the cluster a past run used, and its invocation passes KAGENTI_SANDBOX_CONTEXT explicitly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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