presidium 0.18.0 → 0.18.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DockerSwarm.js +9 -1
- package/DockerSwarm.test.js +3 -1
- package/package.json +1 -1
package/DockerSwarm.js
CHANGED
|
@@ -26,7 +26,10 @@ const DockerSwarm = function (advertiseAddr) {
|
|
|
26
26
|
*
|
|
27
27
|
* @synopsis
|
|
28
28
|
* ```coffeescript [specscript]
|
|
29
|
-
* new DockerSwarm(...).init() -> Promise
|
|
29
|
+
* new DockerSwarm(...).init() -> Promise<{
|
|
30
|
+
* workerJoinToken: string,
|
|
31
|
+
* managerJoinToken: string,
|
|
32
|
+
* }>
|
|
30
33
|
* ```
|
|
31
34
|
*/
|
|
32
35
|
DockerSwarm.prototype.init = async function init() {
|
|
@@ -35,6 +38,11 @@ DockerSwarm.prototype.init = async function init() {
|
|
|
35
38
|
throw new Error(await response.text())
|
|
36
39
|
}
|
|
37
40
|
})
|
|
41
|
+
const swarmData = await this.inspect()
|
|
42
|
+
return {
|
|
43
|
+
workerJoinToken: swarmData.JoinTokens.Worker,
|
|
44
|
+
managerJoinToken: swarmData.JoinTokens.Manager,
|
|
45
|
+
}
|
|
38
46
|
}
|
|
39
47
|
|
|
40
48
|
/**
|
package/DockerSwarm.test.js
CHANGED
|
@@ -12,7 +12,9 @@ const test = Test('DockerSwarm', async function () {
|
|
|
12
12
|
const localSwarm = new DockerSwarm(advertiseAddr)
|
|
13
13
|
|
|
14
14
|
console.log('initializing swarm')
|
|
15
|
-
await localSwarm.init()
|
|
15
|
+
const { workerJoinToken, managerJoinToken } = await localSwarm.init()
|
|
16
|
+
assert.equal(typeof workerJoinToken, 'string')
|
|
17
|
+
assert.equal(typeof managerJoinToken, 'string')
|
|
16
18
|
|
|
17
19
|
await localSwarm.inspect().then(console.log)
|
|
18
20
|
|