53 Commits

Author SHA1 Message Date
Markus Mäkelä
0cd00e888e
MXS-2349: Add socket support for maxctrl
A server can now be created with a socket.
2019-04-16 11:52:37 +03:00
Markus Mäkelä
c643f9bc8d
Merge branch '2.3' into develop 2019-04-12 13:23:49 +03:00
Markus Mäkelä
bc5f9da6c4
Add classification test case
Also removed the dead code that was never used to get coverage to 100%.
2019-04-09 10:56:38 +03:00
Markus Mäkelä
9a5b60a071
Add forced maintenance mode tests
Tested that the force option works and is accepted.
2019-04-09 10:00:50 +03:00
Markus Mäkelä
66f850d77d
MXS-1951: Fix maxctrl cluster tests
The fact that two MaxScale processes can bind to the same port is now
possible due to the use of SO_REUSEPORT. As this is doable only with a
very deliberate setup, it is unlikely to be a practical problem in most
cases. Regardless, the test needs to be fixed to accept multiple MaxScales
bound to the same port.
2019-03-28 16:34:12 +02:00
Markus Mäkelä
4b8393b2ee
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.
2018-12-04 11:50:43 +02:00
Markus Mäkelä
47d2898818
MXS-2121: Allow destruction of static listeners
If a listener is defined in a static configuration file, it can now be
destroyed at runtime. If MaxScale is restarted, the listener will be
created again unless the configuration file is modified.
2018-10-31 09:53:49 +02:00
Markus Mäkelä
8cfc966561
MXS-1929: Update unit tests with monitor changes
The user is a mandatory parameter and needs to be passed when a monitor is
created.
2018-08-23 15:46:47 +03:00
Markus Mäkelä
73401837fd
Skip interactive mode in tests
The automated tests aren't currently suited for testing it.
2018-08-22 16:43:17 +03:00
Markus Mäkelä
57471c7baa
Improve MaxCtrl test coverage
A few missing cases that simple to solve were reported by the coverage
tool.
2018-08-13 10:28:03 +03:00
Markus Mäkelä
390c749d4a
Test runtime size validation
Added tests into the MaxCtrl test suite that confirm size types are
properly handled.
2018-08-10 09:50:56 +03:00
Markus Mäkelä
f6cd8b6454
Fill the gaps in MaxCtrl testing
The MaxCtrl test suite now covers most of the code that can be tested
within reasonable limits. Also removed some dead code in `list servers`.
2018-08-09 12:56:53 +03:00
Markus Mäkelä
50c20e79ee
MXS-1929: Reject promise on invalid input
If a value that is not of key-value format was given to the create
commands, the code previously threw an exception. This causes tests to
misbehave so changing it to a rejected promise is more appropriate.
2018-08-09 12:56:52 +03:00
Markus Mäkelä
ccdf1c5679
Improve MaxCtrl test coverage
Added tests that cover areas that weren't tested before.
2018-08-09 12:56:51 +03:00
Markus Mäkelä
1447ac2eb9
Fix MaxCtrl cluster tests
The configuration used an invalid parameter name which caused the two
MaxScales to use the same directory for persisted configurations.

The test also tried to sync with the wrong server causing the same
listener to be created twice on the same port but on different MaxScales.

Cleaned up the startup and shutdown scripts to always start from a clean
state.
2018-08-09 12:56:51 +03:00
Markus Mäkelä
679ab6a0e9
Remove printing to console in test
The test case, for whatever reason, printed data to the console.
2018-08-09 12:56:49 +03:00
Markus Mäkelä
5de91e737d
MXS-1929: Extend create/destroy MaxCtrl tests
Added creation and destruction tests for services and filters. They don't
cover the assignment of filters to services as that is not yet
implemented.
2018-07-31 09:41:10 +03:00
Markus Mäkelä
f1905d33b1
Fix MaxCtrl list servers test
The test did not expect GTIDs to be displayed.
2018-07-09 12:10:36 +03:00
Markus Mäkelä
fff727e0c2
MXS-1782: Take getCollectionAsResource into use
Each `show` type command that takes a resource name now also has a version
that prints all resources of that type.

