Skip to content

Optimize integration tests by removing unnecessary database startup and connections #2284

@coderabbitai

Description

@coderabbitai

Description

Some integration tests are starting SQL Server services and establishing database connections in their BeforeAll/AfterAll blocks even when the tests themselves don't require actual database connectivity.

Problem

This creates unnecessary overhead in the test suite by:

  • Starting SQL Server services that aren't used
  • Creating database connections that aren't needed
  • Consuming additional memory and processing time on build workers
  • Slowing down test execution

Proposed Solution

Audit all integration tests to identify which ones actually require database connectivity and remove the database startup/connection setup from tests that don't need it.

Example

Tests like ConvertFrom-SqlDscDatabasePermission.Integration.Tests.ps1 may not need the full database setup if they're only testing data conversion functionality.

References

Acceptance Criteria

  • Audit all integration tests in tests/Integration/Commands/
  • Identify tests that don't actually use database connectivity
  • Remove unnecessary BeforeAll/AfterAll database setup blocks
  • Verify tests still pass after optimization
  • Document which tests require database connectivity vs those that don't

Metadata

Metadata

Assignees

Labels

testsThe issue or pull request is about tests only.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions