Documentation
¶
Overview ¶
Package vtest provides reusable, table-driven test helpers shared by the secret verifier packages.
It is placed under internal/verifier/internal so it can only be imported by verifier packages. The helpers exercise the failure paths that every HTTP verifier must handle safely:
- a transport error (the server is closed) must yield StatusVerifyError;
- a cancelled context must yield StatusVerifyError and NEVER StatusVerifiedInactive (a network failure is not evidence the secret is inactive);
- a 200 response with a malformed JSON body must yield a defined status (the project standardizes this to StatusVerifyError).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Run ¶
Run executes the shared safety suite against the verifier produced by c.New.
It does not contact any real service: a closed httptest server is used for the transport-error and cancellation cases, and a live httptest server that returns 200 with a non-JSON body is used for the malformed-body case.
Types ¶
type Case ¶
type Case struct {
// Name is the verifier name, used as the subtest prefix.
Name string
// New builds the verifier under test.
New Factory
// Raw is a representative finding to verify. Its Raw value should be a
// plausibly formatted secret so the verifier reaches the HTTP call.
Raw detector.RawFinding
// MalformedStatus is the status the verifier returns for a 200 response
// whose body is not valid JSON. Defaults to StatusVerifyError when zero
// (the project standard). Set explicitly for verifiers that only inspect
// the status code and do not decode a body.
MalformedStatus finding.VerificationStatus
// SkipMalformed skips the malformed-body case for verifiers that never
// decode a response body on success.
SkipMalformed bool
}
Case configures the shared verifier suite for one verifier package.
Click to show internal directories.
Click to hide internal directories.