Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions 8 test/Npgsql.Tests/ConnectionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,11 @@ public async Task Connection_refused_async(bool pooled)
#endif

[Test]
[Ignore("Fails in a non-determinstic manner and only on the build server... investigate...")]
public void Invalid_Username()
{
if (IsMultiplexing)
Assert.Ignore();

var connString = new NpgsqlConnectionStringBuilder(ConnectionString)
{
Username = "unknown", Pooling = false
Expand Down Expand Up @@ -1259,9 +1261,11 @@ public async Task Many_open_close_with_transaction()
[Test]
[IssueLink("https://github.com/npgsql/npgsql/issues/927")]
[IssueLink("https://github.com/npgsql/npgsql/issues/736")]
[Ignore("Fails when running the entire test suite but not on its own...")]
public async Task Rollback_on_close()
{
if (IsMultiplexing)
Assert.Ignore();

// Npgsql 3.0.0 to 3.0.4 prepended a rollback for the next time the connector is used, as an optimization.
// This caused some issues (#927) and was removed.

Expand Down
3 changes: 1 addition & 2 deletions 3 test/Npgsql.Tests/CopyTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,6 @@ public async Task Wrong_format_binary_export()
}

[Test, NonParallelizable, IssueLink("https://github.com/npgsql/npgsql/issues/661")]
[Ignore("Unreliable")]
public async Task Unexpected_exception_binary_import()
{
if (IsMultiplexing)
Expand All @@ -701,7 +700,7 @@ public async Task Unexpected_exception_binary_import()
writer.StartRow();
writer.Write(data);
writer.Dispose();
}, Throws.Exception.TypeOf<IOException>());
}, Throws.Exception.InstanceOf<NpgsqlException>());
Assert.That(conn.FullState, Is.EqualTo(ConnectionState.Broken));
}

Expand Down
20 changes: 7 additions & 13 deletions 20 test/Npgsql.Tests/DataAdapterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ public async Task DataAdapter_update_return_value()
}

[Test]
[Ignore("")]
public async Task DataAdapter_update_return_value2()
{
using var conn = await OpenConnectionAsync();
Expand All @@ -158,15 +157,15 @@ public async Task DataAdapter_update_return_value2()
da.Update(ds);

//## change id from 1 to 2
cmd.CommandText = $"update {table} set field_float4 = 0.8";
cmd.CommandText = $"update {table} set field_numeric = 0.8";
cmd.ExecuteNonQuery();

//## change value to newvalue
ds.Tables[0].Rows[0][1] = 0.7;
//## update should fail, and make a DBConcurrencyException
var count = da.Update(ds);
//## count is 1, even if the isn't updated in the database
Assert.That(count, Is.EqualTo(0));
//## count is 1, even if the row isn't updated in the database
Assert.That(count, Is.EqualTo(1));
}

[Test]
Expand All @@ -189,7 +188,6 @@ public async Task Fill_with_empty_resultset()
}

[Test]
[Ignore("")]
public async Task Fill_add_with_key()
{
using var conn = await OpenConnectionAsync();
Expand All @@ -211,7 +209,7 @@ public async Task Fill_add_with_key()
Assert.That(field_serial.ColumnName, Is.EqualTo("field_serial"));
Assert.That(field_serial.DataType, Is.EqualTo(typeof(int)));
Assert.That(field_serial.Ordinal, Is.EqualTo(0));
Assert.That(field_serial.Unique);
Assert.That(field_serial.Unique, Is.False);

Assert.That(field_int2.AllowDBNull);
Assert.That(field_int2.AutoIncrement, Is.False);
Expand Down Expand Up @@ -329,7 +327,6 @@ public async Task Fill_with_duplicate_column_name()
}

[Test]
[Ignore("")]
public Task Update_with_DataSet() => DoUpdateWithDataSet();

public async Task DoUpdateWithDataSet()
Expand Down Expand Up @@ -365,7 +362,6 @@ public async Task DoUpdateWithDataSet()
}

[Test]
[Ignore("")]
public async Task Insert_with_CommandBuilder_case_sensitive()
{
using var conn = await OpenConnectionAsync();
Expand All @@ -380,7 +376,7 @@ public async Task Insert_with_CommandBuilder_case_sensitive()

var dt = ds.Tables[0];
var dr = dt.NewRow();
dr["Field_Case_Sensitive"] = 4;
dr["Field_int4"] = 4;
dt.Rows.Add(dr);

var ds2 = ds.GetChanges()!;
Expand All @@ -390,7 +386,7 @@ public async Task Insert_with_CommandBuilder_case_sensitive()

using var dr2 = new NpgsqlCommand($"select * from {table}", conn).ExecuteReader();
dr2.Read();
Assert.That(dr2[1], Is.EqualTo(4));
Assert.That(dr2["field_int4"], Is.EqualTo(4));
}

[Test]
Expand Down Expand Up @@ -454,7 +450,6 @@ public async Task DataAdapter_command_access()

