@@ -5,9 +5,12 @@ namespace MySqlConnector.Tests.Metrics;
5
5
public class ConnectionsUsageTests : MetricsTestsBase
6
6
{
7
7
[ Theory ( Skip = MetricsSkip ) ]
8
- [ InlineData ( "DataSource|true|" ) ]
9
- [ InlineData ( "DataSource|true|metrics-test" ) ]
10
- [ InlineData ( "Plain|true" ) ]
8
+ [ InlineData ( "DataSource|true||" ) ]
9
+ [ InlineData ( "DataSource|true||app-name" ) ]
10
+ [ InlineData ( "DataSource|true|pool-name|" ) ]
11
+ [ InlineData ( "DataSource|true|pool-name|app-name" ) ]
12
+ [ InlineData ( "Plain|true|" ) ]
13
+ [ InlineData ( "Plain|true|app-name" ) ]
11
14
public void ConnectionsWithPoolsHaveMetrics ( string connectionCreatorSpec )
12
15
{
13
16
using var connectionCreator = CreateConnectionCreator ( connectionCreatorSpec , CreateConnectionStringBuilder ( ) ) ;
@@ -60,9 +63,12 @@ public void ConnectionsWithPoolsHaveMetrics(string connectionCreatorSpec)
60
63
}
61
64
62
65
[ Theory ( Skip = MetricsSkip ) ]
63
- [ InlineData ( "DataSource|false|" ) ]
64
- [ InlineData ( "DataSource|false|metrics-test" ) ]
65
- [ InlineData ( "Plain|false" ) ]
66
+ [ InlineData ( "DataSource|false||" ) ]
67
+ [ InlineData ( "DataSource|false||app-name" ) ]
68
+ [ InlineData ( "DataSource|false|pool-name|" ) ]
69
+ [ InlineData ( "DataSource|false|pool-name|app-name" ) ]
70
+ [ InlineData ( "Plain|false|" ) ]
71
+ [ InlineData ( "Plain|false|app-name" ) ]
66
72
public void ConnectionsWithoutPoolsHaveNoMetrics ( string connectionCreatorSpec )
67
73
{
68
74
using var connectionCreator = CreateConnectionCreator ( connectionCreatorSpec , CreateConnectionStringBuilder ( ) ) ;
@@ -172,8 +178,8 @@ private IConnectionCreator CreateConnectionCreator(string spec, MySqlConnectionS
172
178
var parts = spec . Split ( '|' ) ;
173
179
return parts [ 0 ] switch
174
180
{
175
- "DataSource" => new DataSourceConnectionCreator ( bool . Parse ( parts [ 1 ] ) , parts [ 2 ] == "" ? null : parts [ 2 ] , connectionStringBuilder ) ,
176
- "Plain" => new PlainConnectionCreator ( bool . Parse ( parts [ 1 ] ) , connectionStringBuilder ) ,
181
+ "DataSource" => new DataSourceConnectionCreator ( bool . Parse ( parts [ 1 ] ) , parts [ 2 ] == "" ? null : parts [ 2 ] , parts [ 3 ] == "" ? null : parts [ 3 ] , connectionStringBuilder ) ,
182
+ "Plain" => new PlainConnectionCreator ( bool . Parse ( parts [ 1 ] ) , parts [ 2 ] == "" ? null : parts [ 2 ] , connectionStringBuilder ) ,
177
183
_ => throw new NotSupportedException ( ) ,
178
184
} ;
179
185
}
0 commit comments