Skip to content

Commit 3c840ea

Browse files
committed
Create tests for ProxyInfo and update other scenarios with Proxy data
1 parent c93a63d commit 3c840ea

File tree

5 files changed

+269
-23
lines changed

5 files changed

+269
-23
lines changed

ui-v2/tests/acceptance/dc/services/instances/gateway.feature

+6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
Feature: dc / services / instances / gateway: Show Gateway Service Instance
33
Scenario: A Gateway Service instance
44
Given 1 datacenter model with the value "dc1"
5+
Given 1 proxy model from yaml
6+
---
7+
- ServiceProxy:
8+
DestinationServiceName: service-1
9+
DestinationServiceID: ~
10+
---
511
And 1 instance model from yaml
612
---
713
- Service:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
@setupApplicationTest
2+
Feature: dc / services / instances / show: Proxy Info tab
3+
Background:
4+
Given 1 datacenter model with the value "dc1"
5+
Scenario: A Service instance without a Proxy does not display Proxy Info tab
6+
Given 1 proxy model from yaml
7+
---
8+
- ServiceProxy:
9+
DestinationServiceName: service-1
10+
DestinationServiceID: ~
11+
---
12+
When I visit the instance page for yaml
13+
---
14+
dc: dc1
15+
service: service-0
16+
node: node-0
17+
id: service-0-with-id
18+
---
19+
Then the url should be /dc1/services/service-0/instances/node-0/service-0-with-id/health-checks
20+
And I don't see proxyInfo on the tabs
21+
Scenario: A Service instance with a Proxy displays Proxy Info tab
22+
When I visit the instance page for yaml
23+
---
24+
dc: dc1
25+
service: service-0
26+
node: node-0
27+
id: service-0-with-id
28+
---
29+
Then the url should be /dc1/services/service-0/instances/node-0/service-0-with-id/health-checks
30+
And I see proxyInfo on the tabs
31+
32+
When I click proxyInfo on the tabs
33+
34+
Then the url should be /dc1/services/service-0/instances/node-0/service-0-with-id/proxy-info
35+
And I see proxyInfoIsSelected on the tabs
36+
Scenario: A Proxy with health checks, upstreams, and exposed paths displays all info
37+
Given 2 instance models from yaml
38+
---
39+
- Service:
40+
ID: service-0-with-id
41+
Kind: consul
42+
Node:
43+
Node: node-0
44+
- Service:
45+
ID: service-0-with-id-proxy
46+
Kind: connect-proxy
47+
Proxy:
48+
DestinationServiceName: service-0
49+
Expose:
50+
Checks: false
51+
Paths:
52+
- Path: /grpc-metrics
53+
Protocol: grpc
54+
LocalPathPort: 8081
55+
ListenerPort: 8080
56+
- Path: /http-metrics
57+
Protocol: http
58+
LocalPathPort: 8082
59+
ListenerPort: 8083
60+
- Path: /http-metrics-2
61+
Protocol: http
62+
LocalPathPort: 8083
63+
ListenerPort: 8084
64+
Upstreams:
65+
- DestinationType: service
66+
DestinationName: kenia
67+
DestinationNamespace: default
68+
LocalBindAddress: 127.0.0.1
69+
LocalBindPort: 1111
70+
- DestinationType: prepared_query
71+
DestinationName: service-3
72+
LocalBindAddress: 127.0.0.1
73+
LocalBindPort: 1112
74+
Node:
75+
Node: node-0
76+
Checks:
77+
- Name: Service check
78+
ServiceID: service-0-proxy
79+
Output: Output of check
80+
Status: passing
81+
- Name: Service check
82+
ServiceID: service-0-proxy
83+
Output: Output of check
84+
Status: warning
85+
- Name: Service check
86+
Type: http
87+
ServiceID: service-0-proxy
88+
Output: Output of check
89+
Status: critical
90+
- Name: Node check
91+
ServiceID: ""
92+
Output: Output of check
93+
Status: passing
94+
- Name: Node check
95+
ServiceID: ""
96+
Output: Output of check
97+
Status: warning
98+
- Name: Node check
99+
ServiceID: ""
100+
Output: Output of check
101+
Status: critical
102+
---
103+
When I visit the instance page for yaml
104+
---
105+
dc: dc1
106+
service: service-0
107+
node: node-0
108+
id: service-0-with-id
109+
---
110+
Then the url should be /dc1/services/service-0/instances/node-0/service-0-with-id/health-checks
111+
And I see proxyInfo on the tabs
112+
113+
When I click proxyInfo on the tabs
114+
Then the url should be /dc1/services/service-0/instances/node-0/service-0-with-id/proxy-info
115+
And pause for 3000
116+
117+
And I see 6 of the proxyChecks object
118+
119+
And I see 2 of the upstreams object
120+
And I see name on the upstreams like yaml
121+
---
122+
- kenia
123+
- service-3
124+
---
125+
Scenario: A Proxy without health checks does not display Proxy Health section
126+
And 2 instance models from yaml
127+
---
128+
- Service:
129+
ID: service-0-with-id
130+
Kind: consul
131+
Node:
132+
Node: node-0
133+
- Service:
134+
ID: service-0-with-id-proxy
135+
Kind: connect-proxy
136+
Node:
137+
Node: node-0
138+
Checks: []
139+
---
140+
When I visit the instance page for yaml
141+
---
142+
dc: dc1
143+
service: service-0
144+
node: node-0
145+
id: service-0-with-id
146+
---
147+
Then the url should be /dc1/services/service-0/instances/node-0/service-0-with-id/health-checks
148+
And I see proxyInfo on the tabs
149+
150+
When I click proxyInfo on the tabs
151+
Then the url should be /dc1/services/service-0/instances/node-0/service-0-with-id/proxy-info
152+
And I see 0 of the proxyChecks object
153+
Scenario: A Proxy without upstreams does not display Upstreams section
154+
And 2 instance models from yaml
155+
---
156+
- Service:
157+
ID: service-0-with-id
158+
Kind: consul
159+
Node:
160+
Node: node-0
161+
- Service:
162+
ID: service-0-with-id-proxy
163+
Kind: connect-proxy
164+
Proxy:
165+
Upstreams: []
166+
Node:
167+
Node: node-0
168+
---
169+
When I visit the instance page for yaml
170+
---
171+
dc: dc1
172+
service: service-0
173+
node: node-0
174+
id: service-0-with-id
175+
---
176+
Then the url should be /dc1/services/service-0/instances/node-0/service-0-with-id/health-checks
177+
And I see proxyInfo on the tabs
178+
179+
When I click proxyInfo on the tabs
180+
Then the url should be /dc1/services/service-0/instances/node-0/service-0-with-id/proxy-info
181+
And I see 0 of the upstreams object
182+
Scenario: A Proxy without exposed path does not display Exposed Paths section
183+
And 2 instance models from yaml
184+
---
185+
- Service:
186+
ID: service-0-with-id
187+
Kind: consul
188+
Node:
189+
Node: node-0
190+
- Service:
191+
ID: service-0-with-id-proxy
192+
Kind: connect-proxy
193+
Proxy:
194+
Expose:
195+
Checks: false
196+
Paths: []
197+
Node:
198+
Node: node-0
199+
---
200+
When I visit the instance page for yaml
201+
---
202+
dc: dc1
203+
service: service-0
204+
node: node-0
205+
id: service-0-with-id
206+
---
207+
Then the url should be /dc1/services/service-0/instances/node-0/service-0-with-id/health-checks
208+
And I see proxyInfo on the tabs
209+
210+
When I click proxyInfo on the tabs
211+
Then the url should be /dc1/services/service-0/instances/node-0/service-0-with-id/proxy-info
212+
And I see 0 of the exposedPaths object
213+
214+
215+