Added test cases for newly added commands.
2018-04-17 09:43:57 +03:00
Markus Mäkelä
a608b95414
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.
2018-02-20 09:59:05 +02:00
Markus Mäkelä
ccebf38bc0 Update test configuration files
Updated the REST API and MaxCtrl configuration files with new object
names. Updated tests with new object names.
2018-01-22 15:29:21 +02:00
Markus Mäkelä
938484a73e Allow remote server to be used for maxctrl test suite
The test suite now works with remote servers and is now fully integrated
to the regression test suite.
2017-10-12 13:16:12 +03:00
Markus Mäkelä
13265876a9 Add MaxCtrl test for start/stop maxscale
Added the missing test case for starting and stopping MaxScale.
2017-10-09 13:12:30 +03:00
Markus Mäkelä
d2b474e021 Fix enabled admin users being shown as basic users
The enabled admins for the Linux users were shown as basic users. This was
caused by the separation of the two admin types.

Added tests that check that enabled Linux accounts show the correct type
in the output.
2017-09-11 12:49:11 +03:00
Markus Mäkelä
6ee7ed6a38 MXS-1354: Add creation of basic/admin users to maxctrl
The type of the created user can now be specified with the --type option.

Expanded tests that cover the user creation. Also added a test case that
checks that basic users are only allowed to read through the REST API.
2017-08-18 10:28:21 +03:00
Markus Mäkelä
80569dd5a9 MXS-1300: Correct test case descriptions
The test descriptions now describe the expected logical outcome of the
test, not the operation being done.
2017-08-09 11:39:25 +03:00
Markus Mäkelä
d64cb9fa80 MXS-1300: Test calling of module commands via MaxCtrl
The calling of module commands is tested by using the qlafilter log
command.
2017-08-09 11:39:25 +03:00
Markus Mäkelä
c2a2688b93 Fix duplicate listener checks
Only the protocol, port and address of the listener were used to check if
a listener exists. The check should also use the name of the listener to
be sure that each name is unique.

Expanded tests to check that the creation of duplicate listeners is
detected. Did minor improvements to related test code.
2017-08-09 11:39:25 +03:00
Markus Mäkelä
c593a1bf32 MXS-1300: Test cluster diff functionality
The `cluster diff` command is now tested by doing add/alter/remove
operations on servers. As the same methods are used for all objects, they
should detect all sorts of modifications between two Maxscales.
2017-08-09 11:39:25 +03:00
Markus Mäkelä
f422e92496 MXS-1300: Return output instead of printing it
The `execute` command now returns the output of the command instead of
printint it. This allows the tests to actually test the output of the
commands instead manually verifying that it is correct. It also allows the
library part to be used as an actual library that only returns data.
2017-08-09 11:39:25 +03:00
Markus Mäkelä
9a04dd0311 MXS-1300: Resolved the promise for help commands
The promise returned by the `execute` MaxCtrl library function is now
properly resolved also for `help` type commands.
2017-08-09 11:39:24 +03:00
Markus Mäkelä
0ab7df88dc MXS-1300: Fix MaxCtrl cluster sync test for listeners
The test is not very useful for a locally hosted setup as both MaxScales
can't bind to the same port.
2017-08-09 11:39:24 +03:00
Markus Mäkelä
8f7be8a4f3 MXS-1300: Fix MaxCtrl cluster tests
Fixed tests to use correct functions, extended tests of problematic
cases. Added a secondary directory for the second MaxScale instance.
2017-08-09 11:39:24 +03:00
Markus Mäkelä
e133e758a6 MXS-1300: Fix deletion of monitors
The monitors should only be reused if they have the same name and they use
the same module. This way the only difference is in configuration.

