dsccommunity / dsccommunity/SqlServerDsc

SqlSetup: The arguments passed to setup.exe is not tested with the actual values

Open
#1,553 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

help wanted tests
Dominant language
PowerShell
Stars
385
Forks
224
PR merge metrics
No merged PRs in 30d

Description

The unit tests for SqlSetup is using a test helper function Test-SetupArgument. This function is parsing the actual arguments passed to setup.exe by removing any quotes etc. This should not be done since it should test the actual values passed to setup.exe, quotes and everything.

Work was done with the parameter SkipRules that tests the actual values against an expected value with quotes.

The following:

$mockStartSqlSetupProcessExpectedArgument = @{
    Quiet = 'True'
    IAcceptSQLServerLicenseTerms = 'True'
    Action = 'Install'
    InstanceName = $testParameters.InstanceName
    Features = $testParameters.Features
    SQLSysAdminAccounts = 'COMPANY\sqladmin COMPANY\SQLAdmins COMPANY\User1'
    PID = $testParameters.ProductKey
    SkipRule = '"Cluster_VerifyForErrors"'
}

Should really be:

$mockStartSqlSetupProcessExpectedArgument = @{
    Quiet = '"True"'
    IAcceptSQLServerLicenseTerms = '"True"'
    Action = '"Install"'
    InstanceName = ('"' + $testParameters.InstanceName + '"')
    Features = ('"' + $testParameters.Features + '"')
    SQLSysAdminAccounts = '"COMPANY\sqladmin" "COMPANY\SQLAdmins" "COMPANY\User1"'
    PID = ('"' + $testParameters.ProductKey + '"')
    SkipRule = '"Cluster_VerifyForErrors"'
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the SqlSetup unit tests and the Test-SetupArgument helper. Compare the existing SkipRules assertion with the expected argument map in the issue, preserving the quotes and spacing passed to setup.exe. Done means the tests verify the actual argument values and the relevant unit tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell, sql
Domain
databases, testing-qa
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.