|
|
|
@ -41,13 +41,9 @@ var grpc = require('../'); |
|
|
|
|
|
|
|
|
|
describe('Health Checking', function() { |
|
|
|
|
var statusMap = { |
|
|
|
|
'': { |
|
|
|
|
'': 'SERVING', |
|
|
|
|
'grpc.test.TestService': 'NOT_SERVING', |
|
|
|
|
}, |
|
|
|
|
virtual_host: { |
|
|
|
|
'grpc.test.TestService': 'SERVING' |
|
|
|
|
} |
|
|
|
|
'': 'SERVING', |
|
|
|
|
'grpc.test.TestServiceNotServing': 'NOT_SERVING', |
|
|
|
|
'grpc.test.TestServiceServing': 'SERVING' |
|
|
|
|
}; |
|
|
|
|
var healthServer = new grpc.Server(); |
|
|
|
|
healthServer.addProtoService(health.service, |
|
|
|
@ -71,15 +67,15 @@ describe('Health Checking', function() { |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
it('should say that a disabled service is NOT_SERVING', function(done) { |
|
|
|
|
healthClient.check({service: 'grpc.test.TestService'}, |
|
|
|
|
healthClient.check({service: 'grpc.test.TestServiceNotServing'}, |
|
|
|
|
function(err, response) { |
|
|
|
|
assert.ifError(err); |
|
|
|
|
assert.strictEqual(response.status, 'NOT_SERVING'); |
|
|
|
|
done(); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
it('should say that a service on another host is SERVING', function(done) { |
|
|
|
|
healthClient.check({host: 'virtual_host', service: 'grpc.test.TestService'}, |
|
|
|
|
it('should say that an enabled service is SERVING', function(done) { |
|
|
|
|
healthClient.check({service: 'grpc.test.TestServiceServing'}, |
|
|
|
|
function(err, response) { |
|
|
|
|
assert.ifError(err); |
|
|
|
|
assert.strictEqual(response.status, 'SERVING'); |
|
|
|
@ -93,12 +89,4 @@ describe('Health Checking', function() { |
|
|
|
|
done(); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
it('should get NOT_FOUND if the host is not registered', function(done) { |
|
|
|
|
healthClient.check({host: 'wrong_host', service: 'grpc.test.TestService'}, |
|
|
|
|
function(err, response) { |
|
|
|
|
assert(err); |
|
|
|
|
assert.strictEqual(err.code, grpc.status.NOT_FOUND); |
|
|
|
|
done(); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|