Fixed MaxCtrl detection of bad options and altered monitor creation test
to expect correct results. Also improved some of the error messages.
2017-08-09 11:39:24 +03:00
Markus Mäkelä
161776d576 MXS-1300: Add more MaxCtrl cluster tests
Added scripts that start two MaxScale on the same machine. This allows the
cluster synchronization commands to be tested locally.
2017-08-09 11:39:24 +03:00
Markus Mäkelä
10bfa072d9 MXS-1300: Add test for cluster command internals
The test tests the internals of the cluster diff generation
algorithms. This should guarantee that the diff calculation and the
resulting synchronization will work as expected without having to test it
on a live cluster.
2017-08-09 11:39:24 +03:00
Markus Mäkelä
ba5a321ec3 MXS-1300: Improve overall error handling
All errors are now returned as rejected Promises. This will make the error
reporting more consistent with the tested output as well as the actual
output.

Added more tests for error cases and fixed minor argument processing bugs.
2017-07-23 08:21:00 +03:00
Markus Mäkelä
c9f3d014d6 MXS-1300: Improve test coverage
The tests now cover 100% of all source files with the exception of the
call.js and common.js source files.
2017-07-23 08:21:00 +03:00
Markus Mäkelä
e76dc80e47 MXS-1300: Reorganize and refactor tests
The tests are now sorted by command type. This allows for more consistent
test creation as tests can be done per source code file instead of per
object type.

Added helper functions for common testing operations. The two main ones
are doCommand, which executes a MaxCtrl command and returns a result, and
verifyCommand, that executes a command and verifies the result via the
REST API.
2017-07-23 08:21:00 +03:00
Markus Mäkelä
cf8028a5ce MXS-1300: Un-modularize the core
Making the core a module proved to bring more problems than it solved. For
the sake of simplicity in installation and code coverage reporting, the
core is now completely contained in the `lib/` directory.

Also added preliminary coverage reporting with nyc.
2017-07-23 08:21:00 +03:00
Markus Mäkelä
0f1a427458 MXS-1300: Add monitor test to MaxCtrl
The test runts tests on the commands that interact with monitors.
2017-07-23 08:21:00 +03:00
Markus Mäkelä
fa6bea33fe MXS-1300: Fix monitor and listener creation
The creation commands for monitors and listeners referred to undefined
variables. Also fixed the test case names being duplicated.
2017-07-23 08:21:00 +03:00
Markus Mäkelä
2411288388 MXS-1300: Add service test for MaxCtrl
The test goes through the commands that affect services.
2017-07-23 08:21:00 +03:00
Markus Mäkelä
d1bee274fa MXS-1300: Add MaxCtrl server tests
The test creates, destroys and alters servers with both valid and invalid
parameters.
2017-07-18 11:37:18 +03:00
Markus Mäkelä
9e688772cc MXS-1300: Make the MaxCtrl core a Node.js module
The core is now a module that is loaded by the command line client. This
allows the core library to be reused for testing.
2017-07-18 11:37:18 +03:00
Markus Mäkelä
aabbf64991 MXS-1300: Add server state manipulation test
The test sets and clears server states and verifies it via the REST
API. It also checks that only correct arguments are accepted.
2017-07-18 11:37:18 +03:00
Markus Mäkelä
738dc48df7 MXS-1300: Add basic maxctrl tests
Added basic tests for maxctrl. They simply test that the diagnostic
commands work.
2017-07-18 11:37:18 +03:00
Markus Mäkelä
01fa1a827a MXS-1300: Move the REST API tests back into the core
As the REST API is a part of the core, it is more appropriate for the
tests to reside there as well. Further refactoring of the testing needs to
be done to allow multiple components to use the same framework but with
different tests.
2017-07-18 11:37:18 +03:00
Markus Mäkelä
d3f45f0e0e MXS-1300: Speed up REST API testing
The MariaDB servers are now started first. This will give them time to
prepare while other parts of the tests are being prepared.
2017-07-18 11:37:18 +03:00
Markus Mäkelä
4dcefed974 MXS-1300: Fix test server creation
Before creating the users, the master will do a RESET MASTER to remove the
automatically generated binlogs. The servers should now start a lot faster
since they no longer need to replicate the large amounts of data that were
in these generated binlogs.
2017-07-18 11:37:18 +03:00