zjncs opened a new pull request, #6205:
URL: https://github.com/apache/rocketmq-dashboard/pull/6205

   ### What
   
   `rmqctl/cmd/runtime.go` — `commandRuntime.resolveTarget` / `targetServer`, 
the target resolution every catalog command runs before talking to the Studio 
server — had no direct test (only indirect use inside other commands' tests). 
This adds 7 tests pinning the contract:
   
   - **the instance identifier is required on every invocation and never 
defaulted from the context** (decision 7): a blank or whitespace-only 
`--instance-id` is rejected with the flag named and the never-defaults hint;
   - **the identifier is whitespace-trimmed** both for the presence check and 
onto the assembled target;
   - the target assembles the active context's **server**, the **env-referenced 
credentials** and the **timeout**;
   - an explicit `--context` wins over `currentContext`;
   - an absent current context and an unknown context are rejected by name;
   - empty credential environments are rejected with the environment variable 
named and a fix-it hint;
   - the confirmation prompt's server label (`targetServer`) returns the 
configured server, and **falls back to the generic `Studio Server` label 
whenever the server cannot be resolved — an empty URL must never be shown where 
a dangerous request will be sent**.
   
   ### Verification
   
   - New tests on unmodified code: **7/7 passed** (`go test ./cmd/ -run 
'TestResolveTarget|TestTargetServer' -count=1`), `go vet ./cmd/` clean.
   - Discriminating mutations on the runtime (3 tests red, 4 green):
     - drop the `strings.TrimSpace` on the instance id: the blank-presence and 
trim-assembly tests red;
     - empty the `targetServer` fallbacks: the fallback test reds.
   - Runtime restored: full `./cmd/` package **ok** (all existing tests green).
   
   ### Collision check
   
   Checked against all open PRs — no other PR touches `rmqctl/cmd/runtime.go` 
or adds `runtime_test.go`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to