ui-v2/tests/acceptance/dc/services/instances/show.feature

+32-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Feature: dc / services / instances / show: Show Service Instance
1111
Node:
1212
Node: node-0
1313
- Service:
14-
ID: service-0-with-id
14+
ID: service-1-with-id
1515
Tags: ['Tag1', 'Tag2']
1616
Meta:
1717
consul-dashboard-url: http://url.com
@@ -47,14 +47,20 @@ Feature: dc / services / instances / show: Show Service Instance
4747
Status: critical
4848
---
4949
Scenario: A Service instance has no Proxy
50+
Given 1 proxy model from yaml
51+
---
52+
- ServiceProxy:
53+
DestinationServiceName: service-1
54+
DestinationServiceID: ~
55+
---
5056
When I visit the instance page for yaml
5157
---
5258
dc: dc1
5359
service: service-0
5460
node: another-node
55-
id: service-0-with-id
61+
id: service-1-with-id
5662
---
57-
Then the url should be /dc1/services/service-0/instances/another-node/service-0-with-id/health-checks
63+
Then the url should be /dc1/services/service-0/instances/another-node/service-1-with-id/health-checks
5864
Then I see externalSource like "nomad"
5965

6066
And I don't see upstreams on the tabs
@@ -71,9 +77,15 @@ Feature: dc / services / instances / show: Show Service Instance
7177
When I click metaData on the tabs
7278
And I see metaDataIsSelected on the tabs
7379
And I see 3 of the metaData object
74-
And the title should be "service-0-with-id - Consul"
80+
And the title should be "service-1-with-id - Consul"
7581

