Skip to content

Install-DbaMaintenanceSolution: adds tests for defaults reported by documentation, some failing#10184

Open
ReeceGoding wants to merge 1 commit intodataplat:developmentfrom
ReeceGoding:Ola-defaults
Open

Install-DbaMaintenanceSolution: adds tests for defaults reported by documentation, some failing#10184
ReeceGoding wants to merge 1 commit intodataplat:developmentfrom
ReeceGoding:Ola-defaults

Conversation

@ReeceGoding
Copy link
Contributor

Adds many tests for #10183. Four of these fail.

The Important Parts

Although a lot of tests are added here, the bottom line is that this adds four failing tests. The four that fail check that we have the following documentation-claimed behaviors:

  • When -Verify is not specified, we should enable verify.
  • When -Checksum is not specified, but the instance has it on by default, we should enable it in the job.
  • When -Checksum is not specified, but the instance has it off by default, we should enable it in the job.
  • When -Compress is not specified, but the instance has it on by default, we should enable it in the job.

We can fix these once we agree how. Somebody will have to tell me how we want this done. Most of this is mentioned in #10183.

Full Details

This adds a test context for "Defaults for unspecified parameters are as documentation says", including three tests:

The "Checksum tests when instance defaults to checksum on" and "Checksum tests when instance defaults to checksum off" contexts are expanded to test for -CheckSum on, off, and not specified. To accommodate this, we now uninstall the maintenance solution after each test in these contexts. In both contexts, only the "not specified" test fails. This is as #10183 predicts.

Similarly, the two contexts "Compression tests when instance defaults to compression on" and "Compression tests when instance defaults to compression off" have been added and they test for -Compress on, off, and not specified. Among these, only the test where compression is turned on by default for the instance but not specified in the install command fails.

Type of Change

  • Bug fix (non-breaking change, fixes # )
  • New feature (non-breaking change, adds functionality, fixes # )
  • Breaking change (affects multiple commands or functionality, fixes # )
  • Ran manual Pester test and has passed (Invoke-ManualPester)
  • Adding code coverage to existing functionality
  • Pester test is included
  • If new file reference added for test, has is been added to github.com/dataplat/appveyor-lab ?
  • Unit test is included
  • Documentation
  • Build system

Although a lot of tests are added here, the bottom line is that this adds four failing tests. The four that fail check that we have the following documentation-claimed behaviors:

* When `-Verify` is not specified, we should enable verify.
* When `-Checksum` is not specified, but the instance has it on by default, we should enable it in the job.
* When `-Checksum` is not specified, but the instance has it off by default, we should enable it in the job.
* When `-Compress` is not specified, but the instance has it on by default, we should enable it in the job.

We can fix these once we agree how. **Somebody will have to tell me how we want this done**. Most of this is mentioned in dataplat#10183.

This adds a test context for "Defaults for unspecified parameters are as documentation says", including three tests

* "Should have Verify parameter set to Y in backup jobs", which fails as dataplat#10183 predicts
* "Should have StartTime set to 011500 in backup schedule", which passes
* "Should have BackupLocation parameter set to instance default in backup jobs", which passes.

The "Checksum tests when instance defaults to checksum on" and "Checksum tests when instance defaults to checksum off" contexts are expanded to test for `-CheckSum` on, off, and not specified. To accommodate this, we now uninstall the maintenance solution after each test in these contexts. In both contexts, only the "not specified" test fails. This is as dataplat#10183 predicts.

Similarly, the two contexts "Compression tests when instance defaults to compression on" and "Compression tests when instance defaults to compression off" have been added and they test for `-Compress` on, off, and not specified. Among these, only the test where compression is turned on by default for the instance but not specified in the install command fails.
@andreasjordan
Copy link
Collaborator

I think:

  • "Verify" and "Checksum" are switch parameters, so have a default of $false.
  • "Verify" is an extra to the backup job that should not be enabled by default as it adds time and maybe costs.
  • "Checksum" should be set to $true at the instance level with just one setting an not be included in every backup job.
  • So they both should not be included in the command by default.
  • "Checksum" should not be included based on the instance setting.
  • They should only be included and set to "Y" if the switch parameter is used.

@andreasjordan
Copy link
Collaborator

I am not a fan of useing three states of a switch "$true / $false / not used" as it makes things like Install-DbaMaintenanceSolution -Verify:$verify -Checksum:$checksum impossible.

@ReeceGoding
Copy link
Contributor Author

Let's discuss on the issue's page.

@claude claude bot mentioned this pull request Mar 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants