MXS-2196: Fix most NPM unit test failures
The REST API and MaxCtrl tests relied upon the implicit sessions that were created by the listeners. This can be corrected and improved by creating an actual connection to MaxScale to check that a client session is indeed created.
This commit is contained in:
@ -24,7 +24,7 @@ var tests = [
|
|||||||
'show server server1',
|
'show server server1',
|
||||||
'show service RW-Split-Router',
|
'show service RW-Split-Router',
|
||||||
'show monitor MariaDB-Monitor',
|
'show monitor MariaDB-Monitor',
|
||||||
'show session 5',
|
'show sessions',
|
||||||
'show filter Hint',
|
'show filter Hint',
|
||||||
'show module readwritesplit',
|
'show module readwritesplit',
|
||||||
'show maxscale',
|
'show maxscale',
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
"ajv": "^5.5.2",
|
"ajv": "^5.5.2",
|
||||||
"chai": "^3.5.0",
|
"chai": "^3.5.0",
|
||||||
"chai-as-promised": "^6.0.0",
|
"chai-as-promised": "^6.0.0",
|
||||||
|
"mariadb": "^2.0.1-beta",
|
||||||
"mocha": "^5.2.0",
|
"mocha": "^5.2.0",
|
||||||
"request": "^2.87.0",
|
"request": "^2.87.0",
|
||||||
"request-promise-native": "^1.0.5"
|
"request-promise-native": "^1.0.5"
|
||||||
|
@ -1,6 +1,20 @@
|
|||||||
// These tests use the server/test/maxscale_test.cnf configuration
|
// These tests use the server/test/maxscale_test.cnf configuration
|
||||||
|
|
||||||
require("../utils.js")()
|
require("../utils.js")()
|
||||||
|
const mariadb = require('mariadb');
|
||||||
|
var conn
|
||||||
|
|
||||||
|
function createConnection() {
|
||||||
|
return mariadb.createConnection({host: '127.0.0.1', port: 4006, user: 'maxuser', password: 'maxpwd'})
|
||||||
|
.then(c => {
|
||||||
|
conn = c
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeConnection() {
|
||||||
|
conn.end()
|
||||||
|
conn = null
|
||||||
|
}
|
||||||
|
|
||||||
describe("Resource Collections", function() {
|
describe("Resource Collections", function() {
|
||||||
before(startMaxScale)
|
before(startMaxScale)
|
||||||
@ -36,6 +50,7 @@ describe("Resource Collections", function() {
|
|||||||
|
|
||||||
describe("Individual Resources", function() {
|
describe("Individual Resources", function() {
|
||||||
before(startMaxScale)
|
before(startMaxScale)
|
||||||
|
before(createConnection)
|
||||||
|
|
||||||
var tests = [
|
var tests = [
|
||||||
"/servers/server1",
|
"/servers/server1",
|
||||||
@ -63,11 +78,13 @@ describe("Individual Resources", function() {
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
|
after(closeConnection)
|
||||||
after(stopMaxScale)
|
after(stopMaxScale)
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("Resource Self Links", function() {
|
describe("Resource Self Links", function() {
|
||||||
before(startMaxScale)
|
before(startMaxScale)
|
||||||
|
before(createConnection)
|
||||||
|
|
||||||
var tests = [
|
var tests = [
|
||||||
"/servers",
|
"/servers",
|
||||||
@ -108,5 +125,6 @@ describe("Resource Self Links", function() {
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
|
after(closeConnection)
|
||||||
after(stopMaxScale)
|
after(stopMaxScale)
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user