Skip to content

Commit

Permalink
added contained AG test
Browse files Browse the repository at this point in the history
  • Loading branch information
DorBreger committed Jun 14, 2024
1 parent 3c3ad98 commit 2a9a2ce
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
dependencies:
- setup_sqlserver_test_plugins
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
- name: Var block
vars:
ag_name: "containedAG"
cluster_type: "None"
contained_availability_group: true
force: false
module_defaults:
lowlydba.sqlserver.availability_group:
sql_instance: "{{ sqlserver_instance }}"
sql_username: "{{ sqlserver_username }}"
sql_password: "{{ sqlserver_password }}"
ag_name: "{{ ag_name }}"
cluster_type: "{{ cluster_type }}"
failover_mode: "{{ failover_mode }}"
dtc_support_enabled: "{{ dtc_support_enabled }}"
availability_mode: "{{ availability_mode }}"
seeding_mode: "{{ seeding_mode }}"
database_health_trigger: "{{ database_health_trigger }}"
database: "{{ database }}"
healthcheck_timeout: "{{ healthcheck_timeout }}"
basic_availability_group: "{{ basic_availability_group }}"
contained_availability_group: "{{ contained_availability_group }}"
force: "{{ force }}"
allow_null_backup: true
failure_condition_level: "{{ failure_condition_level }}"
tags: ["availability_group"]
block:
- name: Enable hadr
lowlydba.sqlserver.hadr:
sql_instance: "{{ sqlserver_instance }}"
sql_username: "{{ sqlserver_username }}"
sql_password: "{{ sqlserver_password }}"
enabled: true
force: true

- name: Create availability group
lowlydba.sqlserver.availability_group:
register: result
- assert:
that:
- result.data.ComputerName != None
- result.data.InstanceName != None
- result.data.SqlInstance != None
- result.data.AvailabilityGroup == "{{ ag_name }}"
- result.data.ClusterType == "{{ cluster_type }}"
- result.data.AvailabilityReplicas != None
- result is changed
- result.data.containedAvailabilityGroup is true

- name: Create listener
lowlydba.sqlserver.ag_listener:
ag_name: "{{ ag_name }}"
sql_instance: "{{ sqlserver_instance }}"
listener_name: "{{ ag_name }}-lis"

- name: Create login on contained AG
lowlydba.sqlserver.login:
sql_instance: "{{ ag_name }}-lis"
login: TheIntern
password: ReallyComplexStuff12345!
- assert:
that:
- result.data != None

0 comments on commit 2a9a2ce

Please sign in to comment.