github.com/blend/go-sdk@v1.20220411.3/envoyutil/bench_test.go (about)

     1  /*
     2  
     3  Copyright (c) 2022 - Present. Blend Labs, Inc. All rights reserved
     4  Use of this source code is governed by a MIT license that can be found in the LICENSE file.
     5  
     6  */
     7  
     8  package envoyutil_test
     9  
    10  import (
    11  	"testing"
    12  
    13  	"github.com/blend/go-sdk/envoyutil"
    14  )
    15  
    16  // BenchmarkParseXFCC tries to help determine a baseline of the speed for
    17  // `envoyutil.ParseXFCC()` on "small" well-formed input.
    18  //
    19  // Can be run via: `go test -bench=.`
    20  func BenchmarkParseXFCC(b *testing.B) {
    21  	xfcc := "By=spiffe://cluster.local/ns/blent/sa/echo;Hash=468ed33be74eee6556d90c0149c1309e9ba61d6425303443c0748a02dd8de688;Subject=10;URI=spiffe://cluster.local/ns/blent/sa/beep"
    22  	for n := 0; n < b.N; n++ {
    23  		_, _ = envoyutil.ParseXFCC(xfcc)
    24  	}
    25  }