From e481d5744271d14a544666e13ccf0cfe0c052b0e Mon Sep 17 00:00:00 2001 From: John Cowen Date: Thu, 6 May 2021 11:14:02 +0100 Subject: [PATCH] Acceptance tests --- .../tests/acceptance/dc/nodes/show.feature | 3 +- .../dc/nodes/show/health-checks.feature | 40 +++++++++++ .../services/instances/health-checks.feature | 66 +++++++++++++++++++ .../dc/nodes/show/health-checks-steps.js | 10 +++ .../services/instances/health-checks-steps.js | 10 +++ 5 files changed, 128 insertions(+), 1 deletion(-) create mode 100644 ui/packages/consul-ui/tests/acceptance/dc/nodes/show/health-checks.feature create mode 100644 ui/packages/consul-ui/tests/acceptance/dc/services/instances/health-checks.feature create mode 100644 ui/packages/consul-ui/tests/acceptance/steps/dc/nodes/show/health-checks-steps.js create mode 100644 ui/packages/consul-ui/tests/acceptance/steps/dc/services/instances/health-checks-steps.js diff --git a/ui/packages/consul-ui/tests/acceptance/dc/nodes/show.feature b/ui/packages/consul-ui/tests/acceptance/dc/nodes/show.feature index 00e0b896d346..4ccc4abe9199 100644 --- a/ui/packages/consul-ui/tests/acceptance/dc/nodes/show.feature +++ b/ui/packages/consul-ui/tests/acceptance/dc/nodes/show.feature @@ -2,8 +2,9 @@ Feature: dc / nodes / show: Show node Background: Given 1 datacenter model with the value "dc1" + # 2 nodes are required for the RTT tab to be visible Scenario: Given 2 nodes all the tabs are visible and clickable - Given 2 node models from yaml + Given 2 node models When I visit the node page for yaml --- dc: dc1 diff --git a/ui/packages/consul-ui/tests/acceptance/dc/nodes/show/health-checks.feature b/ui/packages/consul-ui/tests/acceptance/dc/nodes/show/health-checks.feature new file mode 100644 index 000000000000..fbcdf2dd2577 --- /dev/null +++ b/ui/packages/consul-ui/tests/acceptance/dc/nodes/show/health-checks.feature @@ -0,0 +1,40 @@ +@setupApplicationTest +Feature: dc / nodes / show / health-checks + Background: + Given 1 datacenter model with the value "dc1" + Scenario: A failing serf check + Given 1 node model from yaml + --- + ID: node-0 + Checks: + - Type: '' + Name: Serf Health Status + CheckID: serfHealth + Status: critical + Output: ouch + --- + When I visit the node page for yaml + --- + dc: dc1 + node: node-0 + --- + And I see healthChecksIsSelected on the tabs + And I see criticalSerfNotice on the tabs.healthChecksTab + Scenario: A passing serf check + Given 1 node model from yaml + --- + ID: node-0 + Checks: + - Type: '' + Name: Serf Health Status + CheckID: serfHealth + Status: passing + Output: Agent alive and reachable + --- + When I visit the node page for yaml + --- + dc: dc1 + node: node-0 + --- + And I see healthChecksIsSelected on the tabs + And I don't see criticalSerfNotice on the tabs.healthChecksTab diff --git a/ui/packages/consul-ui/tests/acceptance/dc/services/instances/health-checks.feature b/ui/packages/consul-ui/tests/acceptance/dc/services/instances/health-checks.feature new file mode 100644 index 000000000000..ed1e2c9234ce --- /dev/null +++ b/ui/packages/consul-ui/tests/acceptance/dc/services/instances/health-checks.feature @@ -0,0 +1,66 @@ +@setupApplicationTest +Feature: dc / services / instances / health-checks + Background: + Given 1 datacenter model with the value "dc1" + And 1 proxy model from yaml + --- + - ServiceProxy: + DestinationServiceName: service-1 + DestinationServiceID: ~ + --- + Scenario: A failing serf check + Given 2 instance models from yaml + --- + - Service: + ID: service-0-with-id + Node: + Node: node-0 + - Service: + ID: service-1-with-id + Node: + Node: another-node + Checks: + - Type: '' + Name: Serf Health Status + CheckID: serfHealth + Status: critical + Output: ouch + --- + When I visit the instance page for yaml + --- + dc: dc1 + service: service-0 + node: another-node + id: service-1-with-id + --- + Then the url should be /dc1/services/service-0/instances/another-node/service-1-with-id/health-checks + And I see healthChecksIsSelected on the tabs + And I see criticalSerfNotice on the tabs.healthChecksTab + Scenario: A passing serf check + Given 2 instance models from yaml + --- + - Service: + ID: service-0-with-id + Node: + Node: node-0 + - Service: + ID: service-1-with-id + Node: + Node: another-node + Checks: + - Type: '' + Name: Serf Health Status + CheckID: serfHealth + Status: passing + Output: Agent alive and reachable + --- + When I visit the instance page for yaml + --- + dc: dc1 + service: service-0 + node: another-node + id: service-1-with-id + --- + Then the url should be /dc1/services/service-0/instances/another-node/service-1-with-id/health-checks + And I see healthChecksIsSelected on the tabs + And I don't see criticalSerfNotice on the tabs.healthChecksTab diff --git a/ui/packages/consul-ui/tests/acceptance/steps/dc/nodes/show/health-checks-steps.js b/ui/packages/consul-ui/tests/acceptance/steps/dc/nodes/show/health-checks-steps.js new file mode 100644 index 000000000000..3231912b98b4 --- /dev/null +++ b/ui/packages/consul-ui/tests/acceptance/steps/dc/nodes/show/health-checks-steps.js @@ -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); + }); +} diff --git a/ui/packages/consul-ui/tests/acceptance/steps/dc/services/instances/health-checks-steps.js b/ui/packages/consul-ui/tests/acceptance/steps/dc/services/instances/health-checks-steps.js new file mode 100644 index 000000000000..3231912b98b4 --- /dev/null +++ b/ui/packages/consul-ui/tests/acceptance/steps/dc/services/instances/health-checks-steps.js @@ -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); + }); +}