Skip to content

Use testcontainer for SQL Server tests by default #33267

Description

@ajcvickers

Currently SQL Server must be installed before running our tests. Historically. people typically got this by installing Visual Studio with LocalDb. However, this is no longer a great option because:

  • The version of LocalDb that ships with Visual Studio is currently, and is usually, an older version.
  • This doesn't help people on non-Windows machines
  • Manual installation and configuration of dependencies is error prone, with better solutions now available.

We should therefore start using a SQL Server testcontainer by default. I understand that this will not work on the C.I., so we should ensure that the C.I. continues to work either in the old way, or in some other way that is supported by the C.I. system.

Activity

  1. roji commented on Mar 7, 2024

    @roji
    Member

    Yeah, FWIW in our local development workflow, we likely want to continue using a persistent SQL Server anyway, to be able to inspect it easily while testing, have faster startup times etc. So I think testcontainers here would in any case be a default that's overridable via an environment variable - both for devs which choose to do that and probably also for CI (though it may be worth checking if we can make things work there).

  2. pinkfloydx33 commented on Mar 7, 2024

    @pinkfloydx33

    I'm curious what prevents you from using testcontainers in CI? Is it some limitation of the test suite/test setup? I'm genuinely interested as we've been running testcontainers in CI without a hitch and I might have some ideas depending on what the blockers are.

  3. roji commented on Mar 7, 2024

    @roji
    Member

    @pinkfloydx33 the problem isn't CI in general, but the specific images used in our own CI system, where we're not sure whether we can run docker etc. We haven't actually looked into it, but if there's an issue, It's really specific to our platform.

  4. pinkfloydx33 commented on Mar 7, 2024

    @pinkfloydx33

    Ah I see. I'd be surprised if you couldn't. Assuming github runners or azure devops, the public microsoft images have docker installed on them. You can see their definitions in the runner-images repo.

    (We actually ended up forking that repo and building our own slimmed down/customized vm image with a larger set of docker images pre-pulled, but they all start with docker on them)

  5. roji commented on Mar 7, 2024

    @roji
    Member

    the public microsoft images have docker installed on them

    I'm pretty sure these aren't public images.

  6. assigned and unassigned on Mar 10, 2024
  7. added this to the Backlog milestone on Mar 25, 2024
  8. added theissue type on Jun 15, 2025
  9. self-assigned this
    on Feb 26, 2026
  10. roji commented on Feb 26, 2026

    @roji
    Member

    Another possible reason for this is for agents to spin up their own testcontainer for their private use; this can be important now that we're running multiple agents in parallel, who might each be running tests and might step over each other's toes in the database.

    This might also help with sandboxed agents, where configuring them to access the machine-wide SQL Server might be difficult/unfeasible (not yet sure exactly how that works). But in any case the parallel work of agents makes this desirable in any case.

  11. modified the milestones: Backlog, 11.0.0 on Feb 26, 2026
  12. added a commit that references this issue on Feb 26, 2026
    4f749c8
  13. modified the milestones: 11.0.0, Backlog on Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions