Skip to content

Commit cde4a70

Browse files
committed
Fix netbox_service integration test
When creating service with a service with an existing name on vm the check fail
1 parent d20359a commit cde4a70

File tree

4 files changed

+39
-17
lines changed

4 files changed

+39
-17
lines changed

tests/integration/targets/v4.2/tasks/netbox_circuit_termination.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
- test_one['diff']['before']['state'] == "absent"
4444
- test_one['diff']['after']['state'] == "present"
4545
- test_one['circuit_termination']['termination_type'] == "circuits.providernetwork"
46-
- test_one['circuit_termination']['termination_id'] == "2"
46+
- test_one['circuit_termination']['termination_id'] == 2
4747
- test_one['circuit_termination']['circuit'] == 1
4848
- test_one['circuit_termination']['term_side'] == "A"
4949
- test_one['circuit_termination']['port_speed'] == 10000
@@ -107,7 +107,7 @@
107107
circuit: Test Circuit
108108
term_side: Z
109109
termination_id: 2
110-
termination_type: circuits.providernetwork
110+
termination_type: circuits.providernetwork
111111
port_speed: 10000
112112
state: present
113113
register: test_four
@@ -119,7 +119,7 @@
119119
- test_four['diff']['before']['state'] == "absent"
120120
- test_four['diff']['after']['state'] == "present"
121121
- test_one['circuit_termination']['termination_type'] == "circuits.providernetwork"
122-
- test_one['circuit_termination']['termination_id'] == "2"
122+
- test_one['circuit_termination']['termination_id'] == 2
123123
- test_four['circuit_termination']['circuit'] == 1
124124
- test_four['circuit_termination']['term_side'] == "Z"
125125
- test_four['circuit_termination']['port_speed'] == 10000
@@ -147,5 +147,5 @@
147147
- test_five['circuit_termination']['pp_info'] == "PP10-24"
148148
- test_five['circuit_termination']['description'] == "Test description"
149149
- test_one['circuit_termination']['termination_type'] == "circuits.providernetwork"
150-
- test_one['circuit_termination']['termination_id'] == "2"
150+
- test_one['circuit_termination']['termination_id'] == 2
151151
- test_five['msg'] == "circuit_termination test_circuit_a deleted"

tests/integration/targets/v4.2/tasks/netbox_service.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@
178178
netbox_token: "0123456789abcdef0123456789abcdef01234567"
179179
data:
180180
virtual_machine: test100-vm
181-
name: node-exporter
181+
name: node-exporter-vm
182182
port: 9100
183183
protocol: TCP
184184
state: present
@@ -188,9 +188,9 @@
188188
ansible.builtin.assert:
189189
that:
190190
- test_service_create_vm is changed
191-
- test_service_create_vm['services']['name'] == "node-exporter"
191+
- test_service_create_vm['services']['name'] == "node-exporter-vm"
192192
- test_service_create_vm['services']['ports'] == [9100]
193193
- test_service_create_vm['services']['protocol'] == "tcp"
194194
- test_service_create_vm['diff']['after']['state'] == "present"
195195
- test_service_create_vm['diff']['before']['state'] == "absent"
196-
- test_service_create_vm['msg'] == "services node-exporter created"
196+
- test_service_create_vm['msg'] == "services node-exporter-vm created"

tests/integration/targets/v4.3/tasks/netbox_circuit_termination.yml

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,34 @@
44
### NETBOX_CIRCUIT_TERMINATION
55
##
66
##
7+
- name: "NETBOX_CIRCUIT_TERMINATION 0: Create provider network within NetBox with only required information"
8+
netbox.netbox.netbox_provider_network:
9+
netbox_url: http://localhost:32768
10+
netbox_token: "0123456789abcdef0123456789abcdef01234567"
11+
data:
12+
provider: Test Provider
13+
name: Test Provider Network One
14+
state: present
15+
register: test_one
16+
17+
- name: "NETBOX_CIRCUIT_TERMINATION 0: ASSERT - Necessary info creation"
18+
ansible.builtin.assert:
19+
that:
20+
- test_one is changed
21+
- test_one['diff']['before']['state'] == "absent"
22+
- test_one['diff']['after']['state'] == "present"
23+
- test_one['provider_network']['name'] == "Test Provider Network One"
24+
- test_one['msg'] == "provider_network Test Provider Network One created"
25+
726
- name: "NETBOX_CIRCUIT_TERMINATION 1: Create provider within NetBox with only required information"
827
netbox.netbox.netbox_circuit_termination:
928
netbox_url: http://localhost:32768
1029
netbox_token: "0123456789abcdef0123456789abcdef01234567"
1130
data:
1231
circuit: Test Circuit
1332
term_side: A
14-
site: Test Site
33+
termination_id: 2
34+
termination_type: circuits.providernetwork
1535
port_speed: 10000
1636
state: present
1737
register: test_one
@@ -22,9 +42,10 @@
2242
- test_one is changed
2343
- test_one['diff']['before']['state'] == "absent"
2444
- test_one['diff']['after']['state'] == "present"
45+
- test_one['circuit_termination']['termination_type'] == "circuits.providernetwork"
46+
- test_one['circuit_termination']['termination_id'] == 2
2547
- test_one['circuit_termination']['circuit'] == 1
2648
- test_one['circuit_termination']['term_side'] == "A"
27-
- test_one['circuit_termination']['site'] == 1
2849
- test_one['circuit_termination']['port_speed'] == 10000
2950
- test_one['msg'] == "circuit_termination test_circuit_a created"
3051

