test

package
v3.6.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 25, 2025 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadTestCert

func ReadTestCert(inPath string) *x509.Certificate

ReadTestCert loads a x509.Certificate from the given inPath which is assumed to be relative to `testdata/`.

Important: ReadTestCert is only appropriate for unit tests. It will panic if the inPath file can not be loaded.

func ReadTestOCSPResponse added in v3.6.6

func ReadTestOCSPResponse(tb testing.TB, inPath string) *ocsp.Response

ReadTestOCSPResponse loads an OCSP response from the given inPath, which should be relative to `testdata/`. If the filename ends with `.der`, the file is treated as a binary DER-encoded OCSP response. Otherwise, the file is expected to contain a base64-encoded OCSP response.

This function is intended for use in unit tests only. It will call tb.Fatalf if the file cannot be read, decoded, or parsed.

func ReadTestRevocationList added in v3.5.0

func ReadTestRevocationList(tb testing.TB, inPath string) *x509.RevocationList

ReadTestRevocationList loads a x509.RevocationList from the given inPath which is assumed to be relative to `testdata/`.

Important: ReadTestRevocationList is only appropriate for unit tests. It will panic if the inPath file can not be loaded.

func TestLint

func TestLint(lintName string, testCertFilename string) *lint.LintResult

TestLint executes the given lintName against a certificate read from a testcert data file with the given filename. Filenames should be relative to `testdata/` and not absolute file paths.

Important: TestLint is only appropriate for unit tests. It will panic if the lintName is not known or if the testCertFilename can not be loaded, or if the lint result is nil.

func TestLintCert

func TestLintCert(lintName string, cert *x509.Certificate, ctx lint.Configuration) *lint.LintResult

TestLintCert executes a lint with the given name against an already parsed certificate. This is useful when a unit test reads a certificate from disk and then mutates it in some way before trying to lint it.

Important: TestLintCert is only appropriate for unit tests. It will panic if the lintName is not known or if the lint result is nil.

func TestLintOCSPResponse added in v3.6.6

func TestLintOCSPResponse(tb testing.TB, lintName string, ocspResponse *ocsp.Response, ctx lint.Configuration) *lint.LintResult

TestLintOCSPResponse executes a lint with the given name against an already parsed OCSP Response. This is useful when a unit test reads a OCSP Response from disk and then mutates it in some way before trying to lint it.

func TestLintRevocationList added in v3.5.0

func TestLintRevocationList(tb testing.TB, lintName string, crl *x509.RevocationList, ctx lint.Configuration) *lint.LintResult

TestLintRevocationList executes a lint with the given name against an already parsed revocation list. This is useful when a unit test reads a revocation list from disk and then mutates it in some way before trying to lint it.

func TestLintWithConfig added in v3.4.0

func TestLintWithConfig(lintName string, testCertFilename string, configuration string) *lint.LintResult

func TestOCSPResponseLint added in v3.6.6

func TestOCSPResponseLint(tb testing.TB, lintName string, testOCSPResponseFilename string) *lint.LintResult

TestOCSPResponseLint executes the given lintName against a OCSP Response read from a testocspresponse data file with the given filename. Filenames should be relative to `testdata/` and not absolute file paths.

func TestOCSPResponseLintWithConfig added in v3.6.6

func TestOCSPResponseLintWithConfig(tb testing.TB, lintName string, testOCSPResponseFilename string, configuration string) *lint.LintResult

func TestRevocationListLint added in v3.5.0

func TestRevocationListLint(tb testing.TB, lintName string, testCRLFilename string) *lint.LintResult

TestRevocationListLint executes the given lintName against a CRL read from a testcrl data file with the given filename. Filenames should be relative to `testdata/` and not absolute file paths.

func TestRevocationListLintWithConfig added in v3.5.0

func TestRevocationListLintWithConfig(tb testing.TB, lintName string, testCRLFilename string, configuration string) *lint.LintResult

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL