Skip to content

Commit

Permalink
Delete test body.
Browse files Browse the repository at this point in the history
  • Loading branch information
bgrainger committed Oct 28, 2023
1 parent a197062 commit d3ec1b9
Showing 1 changed file with 1 addition and 53 deletions.
54 changes: 1 addition & 53 deletions tests/MySqlConnector.Tests/Metrics/ConnectionsUsageTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,58 +7,6 @@ public class ConnectionsUsageTests : MetricsTestsBase
[Fact]
public void NoDataSource()
{
var csb = CreateConnectionStringBuilder();

// NOTE: pool "name" is connection string (without password)
PoolName = csb.GetConnectionString(includePassword: false);

// no connections at beginning of test
AssertMeasurement("db.client.connections.usage", 0);
AssertMeasurement("db.client.connections.usage|idle", 0);
AssertMeasurement("db.client.connections.usage|used", 0);
Assert.Equal(0, Server.ActiveConnections);

// opening a connection creates a 'used' connection
using (var connection = new MySqlConnection(csb.ConnectionString))
{
connection.Open();
AssertMeasurement("db.client.connections.usage", 1);
AssertMeasurement("db.client.connections.usage|idle", 0);
AssertMeasurement("db.client.connections.usage|used", 1);
Assert.Equal(1, Server.ActiveConnections);
}

// closing it creates an 'idle' connection
AssertMeasurement("db.client.connections.usage", 1);
AssertMeasurement("db.client.connections.usage|idle", 1);
AssertMeasurement("db.client.connections.usage|used", 0);
Assert.Equal(1, Server.ActiveConnections);

// reopening the connection transitions it back to 'used'
using (var connection = new MySqlConnection(csb.ConnectionString))
{
connection.Open();
AssertMeasurement("db.client.connections.usage", 1);
AssertMeasurement("db.client.connections.usage|idle", 0);
AssertMeasurement("db.client.connections.usage|used", 1);
}
Assert.Equal(1, Server.ActiveConnections);

// opening a second connection creates a net new 'used' connection
using (var connection = new MySqlConnection(csb.ConnectionString))
using (var connection2 = new MySqlConnection(csb.ConnectionString))
{
connection.Open();
connection2.Open();
AssertMeasurement("db.client.connections.usage", 2);
AssertMeasurement("db.client.connections.usage|idle", 0);
AssertMeasurement("db.client.connections.usage|used", 2);
Assert.Equal(2, Server.ActiveConnections);
}

AssertMeasurement("db.client.connections.usage", 2);
AssertMeasurement("db.client.connections.usage|idle", 2);
AssertMeasurement("db.client.connections.usage|used", 0);
Assert.Equal(2, Server.ActiveConnections);
CreateConnectionStringBuilder();
}
}

0 comments on commit d3ec1b9

Please sign in to comment.