worksmith_etcd
Advanced tools
Comparing version 0.0.1 to 0.1.0
{ | ||
"name": "worksmith_etcd", | ||
"version": "0.0.1", | ||
"version": "0.1.0", | ||
"description": "Etcd activites for worksmith", | ||
@@ -26,2 +26,3 @@ "main": "index.js", | ||
"node-etcd": "^4.0.2", | ||
"node-uuid": "^1.4.3", | ||
"worksmith": "0.0.22" | ||
@@ -28,0 +29,0 @@ }, |
@@ -39,3 +39,3 @@ # worksmith_etcd | ||
key | string | The etcd key to be used in the lock | ||
value | string | Optional value for the lock, defaults to ```new Date().getTime()``` | ||
value | string | Optional value for the lock, defaults to a uuid | ||
ttl | integer | Optional time in secords before the lock automatically expires | ||
@@ -42,0 +42,0 @@ |
var debug = require('debug')('worksmith:tasks:etcd:lock') | ||
var uuid = require('node-uuid').v4 | ||
@@ -9,3 +10,3 @@ module.exports = function(definition) { | ||
var key = context.get(definition.key) | ||
var value = context.get(definition.value) || new Date().getTime() | ||
var value = context.get(definition.value) || uuid() | ||
var ttl = context.get(definition.ttl) | ||
@@ -12,0 +13,0 @@ |
var worksmith = require('worksmith') | ||
var lock = require('../')('lock') | ||
var Etcd = require('node-etcd') | ||
var format = require('util').format | ||
@@ -65,3 +66,3 @@ describe('lock', function() { | ||
it('should default the lock value to the current time in millis', function(done) { | ||
it('should default the lock value to a uuid', function(done) { | ||
@@ -74,4 +75,2 @@ var workflow = worksmith({ | ||
var before = new Date().getTime() | ||
workflow({}, function(err) { | ||
@@ -82,4 +81,3 @@ assert.ifError(err) | ||
assert.ok(result.node.value) | ||
assert.ok(result.node.value >= before) | ||
assert.ok(result.node.value <= before + 1000) | ||
assert.ok(/\w+-\w+-\w+-\w+-\w+/.test(result.node.value), format('%s failed to match expected pattern', result.node.value)) | ||
done() | ||
@@ -86,0 +84,0 @@ }) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13916
4
+ Addednode-uuid@^1.4.3