From a608b95414ed7952137c86cd8cae4531a9b57650 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Mon, 19 Feb 2018 10:46:04 +0200 Subject: [PATCH] MXS-1656: Add simple test case Test that `list servers` works with both monitored and unmonitored servers. The test doesn't check that the GTID is present as the test setup uses file and position based replication. --- maxctrl/test/diagnostics.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/maxctrl/test/diagnostics.js b/maxctrl/test/diagnostics.js index 1e756105b..dc2822e92 100644 --- a/maxctrl/test/diagnostics.js +++ b/maxctrl/test/diagnostics.js @@ -33,3 +33,34 @@ describe("Diagnostic Commands", function() { after(stopMaxScale) }); + +describe("MXS-1656: `list servers` with GTIDs", function() { + before(startMaxScale) + + doCheck = function() { + return doCommand('list servers --tsv') + .then((res) => { + // Check that at least 5 columns are returned with the last column consisting of + // empty strings. This is because the test setup uses file and position based + // replication. + res = res.split('\n').map(i => i.split('\t')).map(i => i[5]) + _.uniq(res).should.deep.equal(['']) + }) + } + + it('Lists monitored servers', function() { + return doCheck() + }); + + it('Lists unmonitored servers', function() { + return doCommand('unlink monitor MariaDB-Monitor server1 server2 server3 server4') + .then(() => doCheck()) + }); + + it('Lists partially monitored servers', function() { + return doCommand('link monitor MariaDB-Monitor server1 server3') + .then(() => doCheck()) + }); + + after(stopMaxScale) +});