func BenchmarkFaultErrorZeroPercent(b *testing.B) {
	i, _ := fault.NewErrorInjector(http.StatusInternalServerError)
	f, _ := fault.NewFault(i,
		fault.WithEnabled(true),
		fault.WithParticipation(0.0),
	)
	runBenchmark(b, f)
}
BenchmarkFaultErrorZeroPercent benchmarks an enabled Fault with 0% participation.
package fault_test
import (
	"context"
	"net/http"
	"net/http/httptest"
	"testing"
	"github.com/github/go-fault"
)
func benchmarkRequest(b *testing.B, f *fault.Fault) *httptest.ResponseRecorder {
	b.Helper()
	var benchmarkHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		http.Error(w, "OK", http.StatusOK)
	})
	req, _ := http.NewRequestWithContext(context.Background(), "GET", "/", nil)
	rr := httptest.NewRecorder()
	if f != nil {
		finalHandler := f.Handler(benchmarkHandler)
		finalHandler.ServeHTTP(rr, req)
	} else {
		benchmarkHandler.ServeHTTP(rr, req)
	}
	return rr
}
func runBenchmark(b *testing.B, f *fault.Fault) {
	var rr *httptest.ResponseRecorder
	for n := 0; n < b.N; n++ {
		rr = benchmarkRequest(b, f)
	}
	_ = rr
}
func BenchmarkNoFault(b *testing.B) {
	runBenchmark(b, nil)
}
func BenchmarkFaultDisabled(b *testing.B) {
	i, _ := fault.NewErrorInjector(http.StatusInternalServerError)
	f, _ := fault.NewFault(i,
		fault.WithEnabled(false),
	)
	runBenchmark(b, f)
}