You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
Test starting redis without services
This commit is contained in:
@@ -18,9 +18,9 @@ shallow_clone: true
|
|||||||
install:
|
install:
|
||||||
# Install the Redis
|
# Install the Redis
|
||||||
- nuget install redis-64 -excludeversion
|
- nuget install redis-64 -excludeversion
|
||||||
- redis-64\tools\redis-server.exe --service-install
|
# - redis-64\tools\redis-server.exe --service-install
|
||||||
- redis-64\tools\redis-server.exe --service-start
|
# - redis-64\tools\redis-server.exe --service-start
|
||||||
- '@ECHO Redis Started'
|
- '@ECHO Redis installed'
|
||||||
# Get the latest stable version of Node 0.STABLE.latest
|
# Get the latest stable version of Node 0.STABLE.latest
|
||||||
- ps: Install-Product node $env:nodejs_version
|
- ps: Install-Product node $env:nodejs_version
|
||||||
# Typical npm stuff. Use msvs 2013 for the hiredis parser
|
# Typical npm stuff. Use msvs 2013 for the hiredis parser
|
||||||
|
@@ -16,10 +16,12 @@ function startRedis (conf, done, port) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
before(function (done) {
|
before(function (done) {
|
||||||
|
this.timeout(25000);
|
||||||
startRedis('./conf/redis.conf', done);
|
startRedis('./conf/redis.conf', done);
|
||||||
});
|
});
|
||||||
|
|
||||||
after(function (done) {
|
after(function (done) {
|
||||||
|
this.timeout(25000);
|
||||||
if (rp) rp.stop(done);
|
if (rp) rp.stop(done);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -47,16 +47,10 @@ function waitForRedis (available, cb, port) {
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
start: function (done, conf, port) {
|
start: function (done, conf, port) {
|
||||||
var spawnFailed = false;
|
|
||||||
// spawn redis with our testing configuration.
|
// spawn redis with our testing configuration.
|
||||||
var confFile = conf || path.resolve(__dirname, '../conf/redis.conf');
|
var confFile = conf || path.resolve(__dirname, '../conf/redis.conf');
|
||||||
var rp = spawn('redis-server', [confFile], {});
|
var redis = process.platform === 'win32' ? 'redis-64\\tools\\redis-server.exe' : 'redis-server';
|
||||||
|
var rp = spawn.sync(redis, [confFile], { stdio: 'inherit' });
|
||||||
// capture a failure booting redis, and give
|
|
||||||
// the user running the test some directions.
|
|
||||||
rp.once('exit', function (code) {
|
|
||||||
if (code !== 0) spawnFailed = true;
|
|
||||||
});
|
|
||||||
|
|
||||||
// wait for redis to become available, by
|
// wait for redis to become available, by
|
||||||
// checking the port we bind on.
|
// checking the port we bind on.
|
||||||
@@ -65,10 +59,9 @@ module.exports = {
|
|||||||
// an after() block to shutdown redis.
|
// an after() block to shutdown redis.
|
||||||
return done(null, {
|
return done(null, {
|
||||||
spawnFailed: function () {
|
spawnFailed: function () {
|
||||||
return spawnFailed;
|
return false;
|
||||||
},
|
},
|
||||||
stop: function (done) {
|
stop: function (done) {
|
||||||
if (spawnFailed) return done();
|
|
||||||
rp.once('exit', function (code) {
|
rp.once('exit', function (code) {
|
||||||
var error = null;
|
var error = null;
|
||||||
if (code !== null && code !== 0) {
|
if (code !== null && code !== 0) {
|
||||||
|
Reference in New Issue
Block a user