Add forced maintenance mode tests

Tested that the force option works and is accepted.
This commit is contained in:
Markus Mäkelä 2019-04-09 10:00:50 +03:00
parent 0932d10169
commit 9a5b60a071
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19
2 changed files with 26 additions and 0 deletions

View File

@ -22,6 +22,20 @@ describe("Set/Clear Commands", function() {
})
})
it('force maintenance mode', function() {
return verifyCommand('set server server1 maintenance --force', 'servers/server1')
.then(function(res) {
res.data.attributes.state.should.match(/Maintenance/)
})
})
it('clear maintenance mode', function() {
return verifyCommand('clear server server1 maintenance', 'servers/server1')
.then(function(res) {
res.data.attributes.state.should.not.match(/Maintenance/)
})
})
it('reject set incorrect state', function() {
return doCommand('set server server2 something')
.should.be.rejected

View File

@ -156,6 +156,18 @@ describe("Server State", function() {
})
});
it("force server into maintenance", function() {
return request.put(base_url + "/servers/" + server.data.id + "/set?state=maintenance&force=yes")
.then(function(resp) {
return request.get(base_url + "/servers/" + server.data.id)
})
.then(function(resp) {
var srv = JSON.parse(resp)
srv.data.attributes.state.should.match(/Maintenance/)
srv.data.attributes.statistics.connections.should.be.equal(0)
})
});
it("clear maintenance", function() {
return request.put(base_url + "/servers/" + server.data.id + "/clear?state=maintenance")
.then(function(resp) {