testrunner

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 35 Imported by: 0

README

Integration Test Runner

Lumberjack is not an official Google product.

Prerequisites

About

For each endpoint (either HTTP or gRPC) given to the test, the test runner will send a request to it to mimic a data access operation, wait and check if the correct audit log has appeared in the BigQuery (the audit log storage).

Environment Variables and flags:

  • HTTP_ENDPOINTS is the environment variable that contains a JSON list of HTTP endpoints to be tested.
  • GRPC_ENDPOINTS is the environment variable that contains a JSON list of gRPC endpoints to be tested. The gRPC server must implement the test service.
  • BIGQUERY_PROJECT_ID is the flag that contains the Cloud project ID that contains the BigQuery dataset.
  • BIGQUERY_DATASET_QUERY is the flag that contains the ID of the BigQuery dataset to be queried.

See more configs here.

Run

From the integration directory, run go test github.com/abcxyz/lumberjack/integration/testrunner -id-token=$(gcloud auth print-identity-token) -project-id=${PROJECT_ID} -dataset-query=${DATASET_QUERY} .

If a service account key exists that is pointed to via the environment variable, GOOGLE_APPLICATION_CREDENTIALS, then the flag, -id-token, can be omitted to execute the runner via the service account.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	AuditLogRequestTimeout  time.Duration `env:"AUDIT_CLIENT_TEST_AUDIT_LOG_REQUEST_TIMEOUT,default=30s"`
	AuditLogRequestWait     time.Duration `env:"AUDIT_CLIENT_TEST_AUDIT_LOG_REQUEST_WAIT,default=4s"`
	HTTPEndpoints           string        `env:"HTTP_ENDPOINTS,required"`
	GRPCEndpoints           string        `env:"GRPC_ENDPOINTS,required"`
	LogRoutingWait          time.Duration `env:"AUDIT_CLIENT_TEST_AUDIT_LOG_ROUTING_WAIT,default=5s"`
	MaxAuditLogRequestTries uint64        `env:"AUDIT_CLIENT_TEST_MAX_AUDIT_LOG_REQUEST_TRIES,default=4"`
	MaxDBQueryTries         uint64        `env:"AUDIT_CLIENT_TEST_MAX_DB_QUERY_TRIES,default=60"`
	JustificationSubject    string        `env:"AUDIT_CLIENT_TEST_JUSTIFICATION_SUB,required"`
	IDToken                 string        `env:"AUDIT_CLIENT_TEST_IDTOKEN"`
	ProjectID               string        `env:"AUDIT_CLIENT_TEST_PROJECT_ID,required"`
	BigQueryDataset         string        `env:"AUDIT_CLIENT_TEST_BIGQUERY_DATASET,required"`
	PrivateKeyFilePath      string        `env:"AUDIT_CLIENT_TEST_PRIVATE_KEY_PATH,required"`
	// Parsed private key for all test cases to use.
	PrivateKey *ecdsa.PrivateKey
}

Config is the global configuration for integration tests.

type TestCaseConfig

type TestCaseConfig struct {
	*Config

	Endpoint string
	TraceID  string

	BigQueryClient *bigquery.Client

	// For gRPC endpoint testing only.
	TalkerClient talkerpb.TalkerClient
}

TestCaseConfig contains all configuration needed in a test case.

Jump to

Keyboard shortcuts

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