Interview question
Build a non-destructive post-deploy API smoke check
Checks health, authentication, and one critical read flow after deployment without creating persistent business data.
TL;DR
Checks health, authentication, and one critical read flow after deployment without creating persistent business data.
Release verification, critical-path selection, safe credentials, bounded timeouts, diagnostic output, and non-destructive checks.
Practice the problem like a real interview: restate, reason, implement, and test.
The runner checks readiness, obtains a dedicated smoke identity token through the environment's approved test mechanism, and calls one critical read endpoint. It must use a short overall timeout, avoid writes, and report which step failed without exposing secrets.
Move to the linked follow-up, next path step, prerequisite, or deeper variant.
Practice the next layer of the same subject.
A deployment with healthy process startup but broken authorization fails at the profile step before production monitoring must infer the problem from users.
I keep smoke coverage intentionally small. Readiness proves traffic eligibility; one authenticated read proves routing, auth, and a required data path. Deeper regression remains in CI and staging rather than running destructive workflows after every production deployment.
public static async Task<int> RunSmokeAsync(
HttpClient client,
string accessToken,
CancellationToken cancellationToken)
{
using var timeout = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
timeout.CancelAfter(TimeSpan.FromSeconds(20));
using var ready = await client.GetAsync("/health/ready", timeout.Token);
if (!ready.IsSuccessStatusCode)
return SmokeFailure.Readiness;
client.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Bearer", accessToken);
using var profile = await client.GetAsync("/api/profile", timeout.Token);
if (!profile.IsSuccessStatusCode)
return SmokeFailure.AuthenticatedRead;
return SmokeFailure.None;
}
The runner makes two bounded read calls and exits with a machine-readable step code for the deployment pipeline. Tokens come from secret storage and must never appear in output.
Spot a weak answer, missing edge case, or clearer explanation? Send it in.