-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
This bug surfaced when using RDMP's DatabaseTests.GetCleanedServer. When calling DiscoveredDatabase.Exists() with a postgres server, an exception is thrown instead of the method returning false.
The following test fails:
[Test]
public void Postgres_DiscoveredDatabase_Exists_DoesNotThrow()
{
if (!TestConnectionStrings.TryGetValue(DatabaseType.PostgreSql, out var connString))
Assert.Inconclusive();
var server = new DiscoveredServer(connString, DatabaseType.PostgreSql);
var db = server.ExpectDatabase("Hiya");
Assert.DoesNotThrow(() => db.Exists());
}Message:
Assert.That(code, new ThrowsNothingConstraint())
Expected: No Exception to be thrown
But was: <Npgsql.PostgresException (0x80004005): 3D000: database "Hiya" does not exist
at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage)
at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource<TResult>.GetResult(Int16 token)
at Npgsql.Internal.NpgsqlConnector.<Open>g__OpenCore|214_1(NpgsqlConnector conn, SslMode sslMode, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken)
at Npgsql.Internal.NpgsqlConnector.Open(NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken)
at Npgsql.PoolingDataSource.OpenNewConnector(NpgsqlConnection conn, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken)
at Npgsql.PoolingDataSource.<Get>g__RentAsync|33_0(NpgsqlConnection conn, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken)
at Npgsql.NpgsqlConnection.<Open>g__OpenAsync|42_0(Boolean async, CancellationToken cancellationToken)
at Npgsql.NpgsqlConnection.Open()
at FAnsi.Implementations.PostgreSql.PostgreSqlServerHelper.ListDatabases(DbConnectionStringBuilder builder)+MoveNext() in C:\Users\Ruairidh\src\HicServices\FAnsiSql\FAnsiSql\Implementations\PostgreSql\PostgreSqlServerHelper.cs:line 61
at System.Linq.Enumerable.IEnumerableSelectIterator`2.ToArray()
at FAnsi.Discovery.DiscoveredServer.DiscoverDatabases() in C:\Users\Ruairidh\src\HicServices\FAnsiSql\FAnsiSql\Discovery\DiscoveredServer.cs:line 235
at FAnsi.Discovery.DiscoveredDatabase.Exists(IManagedTransaction transaction) in C:\Users\Ruairidh\src\HicServices\FAnsiSql\FAnsiSql\Discovery\DiscoveredDatabase.cs:line 130
at FAnsiTests.Table.CreateTableTests.<>c__DisplayClass23_0.<Foo>b__0() in C:\Users\Ruairidh\src\HicServices\FAnsiSql\Tests\FAnsiTests\Table\CreateTableTests.cs:line 633
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
--- End of stack trace from previous location ---
at NUnit.Framework.Internal.ExceptionHelper.Rethrow(Exception exception)
at NUnit.Framework.Internal.Reflect.DynamicInvokeWithTransparentExceptions(Delegate delegate)
at NUnit.Framework.Internal.ExceptionHelper.RecordException(Delegate parameterlessDelegate, String parameterName)
Exception data:
Severity: FATAL
SqlState: 3D000
MessageText: database "Hiya" does not exist
File: postinit.c
Line: 945
Routine: InitPostgres>Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels