Skip to content

test(preflight): fail TestPreflightAzure cleanly on errors#1840

Merged
lokesh-vadlamudi merged 1 commit into
mainfrom
lvadlamudi/preflight-azure-require
Jun 23, 2026
Merged

test(preflight): fail TestPreflightAzure cleanly on errors#1840
lokesh-vadlamudi merged 1 commit into
mainfrom
lvadlamudi/preflight-azure-require

Conversation

@lokesh-vadlamudi

Copy link
Copy Markdown
Collaborator

Switch the two error checks in TestPreflightAzure from assert.NoError to require.NoError (after azure.New and preflight.Run()).

assert.NoError only records the failure and lets the test continue, so when preflight.Run() returns an error (e.g. an expired Azure client secret), execution fell through to result.Caller.ObjectID on a nil result and panicked:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0]
    integration/preflight_azure_test.go:36

That SIGSEGV aborts the entire integration test binary with exit code 2, taking down the whole shard instead of reporting a single readable test failure. require.NoError stops the test at the error, so the failure surfaces as:

Error: Received unexpected error: failed to get token: ... AADSTS7000222: ... expired ...

The value assertions below are left as assert (they do not dereference nil once result is non-nil). testify/require is vendored since the repo builds with -mod=vendor.

Use require.NoError instead of assert.NoError after azure.New and
preflight.Run(). assert only records the failure and continues, so an
auth error (e.g. an expired client secret) fell through to dereference
a nil result, crashing the whole integration shard with a SIGSEGV nil
pointer panic instead of a readable assertion failure. require stops
the test at the error. Vendors testify/require.
@lokesh-vadlamudi lokesh-vadlamudi self-assigned this Jun 23, 2026
@lokesh-vadlamudi
lokesh-vadlamudi marked this pull request as ready for review June 23, 2026 19:16
@lokesh-vadlamudi
lokesh-vadlamudi requested a review from a team as a code owner June 23, 2026 19:16
@lokesh-vadlamudi
lokesh-vadlamudi enabled auto-merge (squash) June 23, 2026 19:16
@lokesh-vadlamudi
lokesh-vadlamudi requested a review from wsli-1 June 23, 2026 19:16
@lokesh-vadlamudi
lokesh-vadlamudi merged commit 0477670 into main Jun 23, 2026
13 checks passed
@lokesh-vadlamudi
lokesh-vadlamudi deleted the lvadlamudi/preflight-azure-require branch June 23, 2026 21:20
@lacework-releng lacework-releng mentioned this pull request Jul 16, 2026
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.

2 participants