-
Notifications
You must be signed in to change notification settings - Fork 80
fix: skip e2e live connection tests when SQL auth credentials unavailable #659
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix: skip e2e live connection tests when SQL auth credentials unavailable #659
Conversation
The Azure DevOps pipeline runs tests twice: 1. SQL2022: Uses SQL auth (sa user) - tests will run 2. SQLDB: Uses Azure AD auth (service principal) - tests should skip The live connection e2e tests require SQL auth credentials (SQLCMDUSER/SQLCMDPASSWORD) which aren't available in the Azure AD auth scenario. Added skipIfNoSQLAuth() to properly skip these tests instead of failing with 'Login failed for user ''.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes pipeline failures from PR #642 by adding proper test skipping logic for end-to-end tests that require SQL authentication credentials. The SQLDB pipeline test runs use Azure AD authentication without SQLCMDUSER/SQLCMDPASSWORD environment variables, causing these tests to fail inappropriately.
Changes:
- Added
hasSQLAuthCredentials()helper function to check for SQL authentication credentials (SQLCMDUSER and SQLCMDPASSWORD) - Added
skipIfNoSQLAuth()helper function that skips tests when SQL authentication is not available - Updated three live connection tests to use the new skip function instead of just checking for SQLCMDSERVER
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Problem
PR #642 added e2e tests that require SQL authentication credentials (SQLCMDUSER/SQLCMDPASSWORD). The ADO pipeline runs tests twice with different authentication methods:
The SQLDB run intentionally omits SQL credentials because it tests Azure AD/Entra authentication via service principal (using
AZURESUBSCRIPTION_CLIENT_IDandAZURESUBSCRIPTION_TENANT_ID).PR #642's tests used
skipIfNoLiveConnection()which only checksSQLCMDSERVER. Since both runs have that set, both tried to run the tests. The SQLDB run failed with:Solution
Added
skipIfNoSQLAuth()helper that checks for SQL authentication credentials before running tests that require them:hasSQLAuthCredentials()- checks both SQLCMDUSER and SQLCMDPASSWORD are setskipIfNoSQLAuth()- chains withskipIfNoLiveConnection(), then checks SQL auth credentialsResult
The SQL2022 coverage is unchanged - tests still execute against a real SQL Server. Tests are skipped on SQLDB where they can't work anyway (no SQL auth credentials available).
Alternative Considered
Making the e2e tests work with Azure AD auth was considered, but these tests verify query functionality (piped input, -Q flag, input files), not authentication methods. Skipping when SQL auth isn't available is the pragmatic solution.
Files Changed
cmd/modern/e2e_test.go: Added SQL auth check helpers, updated 3 tests to useskipIfNoSQLAuth()