-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: redis migrations + redis tests (#26)
* feat: redis migrations + redis tests * fix: lint settings
- Loading branch information
Showing
12 changed files
with
126 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
async function createConstantKeys(service) { | ||
const { redis } = service | ||
const pipeline = redis.pipeline() | ||
pipeline.set('some.key') | ||
pipeline.sadd('some.set', 'value') | ||
pipeline.sadd('some.set', 'other value') | ||
|
||
await pipeline.exec() | ||
} | ||
|
||
module.exports = { | ||
min: 0, | ||
final: 1, | ||
script: createConstantKeys, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = { | ||
min: 1, | ||
final: 2, | ||
script: `${__dirname}/update-data.lua`, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
redis.call('del', '{demo-app}some.key') | ||
redis.call('srem', '{demo-app}some.set', 'value') | ||
redis.call('sadd', '{demo-app}some.set', 'new value') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const assert = require('assert') | ||
const DemoApp = require('../../src') | ||
|
||
describe('#amqp action test', () => { | ||
before(async () => { | ||
this.demoapp = new DemoApp() | ||
await this.demoapp.connect() | ||
}) | ||
|
||
after(async () => { | ||
await this.demoapp.close() | ||
}) | ||
|
||
it('connects to redis server', async () => { | ||
const { redis } = this.demoapp | ||
assert.ok(redis, 'should have AMQP plugin') | ||
}) | ||
|
||
it('should able to call redis commands', async () => { | ||
const { redis } = this.demoapp | ||
await redis.set('sample-key', 'some-value') | ||
const keyContents = await redis.get('sample-key') | ||
assert.strictEqual(keyContents, 'some-value') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -817,6 +817,11 @@ cliui@^5.0.0: | |
strip-ansi "^5.2.0" | ||
wrap-ansi "^5.1.0" | ||
|
||
cluster-key-slot@^1.1.0: | ||
version "1.1.0" | ||
resolved "https://registry.yarnpkg.com/cluster-key-slot/-/cluster-key-slot-1.1.0.tgz#30474b2a981fb12172695833052bc0d01336d10d" | ||
integrity sha512-2Nii8p3RwAPiFwsnZvukotvow2rIHM+yQ6ZcBXGHdniadkYGZYiGmkHJIbZPIV9nfv7m/U1IPMVVcAhoWFeklw== | ||
|
||
code-point-at@^1.0.0: | ||
version "1.1.0" | ||
resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" | ||
|
@@ -1014,6 +1019,11 @@ delayed-stream@~1.0.0: | |
resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" | ||
integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk= | ||
|
||
denque@^1.1.0: | ||
version "1.4.1" | ||
resolved "https://registry.yarnpkg.com/denque/-/denque-1.4.1.tgz#6744ff7641c148c3f8a69c307e51235c1f4a37cf" | ||
integrity sha512-OfzPuSZKGcgr96rf1oODnfjqBFmr1DVoc/TrItj3Ohe0Ah1C5WX5Baquw/9U9KovnQ88EqmJbD66rKYUQYN1tQ== | ||
|
||
detect-file@^1.0.0: | ||
version "1.0.0" | ||
resolved "https://registry.yarnpkg.com/detect-file/-/detect-file-1.0.0.tgz#f0d66d03672a825cb1b73bdb3fe62310c8e552b7" | ||
|
@@ -1979,6 +1989,21 @@ invert-kv@^1.0.0: | |
resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-1.0.0.tgz#104a8e4aaca6d3d8cd157a8ef8bfab2d7a3ffdb6" | ||
integrity sha1-EEqOSqym09jNFXqO+L+rLXo//bY= | ||
|
||
ioredis@^4.14.1: | ||
version "4.14.1" | ||
resolved "https://registry.yarnpkg.com/ioredis/-/ioredis-4.14.1.tgz#b73ded95fcf220f106d33125a92ef6213aa31318" | ||
integrity sha512-94W+X//GHM+1GJvDk6JPc+8qlM7Dul+9K+lg3/aHixPN7ZGkW6qlvX0DG6At9hWtH2v3B32myfZqWoANUJYGJA== | ||
dependencies: | ||
cluster-key-slot "^1.1.0" | ||
debug "^4.1.1" | ||
denque "^1.1.0" | ||
lodash.defaults "^4.2.0" | ||
lodash.flatten "^4.4.0" | ||
redis-commands "1.5.0" | ||
redis-errors "^1.2.0" | ||
redis-parser "^3.0.0" | ||
standard-as-callback "^2.0.1" | ||
|
||
is-absolute@^1.0.0: | ||
version "1.0.0" | ||
resolved "https://registry.yarnpkg.com/is-absolute/-/is-absolute-1.0.0.tgz#395e1ae84b11f26ad1795e73c17378e48a301576" | ||
|
@@ -2378,11 +2403,21 @@ lodash.camelcase@^4.3.0: | |
resolved "https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6" | ||
integrity sha1-soqmKIorn8ZRA1x3EfZathkDMaY= | ||
|
||
lodash.defaults@^4.2.0: | ||
version "4.2.0" | ||
resolved "https://registry.yarnpkg.com/lodash.defaults/-/lodash.defaults-4.2.0.tgz#d09178716ffea4dde9e5fb7b37f6f0802274580c" | ||
integrity sha1-0JF4cW/+pN3p5ft7N/bwgCJ0WAw= | ||
|
||
lodash.defaultsdeep@^4.6.1: | ||
version "4.6.1" | ||
resolved "https://registry.yarnpkg.com/lodash.defaultsdeep/-/lodash.defaultsdeep-4.6.1.tgz#512e9bd721d272d94e3d3a63653fa17516741ca6" | ||
integrity sha512-3j8wdDzYuWO3lM3Reg03MuQR957t287Rpcxp1njpEa8oDrikb+FwGdW3n+FELh/A6qib6yPit0j/pv9G/yeAqA== | ||
|
||
lodash.flatten@^4.4.0: | ||
version "4.4.0" | ||
resolved "https://registry.yarnpkg.com/lodash.flatten/-/lodash.flatten-4.4.0.tgz#f31c22225a9632d2bbf8e4addbef240aa765a61f" | ||
integrity sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8= | ||
|
||
lodash.get@^4.4.2: | ||
version "4.4.2" | ||
resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99" | ||
|
@@ -3264,6 +3299,23 @@ rechoir@^0.6.2: | |
dependencies: | ||
resolve "^1.1.6" | ||
|
||
[email protected]: | ||
version "1.5.0" | ||
resolved "https://registry.yarnpkg.com/redis-commands/-/redis-commands-1.5.0.tgz#80d2e20698fe688f227127ff9e5164a7dd17e785" | ||
integrity sha512-6KxamqpZ468MeQC3bkWmCB1fp56XL64D4Kf0zJSwDZbVLLm7KFkoIcHrgRvQ+sk8dnhySs7+yBg94yIkAK7aJg== | ||
|
||
redis-errors@^1.0.0, redis-errors@^1.2.0: | ||
version "1.2.0" | ||
resolved "https://registry.yarnpkg.com/redis-errors/-/redis-errors-1.2.0.tgz#eb62d2adb15e4eaf4610c04afe1529384250abad" | ||
integrity sha1-62LSrbFeTq9GEMBK/hUpOEJQq60= | ||
|
||
redis-parser@^3.0.0: | ||
version "3.0.0" | ||
resolved "https://registry.yarnpkg.com/redis-parser/-/redis-parser-3.0.0.tgz#b66d828cdcafe6b4b8a428a7def4c6bcac31c8b4" | ||
integrity sha1-tm2CjNyv5rS4pCin3vTGvKwxyLQ= | ||
dependencies: | ||
redis-errors "^1.0.0" | ||
|
||
regex-not@^1.0.0, regex-not@^1.0.2: | ||
version "1.0.2" | ||
resolved "https://registry.yarnpkg.com/regex-not/-/regex-not-1.0.2.tgz#1f4ece27e00b0b65e0247a6810e6a85d83a5752c" | ||
|
@@ -3681,6 +3733,11 @@ sshpk@^1.7.0: | |
safer-buffer "^2.0.2" | ||
tweetnacl "~0.14.0" | ||
|
||
standard-as-callback@^2.0.1: | ||
version "2.0.1" | ||
resolved "https://registry.yarnpkg.com/standard-as-callback/-/standard-as-callback-2.0.1.tgz#ed8bb25648e15831759b6023bdb87e6b60b38126" | ||
integrity sha512-NQOxSeB8gOI5WjSaxjBgog2QFw55FV8TkS6Y07BiB3VJ8xNTvUYm0wl0s8ObgQ5NhdpnNfigMIKjgPESzgr4tg== | ||
|
||
static-extend@^0.1.1: | ||
version "0.1.2" | ||
resolved "https://registry.yarnpkg.com/static-extend/-/static-extend-0.1.2.tgz#60809c39cbff55337226fd5e0b520f341f1fb5c6" | ||
|