Skip to content

test: integration tests for the tier 1 release fixes - #703

Draft
NickJosevski wants to merge 9 commits into
mainfrom
nj/tier1-integration-tests
Draft

test: integration tests for the tier 1 release fixes#703
NickJosevski wants to merge 9 commits into
mainfrom
nj/tier1-integration-tests

Conversation

@NickJosevski

Copy link
Copy Markdown
Contributor

Adds end-to-end integration tests for the four "Tier 1" fixes — the ones whose correctness depends on how the real Octopus Server behaves, which testutil.MockHttpServer cannot validate by construction.

Refs #294, #426, #250, #556.

Why this branch stacks the four fixes

The tests assert post-fix behaviour, so they need the fixes present to pass. This branch merges the four feature branches and adds the tests on top:

Merged PR
nj/issue-294 #696
nj/issue-426 #695
nj/issue-250 #702
nj/issue-556 #692

This branch is not for merging as-is. It exists to prove the four compose and to carry the new tests. Once the four land on main, the last commit here rebases onto main on its own.

Tests added

All in test/integration/release_test.go, following the existing harness (integration.RunCli, CreateCommonProject, t.Cleanup teardown).

Verification

Run against a real Octopus Server (local dev instance, server main):

  • On this branch: all 4 pass, 20.7s, clean teardown.
  • On unmodified main with the same test file: all 4 fail. They are genuine regression tests, not tests that pass either way.
  • go build ./... clean; go test ./pkg/... green (63 packages).

Finding: the null-reference symptom no longer reproduces

#294 and #426 both describe Octopus API error: Object reference not set to an instance of an object. []. On a current server that is not what happens:

The server-side defect appears to have been fixed since those issues were filed (2022.3 and 2024.4 respectively). Both CLI fixes still improve the message materially, and older servers still exhibit the original behaviour — but the premise that the server null-refs is no longer true on current versions. Two consequences:

  1. The suggestion in fix: report missing package versions instead of a server null reference #695 to raise a matching Server issue is probably moot; worth confirming before filing.
  2. The assert.NotContains(..., "Object reference not set") lines in these tests are not load-bearing on a current server. They are kept as regression guards for older ones; the positive assertions are what carry the tests.

Finding: the four fixes do not compose without test changes

Each of the four is green on its own branch, but merged they break each other's unit tests — invisible on the individual branches by construction. Fixed in the first commit here:

None of these are defects in the individual PRs; they are ordinary merge fallout. Flagging them because whichever of the four merges last will hit exactly this, and the failure mode for two of them is a hang, not a red test.

Notes

  • test/integration has no build tag and GetApiClient calls os.Exit(999) when OCTOPUS_TEST_URL/OCTOPUS_TEST_APIKEY are unset, so a bare go test ./... from the repo root hard-exits. Run the suite from test/integration.
  • The two deploy tests queue a real server task and wait for it to complete, because a project cannot be deleted while one is running. Whether the deployment succeeds is not asserted.
  • allowDeploymentsTo restores the fixture lifecycle's phases on cleanup, otherwise the environment cannot be deleted.

🤖 Generated with Claude Code

NickJosevski and others added 9 commits August 19, 2026 11:42
`--deployment-target "ABC,XYZ"` was sent to the server as a single target
name because the flag is a pflag StringArray, while its legacy aliases
(`--target`, `--specificMachines`) are StringSlice and already split on
commas. Expand comma-separated values for the environment, tenant,
tenant-tag and target flags on `release deploy` and `runbook run`, so the
comma form matches the repeat-the-flag form. Values that can legitimately
contain a comma (--variable, --skip, package/git-resource specs) are left
alone.

Fixes #556

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`release create --no-prompt` sends the create request straight to the server
without resolving package versions first. When a package has no version in its
feed the server raises a null reference exception, which surfaces as
"Octopus API error: Object reference not set to an instance of an object. []".

On a 5xx failure the CLI now repeats the package version resolution the server
does, and reports the packages, steps and feeds that have no version available.
Where it can't identify a specific package, an unhandled server error now
carries a hint about the likely causes.

Fixes #426

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`release deploy` passed --version straight to the executions API, which
answers an unknown version with "Object reference not set to an instance
of an object". Resolve the release before deploying so a version that
doesn't exist is reported by name, and call out `latest` explicitly since
it is not a supported alias.

Refs #294

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…enant

The executions API only matches channels, environments and tenants by name,
so `release create`, `release deploy` and `runbook run` passed whatever the
caller typed straight through and the server rejected IDs. `--project`
already worked because the server accepts a project ID or name.

Resolve those identifiers client side through the shared selectors package
before handing them to the executor, preferring an ID match over a name
match so it behaves the same way as `--project`.

Fixes #250

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
# Conflicts:
#	pkg/cmd/release/deploy/deploy_test.go
The four fixes are green individually but their mock request sequences
disagree once merged: #294 adds a release pre-flight lookup and removes the
post-deploy web URL lookups, #250 adds an environment lookup, and the tests
#250 and #556 introduce expect neither. Two of those cases deadlock the mock
server rather than failing.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Covers behaviour that only a real server exercises: unknown release versions,
packages with no version in their feed, channel and environment IDs on the
executions API, and comma-separated deployment targets.

Refs #294, #426, #250, #556

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant