Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 6DB6C200B6F for ; Wed, 10 Aug 2016 00:33:58 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 6C48B160AB0; Tue, 9 Aug 2016 22:33:58 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 3CCC6160AAD for ; Wed, 10 Aug 2016 00:33:57 +0200 (CEST) Received: (qmail 23460 invoked by uid 500); 9 Aug 2016 22:33:45 -0000 Mailing-List: contact common-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list common-commits@hadoop.apache.org Received: (qmail 20998 invoked by uid 99); 9 Aug 2016 22:33:44 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Aug 2016 22:33:44 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 4D400EEE2E; Tue, 9 Aug 2016 22:33:44 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: wangda@apache.org To: common-commits@hadoop.apache.org Date: Tue, 09 Aug 2016 22:34:13 -0000 Message-Id: <7989aa0fde07476bb5604edcbde474bb@git.apache.org> In-Reply-To: <2d0cfdd5d59943dbae271116eabdd2d4@git.apache.org> References: <2d0cfdd5d59943dbae271116eabdd2d4@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [31/50] [abbrv] hadoop git commit: YARN-4517. Add nodes page and fix bunch of license issues. (Varun Saxena via wangda) archived-at: Tue, 09 Aug 2016 22:33:58 -0000 http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-node-app-test.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-node-app-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-node-app-test.js new file mode 100644 index 0000000..21a715c --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-node-app-test.js @@ -0,0 +1,102 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('serializer:yarn-node-app', 'Unit | Serializer | NodeApp', { +}); + +test('Basic creation test', function(assert) { + let serializer = this.subject(); + + assert.ok(serializer); + assert.ok(serializer.normalizeSingleResponse); + assert.ok(serializer.normalizeArrayResponse); + assert.ok(serializer.internalNormalizeSingleResponse); +}); + +test('normalizeArrayResponse test', function(assert) { + let serializer = this.subject(), + modelClass = { + modelName: "yarn-node-app" + }, + payload = { + apps: { + app: [{ + id:"application_1456251210105_0001", state:"FINISHED", user:"root" + },{ + id:"application_1456251210105_0002", state:"RUNNING",user:"root", + containerids:["container_e38_1456251210105_0002_01_000001", + "container_e38_1456251210105_0002_01_000002"] + }] + } + }; + assert.expect(15); + var response = + serializer.normalizeArrayResponse({}, modelClass, payload, null, null); + assert.ok(response.data); + assert.equal(response.data.length, 2); + assert.equal(response.data[0].attributes.containers, undefined); + assert.equal(response.data[1].attributes.containers.length, 2); + assert.deepEqual(response.data[1].attributes.containers, + payload.apps.app[1].containerids); + for (var i = 0; i < 2; i++) { + assert.equal(response.data[i].type, modelClass.modelName); + assert.equal(response.data[i].id, payload.apps.app[i].id); + assert.equal(response.data[i].attributes.appId, payload.apps.app[i].id); + assert.equal(response.data[i].attributes.state, payload.apps.app[i].state); + assert.equal(response.data[i].attributes.user, payload.apps.app[i].user); + } +}); + +test('normalizeArrayResponse no apps test', function(assert) { + let serializer = this.subject(), + modelClass = { + modelName: "yarn-node-app" + }, + payload = { apps: null }; + assert.expect(5); + var response = + serializer.normalizeArrayResponse({}, modelClass, payload, null, null); + assert.ok(response.data); + assert.equal(response.data.length, 1); + assert.equal(response.data[0].type, modelClass.modelName); + assert.equal(response.data[0].id, "dummy"); + assert.equal(response.data[0].attributes.appId, undefined); +}); + +test('normalizeSingleResponse test', function(assert) { + let serializer = this.subject(), + modelClass = { + modelName: "yarn-node-app" + }, + payload = { + app: {id:"application_1456251210105_0001", state:"FINISHED", user:"root"} + }; + assert.expect(7); + var response = + serializer.normalizeSingleResponse({}, modelClass, payload, null, null); + assert.ok(response.data); + assert.equal(payload.app.id, response.data.id); + assert.equal(modelClass.modelName, response.data.type); + assert.equal(payload.app.id, response.data.attributes.appId); + assert.equal(payload.app.state, response.data.attributes.state); + assert.equal(payload.app.user, response.data.attributes.user); + assert.equal(response.data.attributes.containers, undefined); +}); + http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-node-container-test.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-node-container-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-node-container-test.js new file mode 100644 index 0000000..1f08467 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-node-container-test.js @@ -0,0 +1,128 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('serializer:yarn-node-container', 'Unit | Serializer | NodeContainer', { +}); + +test('Basic creation test', function(assert) { + let serializer = this.subject(); + + assert.ok(serializer); + assert.ok(serializer.normalizeSingleResponse); + assert.ok(serializer.normalizeArrayResponse); + assert.ok(serializer.internalNormalizeSingleResponse); +}); + +test('normalizeArrayResponse test', function(assert) { + let serializer = this.subject(), + modelClass = { + modelName: "yarn-node-container" + }, + payload = { + containers: { + container: [{ + id: "container_e32_1456000363780_0002_01_000001", state: "RUNNING", + exitCode:-1000,diagnostics:"",user:"root",totalMemoryNeededMB:2048, + totalVCoresNeeded:1,containerLogsLink: "http://localhost:8042/node/" + + "containerlogs/container_e32_1456000363780_0002_01_000001/root", + nodeId: "localhost:64318", containerLogFiles:["syslog","stderr", + "stdout"] + },{ + id:"container_e32_1456000363780_0002_01_000003", state:"RUNNING", + exitCode:-1000, diagnostics:"", user:"root", totalMemoryNeededMB:1024, + totalVCoresNeeded:1,containerLogsLink:"http://localhost:8042/node" + + "/containerlogs/container_e32_1456000363780_0002_01_000003/root", + nodeId:"localhost:64318",containerLogFiles:["syslog","stderr", + "syslog.shuffle","stdout"] + }] + } + }; + assert.expect(14); + var response = + serializer.normalizeArrayResponse({}, modelClass, payload, null, null); + assert.ok(response.data); + assert.equal(response.data.length, 2); + assert.equal(response.data[0].id, + "container_e32_1456000363780_0002_01_000001"); + assert.equal(response.data[1].id, + "container_e32_1456000363780_0002_01_000003"); + assert.equal(response.data[0].attributes.containerLogFiles.length, 3); + assert.equal(response.data[1].attributes.containerLogFiles.length, 4); + for (var i = 0; i < 2; i++) { + assert.equal(response.data[i].type, modelClass.modelName); + assert.deepEqual(response.data[i].attributes.containerLogFiles, + payload.containers.container[i].containerLogFiles); + assert.equal(response.data[i].attributes.state, + payload.containers.container[i].state); + assert.equal(response.data[i].attributes.user, + payload.containers.container[i].user); + } +}); + +test('normalizeArrayResponse no containers test', function(assert) { + let serializer = this.subject(), + modelClass = { + modelName: "yarn-node-container" + }, + payload = { containers: null }; + assert.expect(5); + var response = + serializer.normalizeArrayResponse({}, modelClass, payload, null, null); + assert.ok(response.data); + assert.equal(response.data.length, 1); + assert.equal(response.data[0].type, modelClass.modelName); + assert.equal(response.data[0].id, "dummy"); + assert.equal(response.data[0].attributes.containerId, undefined); +}); + +test('normalizeSingleResponse test', function(assert) { + let serializer = this.subject(), + modelClass = { + modelName: "yarn-node-container" + }, + payload = { + container: { + id: "container_e32_1456000363780_0002_01_000001", state: "RUNNING", + exitCode:-1000,diagnostics:"",user:"root",totalMemoryNeededMB:2048, + totalVCoresNeeded:1,containerLogsLink: "http://localhost:8042/node/" + + "containerlogs/container_e32_1456000363780_0002_01_000001/root", + nodeId: "localhost:64318", containerLogFiles:["syslog","stderr", + "stdout"] + } + }; + assert.expect(11); + var response = + serializer.normalizeSingleResponse({}, modelClass, payload, null, null); + assert.ok(response.data); + assert.equal(response.data.id, payload.container.id); + assert.equal(response.data.type, modelClass.modelName); + assert.equal(response.data.attributes.containerId, payload.container.id); + assert.equal(response.data.attributes.state, payload.container.state); + assert.equal(response.data.attributes.user, payload.container.user); + assert.equal(response.data.attributes.exitCode, payload.container.exitCode); + assert.equal(response.data.attributes.totalMemoryNeededMB, + payload.container.totalMemoryNeeded); + assert.equal(response.data.attributes.totalVCoresNeeded, + payload.container.totalVCoresNeeded); + assert.equal(response.data.attributes.containerLogFiles.length, 3); + assert.deepEqual(response.data.attributes.containerLogFiles, + payload.container.containerLogFiles); +}); + http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-node-test.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-node-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-node-test.js new file mode 100644 index 0000000..0e76ccb --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-node-test.js @@ -0,0 +1,69 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { moduleFor, test } from 'ember-qunit'; +import Converter from 'yarn-ui/utils/converter'; + +moduleFor('serializer:yarn-node', 'Unit | Serializer | Node', { +}); + +test('Basic creation test', function(assert) { + let serializer = this.subject(); + + assert.ok(serializer); + assert.ok(serializer.normalizeSingleResponse); + assert.ok(serializer.internalNormalizeSingleResponse); +}); + +test('normalizeSingleResponse test', function(assert) { + let serializer = this.subject(), + modelClass = { + modelName: "yarn-node" + }, + payload = { + nodeInfo: { + healthReport: "Healthy", totalVmemAllocatedContainersMB: 344064, + totalPmemAllocatedContainersMB: 163840, + totalVCoresAllocatedContainers: 160, + vmemCheckEnabled: true, pmemCheckEnabled: true, + lastNodeUpdateTime: 1456250210310, nodeHealthy: true, + nodeManagerVersion: "3.0.0-SNAPSHOT", + nodeManagerBuildVersion: "3.0.0-SNAPSHOT", + nodeManagerVersionBuiltOn: "2000-01-01T00:00Z", + hadoopVersion: "3.0.0-SNAPSHOT", + hadoopBuildVersion: "3.0.0-SNAPSHOT", + hadoopVersionBuiltOn: "2000-01-01T00:00Z", + id: "localhost:64318", nodeHostName: "192.168.0.102", + nmStartupTime: 1456250208231 + } + }; + assert.expect(6); + var id = "localhost:64318"; + var response = serializer.normalizeSingleResponse({}, modelClass, payload, id, null); + assert.equal(response.data.id, id); + assert.equal(response.data.type, modelClass.modelName); + assert.equal(response.data.attributes.totalVmemAllocatedContainersMB, + payload.nodeInfo.totalVmemAllocatedContainersMB); + assert.equal(response.data.attributes.totalPmemAllocatedContainersMB, + payload.nodeInfo.totalPmemAllocatedContainersMB); + assert.equal(response.data.attributes.totalVCoresAllocatedContainers, + payload.nodeInfo.totalVCoresAllocatedContainers); + assert.equal(response.data.attributes.nmStartupTime, + Converter.timeStampToDate(payload.nodeInfo.nmStartupTime)); +}); + http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-rm-node-test.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-rm-node-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-rm-node-test.js new file mode 100644 index 0000000..bc6397d --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/serializers/yarn-rm-node-test.js @@ -0,0 +1,153 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('serializer:yarn-rm-node', 'Unit | Serializer | RMNode', { +}); + +test('Basic creation test', function(assert) { + let serializer = this.subject(); + + assert.ok(serializer); + assert.ok(serializer.normalizeSingleResponse); + assert.ok(serializer.normalizeArrayResponse); + assert.ok(serializer.internalNormalizeSingleResponse); +}); + +test('normalizeArrayResponse test', function(assert) { + let serializer = this.subject(), + modelClass = { + modelName: "yarn-rm-node" + }, + payload = { + nodes: { + node: [{ + rack: "/default-rack", state: "RUNNING", id: "192.168.1.1:64318", + nodeHostName: "192.168.1.1", nodeHTTPAddress: "192.168.1.1:8042", + lastHealthUpdate: 1456251290905, version: "3.0.0-SNAPSHOT", + healthReport: "", numContainers: 0, usedMemoryMB: 2048, + availMemoryMB: 161792, usedVirtualCores: 2, + availableVirtualCores: 158, nodeLabels: ["x"], + resourceUtilization: { + nodePhysicalMemoryMB: 4549, nodeVirtualMemoryMB: 4549, + nodeCPUUsage: 0.14995001256465912, + aggregatedContainersPhysicalMemoryMB: 0, + aggregatedContainersVirtualMemoryMB: 0, + containersCPUUsage: 0 + } + },{ + rack: "/default-rack", state: "RUNNING", id: "192.168.1.2:64318", + nodeHostName: "192.168.1.2", nodeHTTPAddress: "192.168.1.2:8042", + lastHealthUpdate: 1456251290905, version: "3.0.0-SNAPSHOT", + healthReport: "", numContainers: 0, usedMemoryMB: 0, + availMemoryMB: 163840, usedVirtualCores: 0, + availableVirtualCores: 160, nodeLabels: ["y"], + resourceUtilization: { + nodePhysicalMemoryMB: 4549, nodeVirtualMemoryMB: 4549, + nodeCPUUsage: 0.14995001256465912, + aggregatedContainersPhysicalMemoryMB: 0, + aggregatedContainersVirtualMemoryMB: 0, + containersCPUUsage: 0 + } + }] + } + }; + assert.expect(12); + var response = + serializer.normalizeArrayResponse({}, modelClass, payload, null, null); + assert.ok(response.data); + assert.equal(response.data.length, 2); + assert.equal(response.data[0].id, "192.168.1.1:64318"); + assert.equal(response.data[1].id, "192.168.1.2:64318"); + for (var i = 0; i < 2; i++) { + assert.equal(response.data[i].type, modelClass.modelName); + assert.equal(response.data[i].attributes.nodeHostName, + payload.nodes.node[i].nodeHostName); + assert.equal(response.data[i].attributes.nodeHTTPAddress, + payload.nodes.node[i].nodeHTTPAddress); + assert.deepEqual(response.data[i].attributes.nodeLabels, + payload.nodes.node[i].nodeLabels); + } +}); + +test('normalizeArrayResponse no nodes test', function(assert) { + let serializer = this.subject(), + modelClass = { + modelName: "yarn-rm-node" + }, + payload = { nodes: null }; + assert.expect(5); + var response = + serializer.normalizeArrayResponse({}, modelClass, payload, null, null); + console.log(response); + assert.ok(response.data); + assert.equal(response.data.length, 1); + assert.equal(response.data[0].type, modelClass.modelName); + assert.equal(response.data[0].id, "dummy"); + assert.equal(response.data[0].attributes.nodeHostName, undefined); +}); + +test('normalizeSingleResponse test', function(assert) { + let serializer = this.subject(), + modelClass = { + modelName: "yarn-rm-node" + }, + payload = { + node: { + rack: "/default-rack", state: "RUNNING", id: "192.168.1.1:64318", + nodeHostName: "192.168.1.1", nodeHTTPAddress: "192.168.1.1:8042", + lastHealthUpdate: 1456251290905, version: "3.0.0-SNAPSHOT", + healthReport: "", numContainers: 0, usedMemoryMB: 2048, + availMemoryMB: 161792, usedVirtualCores: 2, + availableVirtualCores: 158, nodeLabels: ["x"], + resourceUtilization: { + nodePhysicalMemoryMB: 4549, nodeVirtualMemoryMB: 4549, + nodeCPUUsage: 0.14995001256465912, + aggregatedContainersPhysicalMemoryMB: 0, + aggregatedContainersVirtualMemoryMB: 0, + containersCPUUsage: 0 + } + } + }; + assert.expect(13); + var id = "localhost:64318"; + var response = + serializer.normalizeSingleResponse({}, modelClass, payload, id, null); + assert.ok(response.data); + assert.equal(response.data.id, id); + assert.equal(response.data.type, modelClass.modelName); + assert.equal(response.data.attributes.rack, payload.node.rack); + assert.equal(response.data.attributes.state, payload.node.state); + assert.equal(response.data.attributes.nodeHostName, + payload.node.nodeHostName); + assert.equal(response.data.attributes.nodeHTTPAddress, + payload.node.nodeHTTPAddress); + assert.equal(response.data.attributes.version, payload.node.version); + assert.equal(response.data.attributes.availMemoryMB, + payload.node.availMemoryMB); + assert.equal(response.data.attributes.usedMemoryMB, + payload.node.usedMemoryMB); + assert.equal(response.data.attributes.availableVirtualCores, + payload.node.availableVirtualCores); + assert.equal(response.data.attributes.usedVirtualCores, + payload.node.usedVirtualCores); + assert.deepEqual(response.data.attributes.nodeLabels, + payload.node.nodeLabels); +}); + http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/utils/converter-test.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/utils/converter-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/utils/converter-test.js index 55cf71d..481537d 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/utils/converter-test.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/utils/converter-test.js @@ -1,10 +1,52 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import converter from '../../../utils/converter'; import { module, test } from 'qunit'; -module('Unit | Utility | converter'); +module('Unit | Utility | Converter'); // Replace this with your real tests. test('it works', function(assert) { - var result = converter(); - assert.ok(result); + assert.ok(converter); + assert.ok(converter.splitForContainerLogs); +}); + +test('split for container logs', function(assert) { + var id = "localhost:64318!container_e32_1456000363780_0002_01_000001!" + + "syslog"; + var arr = converter.splitForContainerLogs(id); + assert.ok(arr); + assert.deepEqual(arr, ["localhost:64318", + "container_e32_1456000363780_0002_01_000001", "syslog"]); + id = "localhost:64318!container_e32_1456000363780_0002_01_000001!" + + "syslog!logs"; + arr = converter.splitForContainerLogs(id); + assert.ok(arr); + assert.deepEqual(arr, ["localhost:64318", + "container_e32_1456000363780_0002_01_000001", "syslog!logs"]); + id = "localhost:64318!container_e32_1456000363780_0002_01_000001"; + arr = converter.splitForContainerLogs(id); + assert.notOk(arr); + id = null; + arr = converter.splitForContainerLogs(id); + assert.notOk(arr); + id = undefined; + arr = converter.splitForContainerLogs(id); + assert.notOk(arr); }); http://git-wip-us.apache.org/repos/asf/hadoop/blob/d5bd55bf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/utils/sorter-test.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/utils/sorter-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/utils/sorter-test.js new file mode 100644 index 0000000..8f17380 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tests/unit/utils/sorter-test.js @@ -0,0 +1,26 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import Sorter from 'yarn-ui/utils/sorter'; +import { module, test } from 'qunit'; + +module('Unit | Utility | Sorter'); + +test('Basic creation test', function(assert) { + assert.ok(Sorter); +}); --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org For additional commands, e-mail: common-commits-help@hadoop.apache.org