Skip to content

EF Core Oracle test asserts a lowercase PK column name the mapping never produces #394

Description

@jeremydmiller

Weasel.EntityFrameworkCore.Tests.Oracle.end_to_end.can_map_entity_to_table fails against a live Oracle instance:

Shouldly.ShouldAssertException : table.PrimaryKeyColumns
    should contain
"id"
    but was actually
["Id"]

src/Weasel.EntityFrameworkCore.Tests/Oracle/end_to_end.cs:77

What's inconsistent

In the same test, immediately above the failing line, every ordinary column asserts successfully in lowercase — table.HasColumn("id"), HasColumn("intvalue"), HasColumn("null_dt_offset_val") and so on all pass. So MapToTable is lowercasing column names for Oracle as intended.

table.PrimaryKeyColumns, though, comes back as ["Id"] — the EF property casing, unnormalized. The primary-key column list appears to be populated from a different path than the column list, and that path skips whatever lowercasing the Oracle mapping applies elsewhere.

Whether the right fix is to normalize PrimaryKeyColumns at the same point the columns are normalized, or to make the test assert Oracle's uppercase convention, is worth deciding deliberately — the mismatch between HasColumn("id") passing and PrimaryKeyColumns containing "Id" is the actual bug regardless of which side moves.

This is pre-existing, not from the xUnit v3 migration

Verified by checking out pre-migration master in a separate worktree and running the same single test against the same Oracle container: it produces a byte-identical failure. Filed as follow-up from #393, where it surfaced.

Why CI doesn't catch it

.github/workflows/ci-build-efcore.yml runs with --filter "FullyQualifiedName!~Oracle", because that workflow has no Oracle service — the comment in the workflow says the Oracle EF suite "only runs locally against docker-compose". So the whole Oracle/ folder, including this test, never executes in CI.

That means this suite's Oracle coverage is only ever exercised by someone running it locally, and it has been red there. Two things could help beyond the fix itself:

  • an Oracle service in the EF Core workflow so the folder actually runs (the standalone ci-build-oracle.yml already starts one via docker compose), or
  • failing that, marking the known-bad test Skip with a link here, so a local run is green and the gap is explicit rather than discovered by surprise.

Repro

docker compose up -d oracle
dotnet test src/Weasel.EntityFrameworkCore.Tests/Weasel.EntityFrameworkCore.Tests.csproj \
  --framework net9.0 \
  --filter "FullyQualifiedName~Oracle.end_to_end.can_map_entity_to_table"

Related

Oracle/end_to_end.cs already carries a second, separately skipped test: [Fact(Skip = "Skipped due to pre-existing bug in Weasel.Oracle schema detection SQL (ORA-03048)")]. Different root cause, but the same corner of the codebase is accumulating known-broken Oracle EF behaviour that CI cannot see.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions