aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/helpers
diff options
context:
space:
mode:
authorWouter Admiraal <wouter.admiraal@sonarsource.com>2019-05-07 13:01:01 +0200
committerSonarTech <sonartech@sonarsource.com>2019-05-09 20:21:09 +0200
commit2f02c40ef393c1cd20adc69d53409d31fc739ef8 (patch)
tree0c8852c557db9a29ebfb2e2e7177ab22ca05eaa6 /server/sonar-web/src/main/js/helpers
parent3831ff61b755d3e419d46d2491afd8b037bc5089 (diff)
downloadsonarqube-2f02c40ef393c1cd20adc69d53409d31fc739ef8.tar.gz
sonarqube-2f02c40ef393c1cd20adc69d53409d31fc739ef8.zip
SONAR-11938 Remove Server ID and Version from system information
Diffstat (limited to 'server/sonar-web/src/main/js/helpers')
-rw-r--r--server/sonar-web/src/main/js/helpers/testMocks.ts214
1 files changed, 214 insertions, 0 deletions
diff --git a/server/sonar-web/src/main/js/helpers/testMocks.ts b/server/sonar-web/src/main/js/helpers/testMocks.ts
index 7ae22739944..66c6a639e6f 100644
--- a/server/sonar-web/src/main/js/helpers/testMocks.ts
+++ b/server/sonar-web/src/main/js/helpers/testMocks.ts
@@ -17,6 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+/* eslint-disable sonarjs/no-duplicate-string */
import { InjectedRouter } from 'react-router';
import { Store, createStore } from 'redux';
import { Location } from 'history';
@@ -98,6 +99,169 @@ export function mockAppState(overrides: Partial<T.AppState> = {}): T.AppState {
};
}
+export function mockBaseSysInfo(overrides: Partial<any> = {}): T.SysInfoBase {
+ return {
+ Health: 'GREEN' as T.HealthType,
+ 'Health Causes': [],
+ System: {
+ Version: '7.8'
+ },
+ Database: {
+ Database: 'PostgreSQL',
+ 'Database Version': '10.3',
+ Username: 'sonar',
+ URL: 'jdbc:postgresql://localhost/sonar',
+ Driver: 'PostgreSQL JDBC Driver',
+ 'Driver Version': '42.2.5'
+ },
+ 'Compute Engine Tasks': {
+ 'Total Pending': 0,
+ 'Total In Progress': 0
+ },
+ 'Search State': { State: 'GREEN', Nodes: 3 },
+ 'Search Indexes': {
+ 'Index components - Docs': 30445,
+ 'Index components - Shards': 10
+ },
+ ...overrides
+ };
+}
+
+export function mockClusterSysInfo(overrides: Partial<any> = {}): T.SysInfoCluster {
+ const baseInfo = mockBaseSysInfo(overrides);
+ return {
+ ...baseInfo,
+ System: {
+ ...baseInfo.System,
+ 'High Availability': true,
+ 'Server ID': 'asd564-asd54a-5dsfg45'
+ },
+ Settings: {
+ 'sonar.cluster.enabled': 'true',
+ 'sonar.cluster.node.name': 'server9.example.com'
+ },
+ 'Application Nodes': [
+ {
+ Name: 'server9.example.com',
+ Host: '10.0.0.0',
+ Health: 'GREEN' as T.HealthType,
+ 'Health Causes': [],
+ System: {
+ Version: '7.8'
+ },
+ Plugins: {
+ java: '5.13.0.17924 [SonarJava]'
+ },
+ 'Web JVM State': {
+ 'Max Memory (MB)': 1024,
+ 'Free Memory (MB)': 122
+ },
+ 'Web Database Connection': {
+ 'Pool Active Connections': 1
+ },
+ 'Web Logging': { 'Logs Level': 'DEBUG' },
+ 'Web JVM Properties': {
+ 'file.encoding': 'UTF-8',
+ 'file.separator': '/'
+ },
+ 'Compute Engine Tasks': {
+ Pending: 0,
+ 'In Progress': 0
+ },
+ 'Compute Engine JVM State': {
+ 'Max Memory (MB)': 1024,
+ 'Free Memory (MB)': 78
+ },
+ 'Compute Engine Database Connection': {
+ 'Pool Initial Size': 0,
+ 'Pool Active Connections': 0
+ },
+ 'Compute Engine Logging': {
+ 'Logs Level': 'INFO'
+ },
+ 'Compute Engine JVM Properties': {
+ 'file.encoding': 'UTF-8',
+ 'file.separator': '/'
+ }
+ },
+ {
+ Name: 'server9.example.com',
+ Host: '10.0.0.0',
+ Health: 'GREEN' as T.HealthType,
+ 'Health Causes': [],
+ System: {
+ Version: '7.8'
+ },
+ Plugins: {
+ java: '5.13.0.17924 [SonarJava]'
+ },
+ 'Web JVM State': {
+ 'Max Memory (MB)': 1024,
+ 'Free Memory (MB)': 111
+ },
+ 'Web Database Connection': {
+ 'Pool Active Connections': 0,
+ 'Pool Max Connections': 60
+ },
+ 'Web Logging': { 'Logs Level': 'INFO' },
+ 'Web JVM Properties': {
+ 'file.encoding': 'UTF-8',
+ 'file.separator': '/'
+ },
+ 'Compute Engine Tasks': {
+ Pending: 0,
+ 'In Progress': 0
+ },
+ 'Compute Engine JVM State': {
+ 'Max Memory (MB)': 1024,
+ 'Free Memory (MB)': 89
+ },
+ 'Compute Engine Database Connection': {
+ 'Pool Initial Size': 0,
+ 'Pool Active Connections': 0
+ },
+ 'Compute Engine Logging': {
+ 'Logs Level': 'INFO'
+ },
+ 'Compute Engine JVM Properties': {
+ 'file.encoding': 'UTF-8',
+ 'file.separator': '/'
+ }
+ }
+ ],
+ 'Search Nodes': [
+ {
+ Name: 'server.example.com',
+ Host: '10.0.0.0',
+ 'Search State': {
+ 'CPU Usage (%)': 0,
+ 'Disk Available': '93 GB'
+ }
+ },
+ {
+ Name: 'server.example.com',
+ Host: '10.0.0.0',
+ 'Search State': {
+ 'CPU Usage (%)': 0,
+ 'Disk Available': '93 GB'
+ }
+ },
+ {
+ Name: 'server.example.com',
+ Host: '10.0.0.0',
+ 'Search State': {
+ 'CPU Usage (%)': 0,
+ 'Disk Available': '93 GB'
+ }
+ }
+ ],
+ Statistics: {
+ ncloc: 989880
+ },
+ ...overrides
+ };
+}
+
export function mockComponent(overrides: Partial<T.Component> = {}): T.Component {
return {
breadcrumbs: [],
@@ -488,6 +652,56 @@ export function mockSourceViewerFile(
};
}
+export function mockStandaloneSysInfo(overrides: Partial<any> = {}): T.SysInfoStandalone {
+ const baseInfo = mockBaseSysInfo(overrides);
+ return {
+ ...baseInfo,
+ System: {
+ ...baseInfo.System,
+ 'High Availability': false,
+ 'Server ID': 'asd564-asd54a-5dsfg45'
+ },
+ Settings: {
+ 'sonar.cluster.enabled': 'true',
+ 'sonar.cluster.node.name': 'server9.example.com'
+ },
+ 'Web JVM State': {
+ 'Max Memory (MB)': 1024,
+ 'Free Memory (MB)': 111
+ },
+ 'Web Database Connection': {
+ 'Pool Active Connections': 0,
+ 'Pool Max Connections': 60
+ },
+ 'Web Logging': { 'Logs Level': 'INFO', 'Logs Dir': '/logs' },
+ 'Web JVM Properties': {
+ 'file.encoding': 'UTF-8',
+ 'file.separator': '/'
+ },
+ 'Compute Engine Tasks': {
+ Pending: 0,
+ 'In Progress': 0
+ },
+ 'Compute Engine JVM State': {
+ 'Max Memory (MB)': 1024,
+ 'Free Memory (MB)': 89
+ },
+ 'Compute Engine Database Connection': {
+ 'Pool Initial Size': 0,
+ 'Pool Active Connections': 0
+ },
+ 'Compute Engine Logging': {
+ 'Logs Level': 'DEBUG',
+ 'Logs Dir': '/logs'
+ },
+ 'Compute Engine JVM Properties': {
+ 'file.encoding': 'UTF-8',
+ 'file.separator': '/'
+ },
+ ...overrides
+ };
+}
+
export function mockLongLivingBranch(
overrides: Partial<T.LongLivingBranch> = {}
): T.LongLivingBranch {