7682
Scenario: A Service instance warns when deregistered whilst blocking
83+
Given 1 proxy model from yaml
84+
---
85+
- ServiceProxy:
86+
DestinationServiceName: service-1
87+
DestinationServiceID: ~
88+
---
7789
Given settings from yaml
7890
---
7991
consul:client:
@@ -91,3 +103,19 @@ Feature: dc / services / instances / show: Show Service Instance
91103
Then the url should be /dc1/services/service-0/instances/node-0/service-0-with-id/health-checks
92104
And an external edit results in 0 instance models
93105
And pause until I see the text "deregistered" in "[data-notification]"
106+
Scenario: A Service instance without a Proxy does not display Proxy Info tab
107+
Given 1 proxy model from yaml
108+
---
109+
- ServiceProxy:
110+
DestinationServiceName: service-1
111+
DestinationServiceID: ~
112+
---
113+
When I visit the instance page for yaml
114+
---
115+
dc: dc1
116+
service: service-0
117+
node: node-0
118+
id: service-0-with-id
119+
---
120+
Then the url should be /dc1/services/service-0/instances/node-0/service-0-with-id/health-checks
121+
And I don't see proxyInfo on the tabs
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import steps from '../../../steps';
2+
3+
// step definitions that are shared between features should be moved to the
4+
// tests/acceptance/steps/steps.js file
5+
6+
export default function(assert) {
7+
return steps(assert).then('I should find a file', function() {
8+
assert.ok(true, this.step);
9+
});
10+
}

ui-v2/tests/pages/dc/services/instance.js

+6-19
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,16 @@ export default function(visitable, attribute, collection, text, tabs) {
44
externalSource: attribute('data-test-external-source', '[data-test-external-source]', {
55
scope: '.title-bar',
66
}),
7-
tabs: tabs('tab', [
8-
'health-checks',
9-
'addresses',
10-
'upstreams',
11-
'exposed-paths',
12-
'tags',
13-
'meta-data',
14-
]),
15-
serviceChecks: collection('[data-test-service-checks] li', {
16-
exposed: attribute('data-test-exposed', '[data-test-exposed]'),
17-
}),
18-
nodeChecks: collection('[data-test-node-checks] li', {
19-
exposed: attribute('data-test-exposed', '[data-test-exposed]'),
20-
}),
21-
upstreams: collection('#upstreams [data-test-tabular-row]', {
7+
tabs: tabs('tab', ['health-checks', 'proxy-info', 'addresses', 'tags', 'meta-data']),
8+
serviceChecks: collection('[data-test-service-checks] li'),
9+
nodeChecks: collection('[data-test-node-checks] li'),
10+
upstreams: collection('[data-test-proxy-upstreams] > li', {
2211
name: text('[data-test-destination-name]'),
23-
datacenter: text('[data-test-destination-datacenter]'),
24-
type: text('[data-test-destination-type]'),
25-
address: text('[data-test-local-bind-address]'),
2612
}),
27-
exposedPaths: collection('#exposed-paths [data-test-tabular-row]', {
13+
exposedPaths: collection('[data-test-proxy-exposed-paths] > tbody tr', {
2814
combinedAddress: text('[data-test-combined-address]'),
2915
}),
16+
proxyChecks: collection('[data-test-proxy-checks] li'),
3017
addresses: collection('#addresses [data-test-tabular-row]', {
3118
address: text('[data-test-address]'),
3219
}),

0 commit comments

Comments
 (0)