[Test, Description("Makes sure that the INSERT/UPDATE/DELETE commands are auto-populated on NpgsqlDataAdapter")]
[IssueLink("https://github.com/npgsql/npgsql/issues/179")]
[Ignore("Somehow related to us using a temporary table???")]
public async Task Auto_populate_adapter_commands()
{
using var conn = await OpenConnectionAsync();
Expand Down Expand Up @@ -494,7 +489,6 @@ public void Command_builder_quoting()

[Test, Description("Makes sure a correct SQL string is built with GetUpdateCommand(true) using correct parameter names and placeholders")]
[IssueLink("https://github.com/npgsql/npgsql/issues/397")]
[Ignore("Somehow related to us using a temporary table???")]
public async Task Get_UpdateCommand()
{
using var conn = await OpenConnectionAsync();
Expand Down Expand Up @@ -538,7 +532,7 @@ public async Task Load_DataTable()

public Task<string> SetupTempTable(NpgsqlConnection conn)
=> CreateTempTable(conn, @"
field_pk SERIAL PRIMARY KEY,
field_pk INTEGER PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
field_serial SERIAL,
field_int2 SMALLINT,
field_int4 INTEGER,
Expand Down
72 changes: 15 additions & 57 deletions 72 test/Npgsql.Tests/NpgsqlParameterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.Data;
using System.Data.Common;
using System.Threading.Tasks;
using Npgsql.Internal.Postgres;

namespace Npgsql.Tests;

Expand Down Expand Up @@ -326,44 +325,6 @@ public void Clone_generic()

#endregion

[Test]
[Ignore("")]
public void InferType_invalid_throws()
{
var notsupported = new object[]
{
ushort.MaxValue,
uint.MaxValue,
ulong.MaxValue,
sbyte.MaxValue,
new NpgsqlParameter()
};

var param = new NpgsqlParameter();

for (var i = 0; i < notsupported.Length; i++)
{
try
{
param.Value = notsupported[i];
Assert.Fail("#A1:" + i);
}
catch (FormatException)
{
// appears to be bug in .NET 1.1 while
// constructing exception message
}
catch (ArgumentException ex)
{
// The parameter data type of ... is invalid
Assert.That(ex.GetType(), Is.EqualTo(typeof(ArgumentException)), "#A2");
Assert.That(ex.InnerException, Is.Null, "#A3");
Assert.That(ex.Message, Is.Not.Null, "#A4");
Assert.That(ex.ParamName, Is.Null, "#A5");
}
}
}

[Test] // bug #320196
public void Parameter_null()
{
Expand All @@ -379,50 +340,49 @@ public void Parameter_null()
}

[Test]
[Ignore("")]
public void Parameter_type()
{
NpgsqlParameter p;

// If Type is not set, then type is inferred from the value
// assigned. The Type should be inferred everytime Value is assigned
// If value is null or DBNull, then the current Type should be reset to Text.
p = new NpgsqlParameter();
// If value is null or DBNull, then the current Type should be reset to Unknown (DbType.Object and NpgsqlDbType.Unknown).
p = new NpgsqlParameter { Value = "" };
Assert.That(p.DbType, Is.EqualTo(DbType.String), "#A1");
Assert.That(p.NpgsqlDbType, Is.EqualTo(NpgsqlDbType.Text), "#A2");
p.Value = DBNull.Value;
Assert.That(p.DbType, Is.EqualTo(DbType.String), "#B1");
Assert.That(p.NpgsqlDbType, Is.EqualTo(NpgsqlDbType.Text), "#B2");
Assert.That(p.DbType, Is.EqualTo(DbType.Object), "#B1");
Assert.That(p.NpgsqlDbType, Is.EqualTo(NpgsqlDbType.Unknown), "#B2");
p.Value = 1;
Assert.That(p.DbType, Is.EqualTo(DbType.Int32), "#C1");
Assert.That(p.NpgsqlDbType, Is.EqualTo(NpgsqlDbType.Integer), "#C2");
p.Value = DBNull.Value;
Assert.That(p.DbType, Is.EqualTo(DbType.String), "#D1");
Comment thread
NinoFloris marked this conversation as resolved.
Assert.That(p.NpgsqlDbType, Is.EqualTo(NpgsqlDbType.Text), "#D2");
Assert.That(p.DbType, Is.EqualTo(DbType.Object), "#D1");
Assert.That(p.NpgsqlDbType, Is.EqualTo(NpgsqlDbType.Unknown), "#D2");
p.Value = new byte[] { 0x0a };
Assert.That(p.DbType, Is.EqualTo(DbType.Binary), "#E1");
Assert.That(p.NpgsqlDbType, Is.EqualTo(NpgsqlDbType.Bytea), "#E2");
p.Value = null;
Assert.That(p.DbType, Is.EqualTo(DbType.String), "#F1");
Assert.That(p.NpgsqlDbType, Is.EqualTo(NpgsqlDbType.Text), "#F2");
Assert.That(p.DbType, Is.EqualTo(DbType.Object), "#F1");
Assert.That(p.NpgsqlDbType, Is.EqualTo(NpgsqlDbType.Unknown), "#F2");
p.Value = DateTime.Now;
Assert.That(p.DbType, Is.EqualTo(DbType.DateTime), "#G1");
Assert.That(p.DbType, Is.EqualTo(DbType.DateTime2), "#G1");
Assert.That(p.NpgsqlDbType, Is.EqualTo(NpgsqlDbType.Timestamp), "#G2");
p.Value = null;
Assert.That(p.DbType, Is.EqualTo(DbType.String), "#H1");
Assert.That(p.NpgsqlDbType, Is.EqualTo(NpgsqlDbType.Text), "#H2");
Assert.That(p.DbType, Is.EqualTo(DbType.Object), "#H1");
Assert.That(p.NpgsqlDbType, Is.EqualTo(NpgsqlDbType.Unknown), "#H2");

// If DbType is set, then the NpgsqlDbType should not be
// inferred from the value assigned.
p = new NpgsqlParameter();
p.DbType = DbType.DateTime;
Assert.That(p.NpgsqlDbType, Is.EqualTo(NpgsqlDbType.Timestamp), "#I1");
Assert.That(p.NpgsqlDbType, Is.EqualTo(NpgsqlDbType.TimestampTz), "#I1");
p.Value = 1;
Assert.That(p.NpgsqlDbType, Is.EqualTo(NpgsqlDbType.Timestamp), "#I2");
Assert.That(p.NpgsqlDbType, Is.EqualTo(NpgsqlDbType.TimestampTz), "#I2");
p.Value = null;
Assert.That(p.NpgsqlDbType, Is.EqualTo(NpgsqlDbType.Timestamp), "#I3");
Assert.That(p.NpgsqlDbType, Is.EqualTo(NpgsqlDbType.TimestampTz), "#I3");
p.Value = DBNull.Value;
Assert.That(p.NpgsqlDbType, Is.EqualTo(NpgsqlDbType.Timestamp), "#I4");
Assert.That(p.NpgsqlDbType, Is.EqualTo(NpgsqlDbType.TimestampTz), "#I4");

// If NpgsqlDbType is set, then the DbType should not be
// inferred from the value assigned.
Expand All @@ -447,7 +407,6 @@ public async Task Match_param_index_case_insensitively()
}

[Test]
[Ignore("")]
public void ParameterName()
{
var p = new NpgsqlParameter();
Expand Down Expand Up @@ -540,7 +499,6 @@ public void ParameterName_retains_prefix()
=> Assert.That(new NpgsqlParameter("@p", DbType.String).ParameterName, Is.EqualTo("@p"));

[Test]
[Ignore("")]
public void SourceColumn()
{
var p = new NpgsqlParameter();
Expand Down
4 changes: 1 addition & 3 deletions 4 test/Npgsql.Tests/TypeMapperTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public async Task ReloadTypes_across_connections_in_data_source()
}

[Test]
[NonParallelizable] // Depends on citext which could be dropped concurrently
public async Task String_to_citext()
{
await using var adminConnection = await OpenConnectionAsync();
Expand All @@ -62,7 +61,6 @@ public async Task String_to_citext()
}

[Test]
[NonParallelizable] // Depends on citext which could be dropped concurrently
public async Task String_to_citext_with_db_type_string()
{
await using var adminConnection = await OpenConnectionAsync();
Expand Down Expand Up @@ -152,7 +150,7 @@ await connection.ExecuteNonQueryAsync($"""
}

[Test, IssueLink("https://github.com/npgsql/npgsql/issues/4582")]
[NonParallelizable] // Drops extension
[NonParallelizable] // Drops global citext extension.
public async Task Type_in_non_default_schema()
{
await using var conn = await OpenConnectionAsync();
Expand Down
1 change: 0 additions & 1 deletion 1 test/Npgsql.Tests/Types/MultirangeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ public Task Multirange_as_list<T, TRange>(
sqlLiteral, pgTypeName, npgsqlDbType, isDefaultForReading: false, isDefaultForWriting: isDefaultForWriting);

[Test]
[NonParallelizable]
public async Task Unmapped_multirange_with_mapped_subtype()
{
await using var dataSource = CreateDataSource(b => b.EnableUnmappedTypes().ConnectionStringBuilder.MaxPoolSize = 1);
Expand Down
1 change: 0 additions & 1 deletion 1 test/Npgsql.Tests/Types/RangeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ public async Task TimestampTz_range_with_DateTimeOffset()
}

[Test]
[NonParallelizable]
public async Task Unmapped_range_with_mapped_subtype()
{
await using var dataSource = CreateDataSource(b => b.EnableUnmappedTypes().ConnectionStringBuilder.MaxPoolSize = 1);
Expand Down
1 change: 0 additions & 1 deletion 1 test/Npgsql.Tests/Types/TextTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ public Task Char_as_char()
=> AssertType('f', "f", "character", NpgsqlDbType.Char, inferredDbType: DbType.String, isDefault: false);

[Test]
[NonParallelizable]
public async Task Citext_as_string()
{
await using var conn = await OpenConnectionAsync();
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.