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

Add flags to identify and stub Mesos requests #2593

Merged
merged 2 commits into from
Jan 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/js/core/MesosStream.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { stream } from "@dcos/mesos-client";

export const MesosStreamType = Symbol("MesosStreamType");
export default stream({ type: "SUBSCRIBE" }).publishReplay().refCount();
export default stream({ type: "SUBSCRIBE" }, "/mesos/api/v1?subscribe")
.publishReplay()
.refCount();
5 changes: 4 additions & 1 deletion src/js/stores/MesosStateStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ class MesosStateStore extends GetSetBaseStore {
subscribe() {
const mesosStream = container.get(MesosStreamType);
const parsers = pipe(...Object.values(mesosStreamParsers));
const getMasterRequest = request({ type: "GET_MASTER" }).retry(3);
const getMasterRequest = request(
{ type: "GET_MASTER" },
"/mesos/api/v1?get_master"
).retry(3);

this.stream = mesosStream
.merge(getMasterRequest)
Expand Down
33 changes: 33 additions & 0 deletions tests/_fixtures/1-service-with-executor-task/mesos-get-master.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"get_master": {
"master_info": {
"address": {
"hostname": "10.0.7.122",
"ip": "10.0.7.122",
"port": 5050
},
"capabilities": [
{
"type": "AGENT_UPDATE"
}
],
"domain": {
"fault_domain": {
"region": {
"name": "region-1"
},
"zone": {
"name": "zone-1"
}
}
},
"hostname": "10.0.7.122",
"id": "b3bd182c-c6d7-463e-8bf0-06cd5807df4e",
"ip": 2198274058,
"pid": "master@10.0.7.122:5050",
"port": 5050,
"version": "0.27.0"
}
},
"type": "GET_MASTER"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"get_master": {
"master_info": {
"address": {
"hostname": "10.0.4.58",
"ip": "10.0.4.58",
"port": 5050
},
"capabilities": [
{
"type": "AGENT_UPDATE"
}
],
"domain": {
"fault_domain": {
"region": {
"name": "region-1"
},
"zone": {
"name": "zone-1"
}
}
},
"hostname": "10.0.4.58",
"id": "74f1836b-6784-4030-816e-aacbdd45ff57",
"ip": 2198274058,
"pid": "master@10.0.4.58:5050",
"port": 5050,
"version": "1.2.0"
}
},
"type": "GET_MASTER"
}
33 changes: 33 additions & 0 deletions tests/_fixtures/marathon-1-task/mesos-get-master.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"get_master": {
"master_info": {
"address": {
"hostname": "172.17.8.101",
"ip": "172.17.8.101",
"port": 5050
},
"capabilities": [
{
"type": "AGENT_UPDATE"
}
],
"domain": {
"fault_domain": {
"region": {
"name": "region-1"
},
"zone": {
"name": "zone-1"
}
}
},
"hostname": "172.17.8.101",
"id": "20151004-214809-1695027628-5050-12268",
"ip": 2198274058,
"pid": "master@172.17.8.101:5050",
"port": 5050,
"version": "0.23.0"
}
},
"type": "GET_MASTER"
}
Loading