Feature/poco refactor and postgres#523
Merged
mmckechney merged 140 commits intomasterfrom Mar 20, 2026
Merged
Conversation
…nagement - Added CommandLineBuilderOptions class to define all command-line options for the application. - Implemented OptionRegistry to manage mappings between options and their setters on CommandLineArgs. - Updated Worker class to utilize the new command-line parsing approach with System.CommandLine 2.0. - Removed deprecated Copy method from Extensions class. - Updated project dependencies to use stable version of System.CommandLine.
…iner image builds
Refactored test methods to use rootCommand.Parse(args).InvokeAsync() instead of rootCommand.InvokeAsync(args), improving argument parsing and aligning with System.CommandLine best practices. No change to test logic or outcomes.
Added -timeoutMinutes 300 to all .\run_tests_in_aci.ps1 calls to set test run duration. Corrected customName typo for batchquery test to ensure accurate test execution.
Commented out two Kubernetes YAML integration tests and the KubernetesCreateYamlCommand in the CLI, removing them from active use. Updated a log message to use the correct log level and improved the check for the existence of the Kubernetes secrets file to prevent errors if the file is missing.
Replaces overrideAsFileOption with overrideRequiredOption and removes explicit override file passing in ACI and Kubernetes query commands. The override file path is now set via CommandLineArgs, and Worker method signatures are updated accordingly. Also adds streamEventsOption to AciQuery. This streamlines and unifies override file management across commands.
Enhance batch and container app integration tests by capturing both log and console output for more reliable assertions. Update test scripts to collect results from Azure Storage. Refactor container app CLI commands to properly handle the streamEvents option and remove unused arguments. These changes increase test robustness and ensure correct command-line argument processing.
- Changed several log messages from warnings to informational for expected or non-error events in BatchManager, EnvironmentVariableHelper, and KubectlProcess. - Corrected a log message to reference EventHubLogging instead of AuthType. - Added reading of ServiceBusTopicConnectionString from environment variables. - Updated ContainerAppDeploy result check to treat any non-zero result as failure. - Added and enabled new test cases for MaxPerServer concurrency type in ContainerAppTests. - Cleaned up duplicate and commented-out test cases. - Improves log clarity, test coverage, and environment variable support.
Updated external_integration_tests.ps1 to ensure the testresults directory exists before downloading results from Azure Storage. Added a step to analyze test result files using GitHub Copilot, generating markdown analyses for failures and suspicious log messages.
Feature/command line version
Enables running all Dependent.UnitTest integration tests in Azure Container Instances (ACI) with a SQL Server 2022 sidecar. Adds scripts and Dockerfile for automated build, deployment, and test execution in ACI, with results uploaded to Azure Blob Storage. Refactors test connection strings to use environment variables (SBM_TEST_SQL_SERVER, SBM_TEST_SQL_USER, SBM_TEST_SQL_PASSWORD, SBM_TEST_DB_PATH), allowing tests to run against any SQL Server instance. Fixes typos and naming inconsistencies, updates resource file paths for Linux compatibility, and removes unused references. Improves error messages and documentation for test configuration.
…to support SQL user credentials and trust the sidecar self-signed certificate
Correct method name typo in BatchTests.cs and ContainerAppTests.cs. Ensures consistent references and prevents potential errors.
… the sub-command.
- Introduce Show-TestSummary in ACI PowerShell scripts for live, color-coded test result summaries during and after execution. - Replace string concatenation with Path.Combine in test code for safer file path handling. - Add RegisteredServers__Bad.xml as a new embedded resource for negative test scenarios. - Update test project to include the new resource. - No changes to production code; all updates are in test code, resources, or scripts.
Feature/container dependent tests
Added postgresql-feature.md with a detailed technical plan for implementing PostgreSQL support alongside SQL Server, including architecture changes, abstractions, and implementation phases. Added postgres-feature-tests.md analyzing current test projects and recommending integration or parallelization of PostgreSQL tests. These documents provide a blueprint for feature development and testing strategy.
This commit introduces cross-platform database support, enabling SqlBuildManager to work with both SQL Server and PostgreSQL. Key changes include: - Addition of a DatabasePlatform enum and command-line option to select the target database. - Introduction of IDbConnectionFactory and ITransactionManager interfaces, with implementations for both SQL Server and PostgreSQL. - Abstraction of SQL syntax and resource strings via IScriptSyntaxProvider and ISqlResourceProvider. - Refactoring of all connection, command, and parameter usage to use DbConnection/DbCommand/DbParameter. - Logging and script execution logic is now platform-agnostic. - Command-line and unit test updates to support the new platform option and connection string formats. - Embedded PostgreSQL SQL scripts for logging table and index creation. - Service and factory constructors updated for dependency injection of platform-specific logic. These changes make the codebase database-agnostic and ready for future extensibility.
parameterized query to avoid sql injection Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- Implemented ConnectionHelper and ConnectionData for PostgreSQL. - Created unit tests for ConnectionHelper to validate factory methods for SQL Server and PostgreSQL. - Added DatabasePlatform tests to ensure default and set values are correct. - Developed PostgresConnectionFactory with connection string building and connection creation methods. - Established PostgresInitialization class for setting up PostgreSQL test databases and tables. - Created integration tests for PostgresSqlBuildHelper to validate build script execution. - Added tests for PostgresResourceProvider and PostgresSyntaxProvider to ensure correct SQL generation. - Implemented PostgresTransactionManager with transaction handling tests.
- Removed the existing PostgresSqlBuildHelperTest.cs file and replaced it with a new implementation in the SqlSync.SqlBuild.Dependent.PostgreSQL.UnitTest namespace. - Introduced PostgresInitialization class to handle PostgreSQL-specific setup and teardown for unit tests. - Updated the project files to include necessary references for the new PostgreSQL unit tests. - Created a shared InitializationBase class in the SqlSync.SqlBuild.Dependent.TestBase namespace to encapsulate common initialization logic for different database platforms. - Ensured that the new tests validate the behavior of the build engine against a PostgreSQL instance, including successful commits and rollbacks.
…ing timeout settings
…est to assert expected result for archiving log files
Refactor KeyVaultHelper removing Windows C:\ path in tests
- Implement end-to-end tests for PostgreSQL process build scenarios in PostgresSqlBuildHelperTest. - Introduce DefaultBuildPreparationServiceTests to validate script filtering and build preparation logic. - Create DefaultBuildRetryPolicyTests to ensure correct retry behavior based on build status. - Add SqlServerTransactionManagerTests to verify transaction management logic.
…r PrepareBuild_RunItemIndexes functionality
… ACI, Batch, Container App, and Kubernetes
…rnetes tests to include TestContext for improved logging and error handling
…mproved readability and maintainability across ACI, Batch, Container App, and Kubernetes commands.
- Updated multiple test methods in KubernetesTests, AciTests, BatchTests, and ContainerAppTests to use async/await for loading blob logs instead of blocking calls. - Added blob log validation checks after successful test executions to ensure consistency between logs and test results. - Improved overall test reliability and performance by avoiding synchronous waits.
…ailure database counts for improved test context output
…uniqueness in ACI environments
…e (so it can be run concurrently with the SQL ACI tests) and improve error handling in BlobLogValidator. Reordered tests in `run_all_external_tests_in_acp.ps1` so that the most relevent ones are run first.
… scripts - Created a new documentation file with visual diagrams for the threaded build process flow, replacing ASCII diagrams with draw.io visuals. - Updated Bicep templates to conditionally deploy SQL Server databases based on a new parameter. - Modified main.parameters.json to include the new SQL Server deployment parameter. - Enhanced PowerShell scripts for granting permissions and post-provisioning to check if SQL Server is deployed before executing related tasks. - Improved user prompts in preprovision script for selecting deployment services, including SQL Server and PostgreSQL.
…nd visual diagrams
…rove error handling in validation tests; update logging levels for better clarity.
…er; change SizeAnalysis.sql to embedded resource
…unit tests; update XML namespace handling and logging messages for clarity.
Testing/core build enhancements
Updating documentation
Updated multiple NuGet dependencies in main and test projects, including: - Microsoft.Extensions.Logging and related packages to 10.0.5 - coverlet.collector to 8.0.1 - Npgsql to 10.0.2 - Azure.Identity to 1.19.0 - System.CommandLine to 2.0.5 - Microsoft.Data.SqlClient to 7.0.0 - Microsoft.SqlServer.SqlManagementObjects to 181.15.0 - System.Configuration.ConfigurationManager and System.Diagnostics.EventLog to 10.0.5 - Azure.ResourceManager to 1.14.0 and Azure.ResourceManager.Batch to 1.6.0 - Azure.Security.KeyVault.Secrets to 4.9.0 - Polly to 8.6.6 No code or logic changes; all updates are to .csproj files for dependency management.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces major updates across documentation to reflect new support for PostgreSQL as a first-class database platform alongside SQL Server. The changes clarify test types, platform abstractions, Docker images, infrastructure provisioning, and command-line options. The documentation is also reorganized for better clarity, and references to deprecated scripts and workflows are updated to align with the new Azure Developer CLI-based setup. A new changelog entry summarizes these enhancements.
Major PostgreSQL Support and Documentation Updates:
--platform, updated test types, and feature limitations for PostgreSQL (DACPAC, scripting, and some policies not yet available). [1] [2] [3]IDbConnectionFactory,ITransactionManager, etc.). [1] [2]Infrastructure and Test Automation Enhancements:
azd up) as the primary method, with references to new and updated scripts for both SQL Server and PostgreSQL environments. Deprecated or replaced older PowerShell scripts. [1] [2] [3] [4] [5] [6]Command-Line and Usage Documentation:
--platform), reorganized command references, and improved descriptions for container and batch execution. [1] [2] [3]Release Notes and Changelog:
These changes collectively modernize the documentation, streamline onboarding for new users, and clarify the expanded cross-platform capabilities of SQL Build Manager.