Skip to content

Commit

Permalink
Create tests for ProxyInfo and update other scenarios with Proxy data
Browse files Browse the repository at this point in the history
  • Loading branch information
kaxcode committed May 1, 2020
1 parent c93a63d commit 3c840ea
Show file tree
Hide file tree
Showing 5 changed files with 269 additions and 23 deletions.
6 changes: 6 additions & 0 deletions ui-v2/tests/acceptance/dc/services/instances/gateway.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
Feature: dc / services / instances / gateway: Show Gateway Service Instance
Scenario: A Gateway Service instance
Given 1 datacenter model with the value "dc1"
Given 1 proxy model from yaml
---
- ServiceProxy:
DestinationServiceName: service-1
DestinationServiceID: ~
---
And 1 instance model from yaml
---
- Service:
Expand Down
215 changes: 215 additions & 0 deletions ui-v2/tests/acceptance/dc/services/instances/proxyinfo.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
@setupApplicationTest
Feature: dc / services / instances / show: Proxy Info tab
Background:
Given 1 datacenter model with the value "dc1"
Scenario: A Service instance without a Proxy does not display Proxy Info tab
Given 1 proxy model from yaml
---
- ServiceProxy:
DestinationServiceName: service-1
DestinationServiceID: ~
---
When I visit the instance page for yaml
---
dc: dc1
service: service-0
node: node-0
id: service-0-with-id
---
Then the url should be /dc1/services/service-0/instances/node-0/service-0-with-id/health-checks
And I don't see proxyInfo on the tabs
Scenario: A Service instance with a Proxy displays Proxy Info tab
When I visit the instance page for yaml
---
dc: dc1
service: service-0
node: node-0
id: service-0-with-id
---
Then the url should be /dc1/services/service-0/instances/node-0/service-0-with-id/health-checks
And I see proxyInfo on the tabs

When I click proxyInfo on the tabs

Then the url should be /dc1/services/service-0/instances/node-0/service-0-with-id/proxy-info
And I see proxyInfoIsSelected on the tabs
Scenario: A Proxy with health checks, upstreams, and exposed paths displays all info
Given 2 instance models from yaml
---
- Service:
ID: service-0-with-id
Kind: consul
Node:
Node: node-0
- Service:
ID: service-0-with-id-proxy
Kind: connect-proxy
Proxy:
DestinationServiceName: service-0
Expose:
Checks: false
Paths:
- Path: /grpc-metrics
Protocol: grpc
LocalPathPort: 8081
ListenerPort: 8080
- Path: /http-metrics
Protocol: http
LocalPathPort: 8082
ListenerPort: 8083
- Path: /http-metrics-2
Protocol: http
LocalPathPort: 8083
ListenerPort: 8084
Upstreams:
- DestinationType: service
DestinationName: kenia
DestinationNamespace: default
LocalBindAddress: 127.0.0.1
LocalBindPort: 1111
- DestinationType: prepared_query
DestinationName: service-3
LocalBindAddress: 127.0.0.1
LocalBindPort: 1112
Node:
Node: node-0
Checks:
- Name: Service check
ServiceID: service-0-proxy
Output: Output of check
Status: passing
- Name: Service check
ServiceID: service-0-proxy
Output: Output of check
Status: warning
- Name: Service check
Type: http
ServiceID: service-0-proxy
Output: Output of check
Status: critical
- Name: Node check
ServiceID: ""
Output: Output of check
Status: passing
- Name: Node check
ServiceID: ""
Output: Output of check
Status: warning
- Name: Node check
ServiceID: ""
Output: Output of check
Status: critical
---
When I visit the instance page for yaml
---
dc: dc1
service: service-0
node: node-0
id: service-0-with-id
---
Then the url should be /dc1/services/service-0/instances/node-0/service-0-with-id/health-checks
And I see proxyInfo on the tabs

When I click proxyInfo on the tabs
Then the url should be /dc1/services/service-0/instances/node-0/service-0-with-id/proxy-info
And pause for 3000

And I see 6 of the proxyChecks object

And I see 2 of the upstreams object
And I see name on the upstreams like yaml
---
- kenia
- service-3
---
Scenario: A Proxy without health checks does not display Proxy Health section
And 2 instance models from yaml
---
- Service:
ID: service-0-with-id
Kind: consul
Node:
Node: node-0
- Service:
ID: service-0-with-id-proxy
Kind: connect-proxy
Node:
Node: node-0
Checks: []
---
When I visit the instance page for yaml
---
dc: dc1
service: service-0
node: node-0
id: service-0-with-id
---
Then the url should be /dc1/services/service-0/instances/node-0/service-0-with-id/health-checks
And I see proxyInfo on the tabs

When I click proxyInfo on the tabs
Then the url should be /dc1/services/service-0/instances/node-0/service-0-with-id/proxy-info
And I see 0 of the proxyChecks object
Scenario: A Proxy without upstreams does not display Upstreams section
And 2 instance models from yaml
---
- Service:
ID: service-0-with-id
Kind: consul
Node:
Node: node-0
- Service:
ID: service-0-with-id-proxy
Kind: connect-proxy
Proxy:
Upstreams: []
Node:
Node: node-0
---
When I visit the instance page for yaml
---
dc: dc1
service: service-0
node: node-0
id: service-0-with-id
---
Then the url should be /dc1/services/service-0/instances/node-0/service-0-with-id/health-checks
And I see proxyInfo on the tabs

