Skip to content

Commit f34ee72

Browse files
committed
Define setup for testing azbare in Azure
1 parent fe551b1 commit f34ee72

File tree

5 files changed

+21
-5
lines changed

5 files changed

+21
-5
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.tar.gz

requirements-azure.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
packaging
2-
msrestazure==0.6.4 # also installs its dependencies like isodate, msrest
2+
33
azure-cli-core==2.28.1 # required for `az login` based authentication; tested with azure-cli 2.11 and 2.28
44
azure-mgmt-resource==20.0.0 # also installs azure-common
55
azure-mgmt-authorization==1.0.0
6-
6+
msrestazure==0.6.4 # also installs its dependencies like isodate, msrest

tests/README.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
Following setup is used for testing (and works)
2+
13
```
24
# Create environment for testing
35
rm -rf ~/pyenvs/azbare
@@ -7,9 +9,10 @@ python3.8 -m venv ~/pyenvs/azbare
79
# Install dependencies
810
. ~/pyenvs/azbare/bin/activate
911
pip install wheel
10-
pip install ansible==2.10.5
1112
pip install -r requirements-azure.txt --force
12-
ansible-galaxy collection install git+file://`pwd` --force
13+
pip install ansible==2.10.5
14+
ansible-galaxy collection build --force
15+
ansible-galaxy collection install geekq-azbare-1.0.0.tar.gz -p $VIRTUAL_ENV/lib/python3.8/site-packages/ansible_collections --force
1316
1417
# Run the tests
1518
ansible-playbook tests/all-tests.playbook.yaml -vv

tests/all-tests.playbook.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
- name: Run all tests for handling Azure resources
22
hosts: localhost
33
gather_facts: no
4+
connection: local
45
any_errors_fatal: true
56
tasks:
67
- name: Run tests on Azure Service Bus resources, including advanced POST operations
78
import_tasks: tasks/servicebus-with-key-renewal.yaml
89
vars:
910
resource_group: experimental-applicationdevelopment
11+
azure_location: Germany West Central

tests/tasks/servicebus-with-key-renewal.yaml

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
1+
- name: Prepare the resource group
2+
geekq.azbare.resource:
3+
group: "{{ resource_group }}"
4+
path: ""
5+
definition:
6+
# There is an inconsistency in Azure API: resource_groups expects a differently
7+
# formatted location - all downcase, without spaces.
8+
# Format it to be able to check for existing group with desired definition.
9+
location: "{{ azure_location | lower | replace(' ', '') }}"
10+
111
- name: Define a service bus namespace
212
geekq.azbare.resource:
313
group: "{{ resource_group }}"
414
path: /providers/Microsoft.ServiceBus/namespaces/myexample-bus1
515
definition:
6-
location: Germany West Central
16+
location: "{{ azure_location }}"
717
sku:
818
name: Basic
919
tier: Basic

0 commit comments

Comments
 (0)