github.com/ydb-platform/ydb-go-sdk/v3@v3.57.0/trace/details_test.go (about)

     1  package trace
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/require"
     7  )
     8  
     9  func TestDetailsMatch(t *testing.T) {
    10  	for _, tt := range []struct {
    11  		pattern string
    12  		details Details
    13  	}{
    14  		{
    15  			pattern: `^ydb\.driver$`,
    16  			details: DriverEvents,
    17  		},
    18  		{
    19  			pattern: `^ydb\.driver\..*$`,
    20  			details: DriverEvents,
    21  		},
    22  		{
    23  			pattern: `^ydb\.driver\.resolver$`,
    24  			details: DriverResolverEvents,
    25  		},
    26  		{
    27  			pattern: `^ydb\.driver\.(conn|credentials|resolver)$`,
    28  			details: DriverConnEvents | DriverCredentialsEvents | DriverResolverEvents,
    29  		},
    30  		{
    31  			pattern: `^ydb\.scheme$`,
    32  			details: SchemeEvents,
    33  		},
    34  		{
    35  			pattern: `^ydb\.table`,
    36  			details: TableEvents,
    37  		},
    38  		{
    39  			pattern: `^ydb\.scripting$`,
    40  			details: ScriptingEvents,
    41  		},
    42  		{
    43  			pattern: `^ydb\.coordination$`,
    44  			details: CoordinationEvents,
    45  		},
    46  		{
    47  			pattern: `^ydb\.ratelimiter$`,
    48  			details: RatelimiterEvents,
    49  		},
    50  		{
    51  			pattern: `^ydb\.retry$`,
    52  			details: RetryEvents,
    53  		},
    54  		{
    55  			pattern: `^ydb\.discovery$`,
    56  			details: DiscoveryEvents,
    57  		},
    58  		{
    59  			pattern: `^ydb\.(driver|discovery|retry|table|scheme).*$`,
    60  			details: DriverEvents | DiscoveryEvents | RetryEvents | TableEvents | SchemeEvents,
    61  		},
    62  		{
    63  			pattern: `^ydb\.table\.(pool\.(session|api)|session).*$`,
    64  			details: TablePoolSessionLifeCycleEvents | TablePoolAPIEvents | TableSessionEvents,
    65  		},
    66  		{
    67  			pattern: `^ydb\.((database.sql.tx)|driver.(balancer|conn)|(table\.pool)|retry)$`,
    68  			details: DriverBalancerEvents | DriverConnEvents | TablePoolLifeCycleEvents | DatabaseSQLTxEvents | RetryEvents,
    69  		},
    70  	} {
    71  		t.Run("", func(t *testing.T) {
    72  			details := MatchDetails(tt.pattern)
    73  			require.Equal(t, tt.details.String(), details.String())
    74  		})
    75  	}
    76  }