When I click proxyInfo on the tabs
Then the url should be /dc1/services/service-0/instances/node-0/service-0-with-id/proxy-info
And I see 0 of the upstreams object
Scenario: A Proxy without exposed path does not display Exposed Paths section
And 2 instance models from yaml
---
- Service:
ID: service-0-with-id
Kind: consul
Node:
Node: node-0
- Service:
ID: service-0-with-id-proxy
Kind: connect-proxy
Proxy:
Expose:
Checks: false
Paths: []
Node:
Node: node-0
---
When I visit the instance page for yaml
---
dc: dc1
service: service-0
node: node-0
id: service-0-with-id
---
Then the url should be /dc1/services/service-0/instances/node-0/service-0-with-id/health-checks
And I see proxyInfo on the tabs

When I click proxyInfo on the tabs
Then the url should be /dc1/services/service-0/instances/node-0/service-0-with-id/proxy-info
And I see 0 of the exposedPaths object



36 changes: 32 additions & 4 deletions ui-v2/tests/acceptance/dc/services/instances/show.feature
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Feature: dc / services / instances / show: Show Service Instance
Node:
Node: node-0
- Service:
ID: service-0-with-id
ID: service-1-with-id
Tags: ['Tag1', 'Tag2']
Meta:
consul-dashboard-url: http://url.com
Expand Down Expand Up @@ -47,14 +47,20 @@ Feature: dc / services / instances / show: Show Service Instance
Status: critical
---
Scenario: A Service instance has no Proxy
Given 1 proxy model from yaml
---
- ServiceProxy:
DestinationServiceName: service-1
DestinationServiceID: ~
---
When I visit the instance page for yaml
---
dc: dc1
service: service-0
node: another-node
id: service-0-with-id
id: service-1-with-id
---
Then the url should be /dc1/services/service-0/instances/another-node/service-0-with-id/health-checks
Then the url should be /dc1/services/service-0/instances/another-node/service-1-with-id/health-checks
Then I see externalSource like "nomad"

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

Scenario: A Service instance warns when deregistered whilst blocking
Given 1 proxy model from yaml
---
- ServiceProxy:
DestinationServiceName: service-1
DestinationServiceID: ~
---
Given settings from yaml
---
consul:client:
Expand All @@ -91,3 +103,19 @@ Feature: dc / services / instances / show: Show Service Instance
Then the url should be /dc1/services/service-0/instances/node-0/service-0-with-id/health-checks
And an external edit results in 0 instance models
And pause until I see the text "deregistered" in "[data-notification]"
Scenario: A Service instance without a Proxy does not display Proxy Info tab
Given 1 proxy model from yaml
---
- ServiceProxy:
DestinationServiceName: service-1
DestinationServiceID: ~
---
When I visit the instance page for yaml
---
dc: dc1
service: service-0
node: node-0
id: service-0-with-id
---
Then the url should be /dc1/services/service-0/instances/node-0/service-0-with-id/health-checks
And I don't see proxyInfo on the tabs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import steps from '../../../steps';

// step definitions that are shared between features should be moved to the
// tests/acceptance/steps/steps.js file

export default function(assert) {
return steps(assert).then('I should find a file', function() {
assert.ok(true, this.step);
});
}
25 changes: 6 additions & 19 deletions ui-v2/tests/pages/dc/services/instance.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,16 @@ export default function(visitable, attribute, collection, text, tabs) {
externalSource: attribute('data-test-external-source', '[data-test-external-source]', {
scope: '.title-bar',
}),
tabs: tabs('tab', [
'health-checks',
'addresses',
'upstreams',
'exposed-paths',
'tags',
'meta-data',
]),
serviceChecks: collection('[data-test-service-checks] li', {
exposed: attribute('data-test-exposed', '[data-test-exposed]'),
}),
nodeChecks: collection('[data-test-node-checks] li', {
exposed: attribute('data-test-exposed', '[data-test-exposed]'),
}),
upstreams: collection('#upstreams [data-test-tabular-row]', {
tabs: tabs('tab', ['health-checks', 'proxy-info', 'addresses', 'tags', 'meta-data']),
serviceChecks: collection('[data-test-service-checks] li'),
nodeChecks: collection('[data-test-node-checks] li'),
upstreams: collection('[data-test-proxy-upstreams] > li', {
name: text('[data-test-destination-name]'),
datacenter: text('[data-test-destination-datacenter]'),
type: text('[data-test-destination-type]'),
address: text('[data-test-local-bind-address]'),
}),
exposedPaths: collection('#exposed-paths [data-test-tabular-row]', {
exposedPaths: collection('[data-test-proxy-exposed-paths] > tbody tr', {
combinedAddress: text('[data-test-combined-address]'),
}),
proxyChecks: collection('[data-test-proxy-checks] li'),
addresses: collection('#addresses [data-test-tabular-row]', {
address: text('[data-test-address]'),
}),
Expand Down

0 comments on commit 3c840ea

Please sign in to comment.