Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sap system details e2e #529

Merged
merged 5 commits into from
May 17, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .photofinish.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ files = ["./test/fixtures/scenarios/sap-system-details/1b0e9297-97dd-55d6-9874-8

[sap-system-detail-NEW]

files = ["./test/fixtures/scenarios/sap-system-details/newagent_sap_system_discovery_new.json"]
files = ["./test/fixtures/scenarios/sap-system-details/1b0e9297-97dd-55d6-9874-8efde4d84c90_sap_system_discovery_new.json"]

[hana-database-detail-GRAY]

Expand Down
24 changes: 20 additions & 4 deletions assets/js/components/ClusterDetails/ClusterDetails.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { groupBy } from '@lib/lists';
import SiteDetails from './SiteDetails';

import { getClusterName } from '@components/ClusterLink';
import HostLink from '@components/HostLink';

import { EOS_SETTINGS, EOS_CLEAR_ALL, EOS_PLAY_CIRCLE } from 'eos-icons-react';
import { getCluster } from '@state/selectors';
Expand All @@ -25,7 +26,13 @@ export const truncatedClusterNameClasses = classNames(
const siteDetailsConfig = {
usePadding: false,
columns: [
{ title: 'Hostname', key: 'name' },
{
title: 'Hostname',
key: '',
render: (_, hostData) => (
<HostLink hostId={hostData.hostId}>{hostData.name}</HostLink>
),
},
{ title: 'Role', key: 'hana_status' },
{
title: 'IP',
Expand Down Expand Up @@ -63,10 +70,13 @@ const ClusterDetails = () => {

const cluster = useSelector(getCluster(clusterID));

const ips = useSelector((state) =>
const hostsData = useSelector((state) =>
state.hostsList.hosts.reduce((accumulator, current) => {
if (current.cluster_id === clusterID) {
return { ...accumulator, [current.hostname]: current.ip_addresses };
return {
...accumulator,
[current.hostname]: { hostId: current.id, ips: current.ip_addresses },
};
}
return accumulator;
}, {})
Expand All @@ -77,7 +87,13 @@ const ClusterDetails = () => {
}

const renderedNodes = cluster.details?.nodes?.map((node) =>
ips[node.name] ? { ...node, ips: ips[node.name] } : node
hostsData[node.name]
? {
...node,
ips: hostsData[node.name].ips,
hostId: hostsData[node.name].hostId,
}
: node
);

const hasSelectedChecks = cluster.selected_checks.length > 0;
Expand Down
16 changes: 16 additions & 0 deletions assets/js/components/HostLink.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from 'react';

import { Link } from 'react-router-dom';

const HostLink = ({ hostId, children }) => {
nelsonkopliku marked this conversation as resolved.
Show resolved Hide resolved
return (
<span
id={`host-${hostId}`}
className="tn-hostname text-jungle-green-500 hover:opacity-75"
>
<Link to={`/hosts/${hostId}`}>{children}</Link>
</span>
);
};

export default HostLink;
11 changes: 2 additions & 9 deletions assets/js/components/HostsList.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, { Fragment } from 'react';
import { Link } from 'react-router-dom';
import Table from './Table';
import Tags from './Tags';
import { addTagToHost, removeTagFromHost } from '@state/hosts';
import HostLink from '@components/HostLink';
import ClusterLink from '@components/ClusterLink';
import SapSystemLink from '@components/SapSystemLink';
import { useSelector, useDispatch } from 'react-redux';
Expand Down Expand Up @@ -75,14 +75,7 @@ const HostsList = () => {
key: 'hostname',
className: 'w-40',
filter: true,
render: (content, { id }) => (
<span
id={`host-${id}`}
className="tn-hostname text-jungle-green-500 hover:opacity-75"
>
<Link to={`/hosts/${id}`}>{content}</Link>
</span>
),
render: (content, { id }) => <HostLink hostId={id}>{content}</HostLink>,
},
{
title: 'IP',
Expand Down
9 changes: 2 additions & 7 deletions assets/js/components/InstanceOverview/InstanceOverview.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react';
import { useSelector } from 'react-redux';
import { Link } from 'react-router-dom';
import { getCluster, getHost } from '@state/selectors';
import HealthIcon from '@components/Health';
import { Features } from '@components/SapSystemDetails';
import { DATABASE_TYPE } from '@lib/model';
import HostLink from '@components/HostLink';
import ClusterLink from '@components/ClusterLink';
import Pill from '@components/Pill';
const InstanceOverview = ({
Expand Down Expand Up @@ -50,12 +50,7 @@ const InstanceOverview = ({
)}
</div>
<div className="table-cell p-2">
<Link
className="text-jungle-green-500 hover:opacity-75"
to={`/hosts/${hostId}`}
>
{host && host.hostname}
</Link>
<HostLink hostId={hostId}>{host && host.hostname}</HostLink>
</div>
</div>
);
Expand Down
8 changes: 2 additions & 6 deletions assets/js/components/SapSystemDetails/tableConfigs.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { Link } from 'react-router-dom';
import HostLink from '@components/HostLink';
import { Features, InstanceStatus } from './GenericSystemDetails';

export const systemInstancesTableConfiguration = {
Expand Down Expand Up @@ -33,11 +33,7 @@ export const systemHostsTableConfiguration = {
{
title: 'Hostname',
key: 'hostname',
render: (content, { id }) => (
<span className="transition hover:text-green-600">
<Link to={`/hosts/${id}`}>{content}</Link>
</span>
),
render: (content, { id }) => <HostLink hostId={id}>{content}</HostLink>,
},
{
title: 'IP',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
Feature: SAP system details view
This is where the user has a detailed view of the status of one specific discovered SAP system

Background:
Given a discovered SAP system within a SAP deployment with the following properties
# Id: 'f534a4ad-cef7-5234-b196-e67082ffb50c',
# Sid: 'NWD',
# Hosts: ['vmnwdev01', 'vmnwdev02', 'vmnwdev03', 'vmnwdev04']
And 4 hosts associated to the SAP system

Scenario: Detailed view of one specific SAP system is available
When I navigate to a specific SAP system ('/sap_systems/f534a4ad-cef7-5234-b196-e67082ffb50c')
Then the displayed SAP system SID is correct
And the displayed SAP system has "Application server" type

Scenario: Not found is given when the SAP system is not available
When I navigate to a specific SAP system ('/sapsystems/other')
Then Not found message is displayed

Scenario: SAP system instances are properly shown
Given I navigate to a specific SAP system ('/sap_systems/f534a4ad-cef7-5234-b196-e67082ffb50c')
Then 4 instances are displayed
And the data of each instance is correct
And the status of each instance is GREEN

Scenario: SAP system instances status change event is received
Given I navigate to a specific SAP system ('/sap_systems/f534a4ad-cef7-5234-b196-e67082ffb50c')
When a new SAP system event for this system with the 1st instance with a GRAY status is received
And the page is refreshed
arbulu89 marked this conversation as resolved.
Show resolved Hide resolved
Then the status of the 1st instance is GRAY
When a new SAP system event for this system with the 1st instance with a GREEN status is received
And the page is refreshed
Then the status of the 1st instance is GREEN
When a new SAP system event for this system with the 1st instance with a YELLOW status is received
And the page is refreshed
Then the status of the 1st instance is YELLOW
When a new SAP system event for this system with the 1st instance with a RED status is received
And the page is refreshed
Then the status of the 1st instance is RED

Scenario: New instance is discovered in the SAP system
Given I navigate to a specific SAP system ('/sap_systems/f534a4ad-cef7-5234-b196-e67082ffb50c')
When a new instance is discovered in a new agent
Then the new instace is added in the layout table

Scenario: The hosts table shows all associated hosts
Given I navigate to a specific SAP system ('/sap_systems/f534a4ad-cef7-5234-b196-e67082ffb50c')
Then the hosts table shows all the associated hosts
And each host has correct data
89 changes: 89 additions & 0 deletions test/e2e/cypress/fixtures/sap-system-details/selected_system.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
export const healthMap = {
GREEN: 'bg-jungle-green-500',
YELLOW: 'bg-yellow-500',
RED: 'bg-red-500',
GRAY: 'bg-gray-500',
};

export const selectedSystem = {
Id: 'f534a4ad-cef7-5234-b196-e67082ffb50c',
Sid: 'NWD',
Type: 'Application server',
Hosts: [
{
Hostname: 'sapnwdas',
Instance: '00',
Features: 'MESSAGESERVER|ENQUE',
HttpPort: '50013',
HttpsPort: '50014',
StartPriority: '1',
Status: 'SAPControl-GREEN',
StatusBadge: 'GREEN',
},
{
Hostname: 'sapnwdpas',
Instance: '01',
Features: 'ABAP|GATEWAY|ICMAN|IGS',
HttpPort: '50113',
HttpsPort: '50114',
StartPriority: '3',
Status: 'SAPControl-GREEN',
StatusBadge: 'GREEN',
},
{
Hostname: 'sapnwdaas1',
Instance: '02',
Features: 'ABAP|GATEWAY|ICMAN|IGS',
HttpPort: '50213',
HttpsPort: '50214',
StartPriority: '3',
Status: 'SAPControl-GREEN',
StatusBadge: 'GREEN',
},
{
Hostname: 'sapnwder',
Instance: '10',
Features: 'ENQREP',
HttpPort: '51013',
HttpsPort: '51014',
StartPriority: '0.5',
Status: 'SAPControl-GREEN',
StatusBadge: 'GREEN',
},
],
};

export const attachedHosts = [
{
Name: 'vmnwdev01',
AgentId: '7269ee51-5007-5849-aaa7-7c4a98b0c9ce',
Addresses: ['10.100.1.21', '10.100.1.25'],
Provider: 'azure',
Cluster: 'netweaver_cluster',
Version: '0.7.1+git.dev42.1640084952.33229fc',
},
{
Name: 'vmnwdev03',
AgentId: '9a3ec76a-dd4f-5013-9cf0-5eb4cf89898f',
Addresses: ['10.100.1.23', '10.100.1.27'],
Provider: 'azure',
Cluster: '',
Version: '0.7.1+git.dev42.1640084952.33229fc',
},
{
Name: 'vmnwdev04',
AgentId: '1b0e9297-97dd-55d6-9874-8efde4d84c90',
Addresses: ['10.100.1.24', '10.100.1.28'],
Provider: 'azure',
Cluster: '',
Version: '0.7.1+git.dev42.1640084952.33229fc',
},
{
Name: 'vmnwdev02',
AgentId: 'fb2c6b8a-9915-5969-a6b7-8b5a42de1971',
Addresses: ['10.100.1.22', '10.100.1.26'],
Provider: 'azure',
Cluster: 'netweaver_cluster',
Version: '0.7.1+git.dev42.1640084952.33229fc',
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Feature: SAP Systems Overview

Scenario: Registered SAP Systems should be available in the overview
When I navigate to the SAP Systems overview page
Then the discovered SID ar the expected ones
Then the discovered SID are the expected ones
And the health of each of the systems is healthy
And the links to the to the details page are working

Expand Down Expand Up @@ -42,27 +42,22 @@ Feature: SAP Systems Overview
Scenario: System health state is changed upon new SAP system events
Given I navigate to the SAP Systems overview page
When a new SAP system event for the first SAP system with the 1st instance with a GRAY status is received
And the page is refreshed
Then the status of the 1st instance in this SAP system is GRAY
And the SAP system state is GRAY
When a new SAP system event for the first SAP system with the 2nd instance with a YELLOW status is received
And the page is refreshed
Then the status of the 2nd instance in this SAP system is YELLOW
And the SAP system state is YELLOW
When a new SAP system event for the first SAP system with the 3rd instance with a RED status is received
And the page is refreshed
Then the status of the 3rd instance in this SAP system is RED
And the SAP system state is RED

Scenario: System health state is changed upon new HANA database events attached
Given I navigate to the SAP Systems overview page
When a new HANA database event for the first SAP system with the 1st HANA instance with a RED status is received
And the page is refreshed
Then the status of the 1st HANA instance in this SAP system is RED
And the SAP system state is RED

Scenario: SAP diagnostic agent discoveries are not displayed
Given I navigate to the SAP Systems overview page
When a new SAP discovery with a SAP diagnostics agent is received
And the page is refreshed
Then the discovery with the SAP diagnostics agent is not displayed