clientcoverage

command
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Command clientcoverage measures which AWS operations gopherstack's own test suite actually exercises through a real aws-sdk-go-v2 client, as opposed to a raw-body httptest assertion or a direct handler call.

Filed for gopherstack-n3zi, which needed a real number in place of the inherited "77 percent never touched" estimate. The denominator comes from cmd/opcensus's own -json output (each service's GetSupportedOperations, 10,565 ops / 160 services as of gopherstack-jq8x). This tool supplies the numerator: an AST walk over every _test.go file under the given roots (test/integration and services/... by default) that finds

  • a client construction, either a direct <pkg>.NewFromConfig(...) call, or a call to a same-package helper function whose declared return type is *<pkg>.Client at some position (chases one level through helpers like newTestHandlerAndClient, which itself calls newRoundTripClient, which calls NewFromConfig -- resolved via signature, not by tracing the helper's body);
  • a function-literal parameter typed *<pkg>.Client, the dominant idiom in test/integration (`verify func(t *testing.T, client *s3.Client)`);
  • then any call of the form boundVar.<Op>(...) on a variable bound by either of the above, where <Op> is a name in that SDK module's real operation set (per opcensus -- this is what excludes non-API methods like Options()).

A module can be imported by more than one service's own dispatcher (e.g. "s3" appears in both s3's and sagemaker's sdkModules); ownership of a given (module, op) pair is resolved by checking which of the module's candidate services actually declares that op name. See BLIND SPOTS below for what this walk cannot see.

Usage:

go run ./cmd/opcensus -json /tmp/opcensus.json
go run ./cmd/clientcoverage -opcensus /tmp/opcensus.json
go run ./cmd/clientcoverage -opcensus /tmp/opcensus.json -json /tmp/coverage.json

Jump to

Keyboard shortcuts

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