save progress
This commit is contained in:
@@ -107,7 +107,6 @@ public class ReachGraphE2ETests : IClassFixture<WebApplicationFactory<StellaOps.
|
||||
|
||||
var fetchedGraph = await getResponse.Content.ReadFromJsonAsync<ReachGraphMinimal>();
|
||||
Assert.NotNull(fetchedGraph);
|
||||
Assert.NotNull(fetchedGraph.Edges);
|
||||
|
||||
// Verify edge explanations are preserved
|
||||
var edgeTypes = fetchedGraph.Edges.Select(e => e.Why.Type).Distinct().ToList();
|
||||
|
||||
@@ -59,7 +59,7 @@ public class PostgresOnlyStartupTests : IAsyncLifetime
|
||||
|
||||
// Verify connection works
|
||||
using var connection = new Npgsql.NpgsqlConnection(_connectionString);
|
||||
await connection.OpenAsync();
|
||||
await connection.OpenAsync(TestContext.Current.CancellationToken);
|
||||
connection.State.Should().Be(System.Data.ConnectionState.Open);
|
||||
}
|
||||
|
||||
@@ -79,12 +79,12 @@ public class PostgresOnlyStartupTests : IAsyncLifetime
|
||||
{
|
||||
// Arrange
|
||||
using var connection = new Npgsql.NpgsqlConnection(_connectionString);
|
||||
await connection.OpenAsync();
|
||||
await connection.OpenAsync(TestContext.Current.CancellationToken);
|
||||
|
||||
// Act - Create a test schema
|
||||
using var createCmd = connection.CreateCommand();
|
||||
createCmd.CommandText = "CREATE SCHEMA IF NOT EXISTS test_platform";
|
||||
await createCmd.ExecuteNonQueryAsync();
|
||||
await createCmd.ExecuteNonQueryAsync(TestContext.Current.CancellationToken);
|
||||
|
||||
// Assert - Verify schema exists
|
||||
using var verifyCmd = connection.CreateCommand();
|
||||
@@ -92,7 +92,7 @@ public class PostgresOnlyStartupTests : IAsyncLifetime
|
||||
SELECT schema_name
|
||||
FROM information_schema.schemata
|
||||
WHERE schema_name = 'test_platform'";
|
||||
var result = await verifyCmd.ExecuteScalarAsync();
|
||||
var result = await verifyCmd.ExecuteScalarAsync(TestContext.Current.CancellationToken);
|
||||
result.Should().Be("test_platform");
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ public class PostgresOnlyStartupTests : IAsyncLifetime
|
||||
{
|
||||
// Arrange
|
||||
using var connection = new Npgsql.NpgsqlConnection(_connectionString);
|
||||
await connection.OpenAsync();
|
||||
await connection.OpenAsync(TestContext.Current.CancellationToken);
|
||||
|
||||
// Create test table
|
||||
using var createCmd = connection.CreateCommand();
|
||||
@@ -111,33 +111,33 @@ public class PostgresOnlyStartupTests : IAsyncLifetime
|
||||
name VARCHAR(100) NOT NULL,
|
||||
created_at TIMESTAMPTZ DEFAULT NOW()
|
||||
)";
|
||||
await createCmd.ExecuteNonQueryAsync();
|
||||
await createCmd.ExecuteNonQueryAsync(TestContext.Current.CancellationToken);
|
||||
|
||||
// Act - Insert
|
||||
using var insertCmd = connection.CreateCommand();
|
||||
insertCmd.CommandText = "INSERT INTO test_crud (name) VALUES ('test-record') RETURNING id";
|
||||
var insertedId = await insertCmd.ExecuteScalarAsync();
|
||||
var insertedId = await insertCmd.ExecuteScalarAsync(TestContext.Current.CancellationToken);
|
||||
insertedId.Should().NotBeNull();
|
||||
|
||||
// Act - Select
|
||||
using var selectCmd = connection.CreateCommand();
|
||||
selectCmd.CommandText = "SELECT name FROM test_crud WHERE id = @id";
|
||||
selectCmd.Parameters.AddWithValue("id", insertedId!);
|
||||
var name = await selectCmd.ExecuteScalarAsync();
|
||||
var name = await selectCmd.ExecuteScalarAsync(TestContext.Current.CancellationToken);
|
||||
name.Should().Be("test-record");
|
||||
|
||||
// Act - Update
|
||||
using var updateCmd = connection.CreateCommand();
|
||||
updateCmd.CommandText = "UPDATE test_crud SET name = 'updated-record' WHERE id = @id";
|
||||
updateCmd.Parameters.AddWithValue("id", insertedId!);
|
||||
var rowsAffected = await updateCmd.ExecuteNonQueryAsync();
|
||||
var rowsAffected = await updateCmd.ExecuteNonQueryAsync(TestContext.Current.CancellationToken);
|
||||
rowsAffected.Should().Be(1);
|
||||
|
||||
// Act - Delete
|
||||
using var deleteCmd = connection.CreateCommand();
|
||||
deleteCmd.CommandText = "DELETE FROM test_crud WHERE id = @id";
|
||||
deleteCmd.Parameters.AddWithValue("id", insertedId!);
|
||||
rowsAffected = await deleteCmd.ExecuteNonQueryAsync();
|
||||
rowsAffected = await deleteCmd.ExecuteNonQueryAsync(TestContext.Current.CancellationToken);
|
||||
rowsAffected.Should().Be(1);
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ public class PostgresOnlyStartupTests : IAsyncLifetime
|
||||
{
|
||||
// Arrange
|
||||
using var connection = new Npgsql.NpgsqlConnection(_connectionString);
|
||||
await connection.OpenAsync();
|
||||
await connection.OpenAsync(TestContext.Current.CancellationToken);
|
||||
|
||||
// Act - Run a migration-like DDL script
|
||||
var migrationScript = @"
|
||||
@@ -177,12 +177,12 @@ public class PostgresOnlyStartupTests : IAsyncLifetime
|
||||
|
||||
using var migrateCmd = connection.CreateCommand();
|
||||
migrateCmd.CommandText = migrationScript;
|
||||
await migrateCmd.ExecuteNonQueryAsync();
|
||||
await migrateCmd.ExecuteNonQueryAsync(TestContext.Current.CancellationToken);
|
||||
|
||||
// Assert - Verify migration recorded
|
||||
using var verifyCmd = connection.CreateCommand();
|
||||
verifyCmd.CommandText = "SELECT COUNT(*) FROM schema_migrations WHERE version = 'V2_create_scan_results'";
|
||||
var count = await verifyCmd.ExecuteScalarAsync();
|
||||
var count = await verifyCmd.ExecuteScalarAsync(TestContext.Current.CancellationToken);
|
||||
Convert.ToInt32(count).Should().Be(1);
|
||||
}
|
||||
|
||||
@@ -191,17 +191,17 @@ public class PostgresOnlyStartupTests : IAsyncLifetime
|
||||
{
|
||||
// Arrange
|
||||
using var connection = new Npgsql.NpgsqlConnection(_connectionString);
|
||||
await connection.OpenAsync();
|
||||
await connection.OpenAsync(TestContext.Current.CancellationToken);
|
||||
|
||||
// Act - Create common extensions used by StellaOps
|
||||
using var extCmd = connection.CreateCommand();
|
||||
extCmd.CommandText = "CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\"";
|
||||
await extCmd.ExecuteNonQueryAsync();
|
||||
await extCmd.ExecuteNonQueryAsync(TestContext.Current.CancellationToken);
|
||||
|
||||
// Assert - Verify extension exists
|
||||
using var verifyCmd = connection.CreateCommand();
|
||||
verifyCmd.CommandText = "SELECT COUNT(*) FROM pg_extension WHERE extname = 'uuid-ossp'";
|
||||
var count = await verifyCmd.ExecuteScalarAsync();
|
||||
var count = await verifyCmd.ExecuteScalarAsync(TestContext.Current.CancellationToken);
|
||||
Convert.ToInt32(count).Should().Be(1);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user