Skip to content

Commit

Permalink
Merge 7f24971 into 701ca80
Browse files Browse the repository at this point in the history
  • Loading branch information
tmmi committed May 25, 2016
2 parents 701ca80 + 7f24971 commit a93b3a8
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 25 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
language: node_js
before_install:
- npm install -g npm
- npm cache clear
- npm install -g gulp
node_js:
Expand Down
10 changes: 8 additions & 2 deletions src/js/components/AppDebugInfoComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import AppsActions from "../actions/AppsActions";
import AppsEvents from "../events/AppsEvents";
import AppTaskStatsListComponent from "../components/AppTaskStatsListComponent";
import TaskMesosUrlComponent from "../components/TaskMesosUrlComponent";
import TaskFileDownloadComponent from "../components/TaskFileDownloadComponent";
import UnspecifiedNodeComponent from "../components/UnspecifiedNodeComponent";

function invalidateValue(value, suffix) {
Expand Down Expand Up @@ -62,6 +63,8 @@ var AppDebugInfoComponent = React.createClass({
);
}

lastTaskFailure.id = lastTaskFailure.id || lastTaskFailure.taskId;

const timestamp = lastTaskFailure.timestamp;
const timeStampText = new Date(timestamp) > new Date()
? "Just now"
Expand All @@ -86,8 +89,11 @@ var AppDebugInfoComponent = React.createClass({
<dd>
<span>{version}</span> ({new Moment(version).fromNow()})
</dd>
<dt>Mesos Details</dt>
<dd><TaskMesosUrlComponent task={lastTaskFailure}/></dd>
<dt>Mesos details</dt>
<dd><TaskMesosUrlComponent task={lastTaskFailure}/>
<TaskFileDownloadComponent task={lastTaskFailure} fileName="stderr" />
<TaskFileDownloadComponent task={lastTaskFailure} fileName="stdout" />
</dd>
</dl>
);
},
Expand Down
4 changes: 3 additions & 1 deletion src/js/stores/MesosStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,9 @@ function getExecutorDirectoryFromState(frameworkId, taskId, state) {

if (framework.executors != null) {
executor = framework.executors.find(matchExecutor);
} else if (framework.completed_executors != null) {
}

if (framework.completed_executors != null && executor == null) {
executor = framework.completed_executors.find(matchExecutor);
}

Expand Down
48 changes: 27 additions & 21 deletions src/test/units/AppDebugInfoComponent.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {expect} from "chai";
import {shallow} from "enzyme";
import {shallow, mount} from "enzyme";
import nock from "nock";

import config from "../../js/config/config";
Expand All @@ -20,18 +20,18 @@ import expectAsync from "./../helpers/expectAsync";
describe("App debug info component", function () {

describe("Last task failure", function () {
var info = {
"version": "1.2.3",
"frameworkId": "framework1",
"leader": "leader1.dcos.io",
"marathon_config": {
"marathon_field_1": "mf1",
"mesos_master_url": "http://master.dcos.io:5050",
"mesos_leader_ui_url" : "http://leader1.dcos.io:5050"
}
};

before(function (done) {
var info = {
"version": "1.2.3",
"frameworkId": "framework1",
"leader": "leader1.dcos.io",
"marathon_config": {
"marathon_field_1": "mf1",
"mesos_master_url": "http://leader1.dcos.io:5050"
}
};

nock(config.apiURL)
.get("/v2/info")
.reply(200, info);
Expand All @@ -45,17 +45,20 @@ describe("App debug info component", function () {
});

it("should show failed task", function (done) {
var task = {
appId: "/python",
host: "slave1.dcos.io",
message: "Slave slave1.dcos.io removed",
state: "TASK_LOST",
taskId: "python.83c0a69b-256a-11e5-aaed-fa163eaaa6b7",
slaveId: "slaveABC",
timestamp: "2015-08-05T09:08:56.349Z",
version: "2015-07-06T12:37:28.774Z"
};

var app = Util.extendObject(appScheme, {
id: "/python",
lastTaskFailure: {
appId: "/python",
host: "slave1.dcos.io",
message: "Slave slave1.dcos.io removed",
state: "TASK_LOST",
taskId: "python.83c0a69b-256a-11e5-aaed-fa163eaaa6b7",
timestamp: "2015-08-05T09:08:56.349Z",
version: "2015-07-06T12:37:28.774Z"
}
lastTaskFailure: task
});

nock(config.apiURL)
Expand All @@ -67,7 +70,7 @@ describe("App debug info component", function () {

AppsStore.once(AppsEvents.CHANGE, () => {
expectAsync(() => {
this.component = shallow(<AppDebugInfoComponent appId="/python" />);
this.component = mount(<AppDebugInfoComponent appId="/python" />);
var nodes = this.component.find("dd");

var taskId = nodes.at(0).text().trim();
Expand All @@ -76,6 +79,7 @@ describe("App debug info component", function () {
var host = nodes.at(3).text().trim();
var timestamp = nodes.at(4).find("span").text().trim();
var version = nodes.at(5).find("span").text().trim();
var details = nodes.at(6).find("a").at(0).props().href;

expect(taskId)
.to.equal("python.83c0a69b-256a-11e5-aaed-fa163eaaa6b7");
Expand All @@ -84,6 +88,8 @@ describe("App debug info component", function () {
expect(host).to.equal("slave1.dcos.io");
expect(timestamp).to.equal("2015-08-05T09:08:56.349Z");
expect(version).to.equal("2015-07-06T12:37:28.774Z");
expect(details).to.equal(info.marathon_config.mesos_leader_ui_url + "/#/slaves/" +
task.slaveId + "/frameworks/framework1/executors/" + task.taskId);
}, done);
});

Expand Down

0 comments on commit a93b3a8

Please sign in to comment.