Open DorBreger opened 3 months ago
Thank you for contribution!✨
The docs for this PR have been published here: https://lowlydba.github.io/lowlydba.sqlserver/pr/249
You can compare to the docs for the main
branch here:
https://lowlydba.github.io/lowlydba.sqlserver/branch/main
The docsite for this PR is also available for download as an artifact from this run: https://github.com/lowlydba/lowlydba.sqlserver/actions/runs/9518565030
File changes:
Indicates whether the availability group is Contained. Requires DBATools >= 2.1.15
+Choices:
+false
true
database
aliases: database_name
@@ -264,7 +276,7 @@ seeName of the database to create the Availability Group for.
The network share where the backups will be backed up and restored from.
The SQL Server instance to modify.
The secondary SQL Server instance for the new Availability Group.
Password for SQL Authentication.
Password for SQL Authentication for the secondary replica.
Username for SQL Authentication.
Username for SQL Authentication for the secondary replica.
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 100.00%. Comparing base (
655394d
) to head (2ede116
).
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Alright @lowlydba I think I'm ready for you to have a look at the PR
I just updated the repo permissions so you should be able to trigger the CI tests with your own commits now as well.
Hi! Just in case you missed it, what kind of tests did you mean?
Hi! Just in case you missed it, what kind of tests did you mean?
Right below the comment thread here, you'll see a series of workflows that run integration and unit tests for the collection. Right now the "CI / Sanity" test is failing for some minor issues - all of the workflows will need to pass to make this mergeable.
I still don't really understand how to add tests that cover contained AGs, I edited tests/integration/ and added an option to change contained_availability_group, but where can I create a test where it is set to true?
I still don't really understand how to add tests that cover contained AGs, I edited tests/integration/ and added an option to change contained_availability_group, but where can I create a test where it is set to true?
Because what I would really like to do is to run the win_availability_group test with contained_availability_group: true
and I was wondering if that's possible without creating a new test.
I still don't really understand how to add tests that cover contained AGs, I edited tests/integration/ and added an option to change contained_availability_group, but where can I create a test where it is set to true?
Because what I would really like to do is to run the win_availability_group test with
contained_availability_group: true
and I was wondering if that's possible without creating a new test.
Yeah, the issue is right now its always set to false, so it won't get tested. You'd want to add a new test like:
- name: Create contained availability group
lowlydba.sqlserver.availability_group:
ag_name: "contained_AG"
contained_availability_group: true
register: result
- assert:
that:
- result.data.ComputerName != None
- result.data.InstanceName != None
- result.data.SqlInstance != None
- result.data.AvailabilityGroup == "contained_AG"
- result.data.ClusterType == "{{ cluster_type }}"
- result.data.DtcSupportEnabled is false
- result.data.AvailabilityReplicas != None
- result is changed
The when
conditionals now won't get use as written, so those can probably be removed.
Seems like adding a test form contained AGs didn't help the codecov test? Would really like your input on that @lowlydba. Thank you!
Also, I noticed I don't handle the case where an availability group that is not contained exists but the module specifies it should be contained. It is currently not possible to have an availability group be converted to a contained availability group, should I just error out in this case? and if force is specified only then drop it and recreate?
Also, I noticed I don't handle the case where an availability group that is not contained exists but the module specifies it should be contained. It is currently not possible to have an availability group be converted to a contained availability group, should I just error out in this case? and if force is specified only then drop it and recreate?
It should probably error out in both cases, using force to drop and re-create feels a bit too risky as behavior in general.
Seems like adding a test form contained AGs didn't help the codecov test? Would really like your input on that @lowlydba. Thank you!
The codecov tests appear to be passing (they just look for code coverage) but the actual tests are failing.
I am not sure why the original availability group test is failing now though:
TASK [win_availability_group : Create availability group] ** ... The full traceback is: Database "ag-test-db" might contain bulk logged changes that have not been backed up. Take a log backup on the principal database or primary database. Then restore this backup either on the mirror database to enable database mirroring or on every secondary database to enable you to join it to the availability group.
I can't seem to figure out why the test is failing? doesn't seem to have anything to do with my changes either. I also have a hard time replicating this bug on my local setup.
I can't seem to figure out why the test is failing? doesn't seem to have anything to do with my changes either. I also have a hard time replicating this bug on my local setup.
It may be helpful to try having the new "Create Contained availability group" test use all its own variables (i.e. not the same database as the AG test above it) to rule out any issues from re-using parts of the tests earlier in the file. This will help narrow down what the issue is. I think using a separate database may resolve the backup warnings you're seeing.
For the dlevel tests, I am pushing a fix for those via https://github.com/lowlydba/lowlydba.sqlserver/pull/257/files
I can't seem to figure out why the test is failing? doesn't seem to have anything to do with my changes either. I also have a hard time replicating this bug on my local setup.
It may be helpful to try having the new "Create Contained availability group" test use all its own variables (i.e. not the same database as the AG test above it) to rule out any issues from re-using parts of the tests earlier in the file. This will help narrow down what the issue is. I think using a separate database may resolve the backup warnings you're seeing.
For the dlevel tests, I am pushing a fix for those via https://github.com/lowlydba/lowlydba.sqlserver/pull/257/files
Sounds good. How would you like me to implement this syntactically in the same file as the regular tests?
Sounds good. How would you like me to implement this syntactically in the same file as the regular tests?
I think just using the inputs needed inline for each assertion is fine, no need to declare a ton of them at the top like the current ones.
Description
How Has This Been Tested?
Types of changes
Checklist:
version_added
property.