@@ -44,7 +65,6 @@
4465
- not test_two['changed']
4566
- test_two['circuit_termination']['circuit'] == 1
4667
- test_two['circuit_termination']['term_side'] == "A"
47-
- test_two['circuit_termination']['site'] == 1
4868
- test_two['circuit_termination']['port_speed'] == 10000
4969
- test_two['msg'] == "circuit_termination test_circuit_a already exists"
5070

@@ -72,7 +92,6 @@
7292
- test_three['diff']['after']['description'] == "Test description"
7393
- test_three['circuit_termination']['circuit'] == 1
7494
- test_three['circuit_termination']['term_side'] == "A"
75-
- test_three['circuit_termination']['site'] == 1
7695
- test_three['circuit_termination']['port_speed'] == 10000
7796
- test_three['circuit_termination']['upstream_speed'] == 1000
7897
- test_three['circuit_termination']['xconnect_id'] == "10X100"
@@ -87,7 +106,8 @@
87106
data:
88107
circuit: Test Circuit
89108
term_side: Z
90-
site: Test Site
109+
termination_id: 2
110+
termination_type: circuits.providernetwork
91111
port_speed: 10000
92112
state: present
93113
register: test_four
@@ -98,9 +118,10 @@
98118
- test_four is changed
99119
- test_four['diff']['before']['state'] == "absent"
100120
- test_four['diff']['after']['state'] == "present"
121+
- test_one['circuit_termination']['termination_type'] == "circuits.providernetwork"
122+
- test_one['circuit_termination']['termination_id'] == 2
101123
- test_four['circuit_termination']['circuit'] == 1
102124
- test_four['circuit_termination']['term_side'] == "Z"
103-
- test_four['circuit_termination']['site'] == 1
104125
- test_four['circuit_termination']['port_speed'] == 10000
105126
- test_four['msg'] == "circuit_termination test_circuit_z created"
106127

@@ -120,10 +141,11 @@
120141
- test_five is changed
121142
- test_five['circuit_termination']['circuit'] == 1
122143
- test_five['circuit_termination']['term_side'] == "A"
123-
- test_five['circuit_termination']['site'] == 1
124144
- test_five['circuit_termination']['port_speed'] == 10000
125145
- test_five['circuit_termination']['upstream_speed'] == 1000
126146
- test_five['circuit_termination']['xconnect_id'] == "10X100"
127147
- test_five['circuit_termination']['pp_info'] == "PP10-24"
128148
- test_five['circuit_termination']['description'] == "Test description"
149+
- test_one['circuit_termination']['termination_type'] == "circuits.providernetwork"
150+
- test_one['circuit_termination']['termination_id'] == 2
129151
- test_five['msg'] == "circuit_termination test_circuit_a deleted"

tests/integration/targets/v4.3/tasks/netbox_service.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@
178178
netbox_token: "0123456789abcdef0123456789abcdef01234567"
179179
data:
180180
virtual_machine: test100-vm
181-
name: node-exporter
181+
name: node-exporter-vm
182182
port: 9100
183183
protocol: TCP
184184
state: present
@@ -188,9 +188,9 @@
188188
ansible.builtin.assert:
189189
that:
190190
- test_service_create_vm is changed
191-
- test_service_create_vm['services']['name'] == "node-exporter"
191+
- test_service_create_vm['services']['name'] == "node-exporter-vm"
192192
- test_service_create_vm['services']['ports'] == [9100]
193193
- test_service_create_vm['services']['protocol'] == "tcp"
194194
- test_service_create_vm['diff']['after']['state'] == "present"
195195
- test_service_create_vm['diff']['before']['state'] == "absent"
196-
- test_service_create_vm['msg'] == "services node-exporter created"
196+
- test_service_create_vm['msg'] == "services node-exporter-vm created"

0 commit comments

Comments
 (0)