68 Commits

Author SHA1 Message Date
Markus Mäkelä
f013d3ccd9
MXS-3013: Add reload endpoint for services
The endpoint reloads the database users. This can also be used in the
future to refresh encrypted credentials when they are no longer loaded
every time an encrypted password is used.
2020-06-01 12:26:29 +03:00
Markus Mäkelä
f5b61e169b
Update npm packages
Updated packages due to npm audit warnings.
2020-03-16 11:32:43 +02:00
Markus Mäkelä
5b3c0b8b81
Merge branch '2.3' into 2.4 2019-07-16 13:17:35 +03:00
Markus Mäkelä
c878d796be
Merge branch '2.2' into 2.3 2019-07-16 12:59:03 +03:00
Markus Mäkelä
797069df52
Fix npm audit warnings
Updated lodash to a newer version.
2019-07-16 09:34:15 +03:00
Markus Mäkelä
ddf004b733
MXS-2349: Extend REST API tests
Added tests to the REST API that make sure the `socket` parameter works.
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ä
9a5b60a071
Add forced maintenance mode tests
Tested that the force option works and is accepted.
2019-04-09 10:00:50 +03:00
Johan Wikman
ea6ffe2371 MXS-2363 Add REST-API test 2019-03-29 11:31:35 +02:00
Esa Korhonen
afe41c38ed Merge branch '2.3' into develop 2019-02-20 10:33:14 +02:00
Markus Mäkelä
49c6244245
Update MaxCtrl and REST API dependencies 2019-02-13 13:54:56 +02:00
Markus Mäkelä
f0f9c21d1c
Merge branch '2.3' into develop 2019-01-07 10:54:42 +02:00
Markus Mäkelä
ee98900685
MXS-2200: Extend REST API tests
Added test cases for static and unknown global parameters.
2019-01-03 09:37:59 +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ä
e73301ad71
Update NPM packages
Updated packages for MaxCtrl and the REST API tests.
2018-09-26 11:08:24 +03:00
Markus Mäkelä
40c4614ed1
Update mocha
Updated mocha to latest version for maxctrl and REST API test suites.
2018-09-19 20:32:39 +03: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ä
3bbf58ad1f
Update MaxCtrl packages
Updated needed and pruned unneeded dependencies from maxctrl. Also updated
the packages in the REST API test suite.
2018-08-13 10:28:03 +03:00
Markus Mäkelä
6661680c4e
MXS-1929: Add direct filter relationship updates
The filters of a service can now be directly updated via the relationships
endpoint.
2018-08-10 09:53:33 +03:00
Markus Mäkelä
6e481a0f95
Fix REST API tests
The tests expected results that weren't correct.
2018-08-09 12:56:49 +03:00
Markus Mäkelä
bb1efd1b34
Merge branch '2.2' into develop 2018-08-07 22:20:27 +03:00
Markus Mäkelä
446116a8bb
MXS-1999: Fix removal of undefined relationships
If a relationship isn't defined, it should not be removed. Only if a
relationship is change to a null relationship, should it be removed.

Also fixed the maxctrl test suite to verify that both it and the REST API
tests pass.
2018-08-07 22:14:33 +03:00
Markus Mäkelä
4fd4d6bb01
MXS-1999: Fix null relationship handling
The data of the relationship should be set to null to delete the
relationship. Conceptually it is different from setting it to an empty
relationship but in practice both lead to the same end result.

Updated tests to use correct relationships and added test cases for
detection of invalid relationships.
2018-08-07 22:14:32 +03:00
Markus Mäkelä
d8b539c85a
MXS-1929: Add REST API filter test
Most parts of the test still fail due to the fact that they haven't been
implemented.
2018-07-31 09:41:05 +03:00
Markus Mäkelä
1475b22eac
Upgrade REST-API npm packages
Upgraded packages to more recent versions.
2018-06-13 10:07:37 +03: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ä
cd9a84d762 Add tests for direct relationship updating
The tests check that direct updates to the relationships endpoints work.
2017-10-23 19:37:24 +03:00
Markus Mäkelä
7111724851 Fix REST API monitor relationship test
The test did not properly move the relationships from the old monitor to
the new one. The test to passed as the relationship modification was not
really tested.
2017-10-23 19:37:24 +03:00
Markus Mäkelä
b7b50959ac Update REST API tests
Extended the relationship checks in the REST API tests to actually verify
that the returned objects represent what is expected.
2017-10-23 19:37:24 +03:00
Markus Mäkelä
d371ecb30f Only remove explicitly deleted relationships
Only when a relationship is defined as a null JSON value, it should be
deleted. If it is missing, it should be ignored.
2017-10-23 19:37:24 +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ä
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ä
1308e7a304 Fix resource collection modification times
The resource collection modification times weren't updated when an
individual resource was updated. By tracking back the path of a resource
and updating the modification times, all nodes in the path will get the
correct modification time.
2017-08-09 11:39:24 +03:00
Markus Mäkelä
090de1a0f7 MXS-1220: Make individual listeners resources
The listeners are now a proper sub-resource of the service resource. This
means that it acts like a normal resource and can be queried both as a
collection of resources and as an individual resource.
2017-07-23 08:21:00 +03:00
Markus Mäkelä
67b2654f50 Move REST API test scripts into a common directory
Moved and renamed the starting and stopping scripts from the REST API
tests to a common directory. This way the MaxCtrl tests can use the same
scripts to start and stop MaxScale.

Also moved the test configuration file into the `test/` directory and
changed some of the default directory locations.
2017-07-18 11:37:18 +03:00
Markus Mäkelä
173a97ae70 Refactor REST API test script into a npm test framework
The script can now be used to run an arbitrary set of Node.js tests as
long as they define the `test` npm target. Refactored REST API tests to
fit into this framework.
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ä
d59d3ab638 MXS-1300: Combine REST API and MaxCtrl tests
The REST API tests are now located under the maxctrl directory. This
allows both tests to use the same framework for testing.
2017-07-18 11:37:18 +03:00
Markus Mäkelä
731d19ba70 MXS-1220: Add test for monitor alteration regression
Altering monitor parameters without defining the relationships was
interpreted as an attempt to remove all relationships. This test
reproduces the problem.
2017-07-10 22:23:48 +03:00
Markus Mäkelä
c7b9b7ac4a MXS-1220: Unify resource member naming
All resoures now use the `state` member to describe their internal
state. This includes servers, services and monitors. This means that the
`status` keyword can be reserved for something else and it can be removed
until it is needed again.

Changed the module maturity field to `maturity` to better describe its
purpose.
2017-07-10 22:23:45 +03:00
Markus Mäkelä
a8bfdac49c MXS-1220: Use PUT to set/clear server
The correct method for set/clear endpoints is PUT, not POST, as the
resource always ends up in the desired state, regardless of its current
state.
2017-07-10 22:23:45 +03:00
Markus Mäkelä
63d2eee0e3 MXS-1220: Add endpoint for set/clear of server status
The server status can now be manipulated via the REST API. Added tests for
the state manipulation. Fixed minor issues in related code.
2017-07-10 22:23:44 +03:00
Markus Mäkelä
e4a004097e MXS-1220: Add support for PATCH
The PATCH method should now be used instead the PUT method to update
resources.  As PUT request bodies should represent complete resources, the
use of PUT to update resources is no longer supported.

Altered tests to use PATCH instead of PUT for updating resources.
2017-06-05 13:37:08 +03:00
Markus Mäkelä
6b8b19b439 MXS-1220: Add PUT support for /maxscale/ resource
The /maxscale/ resource now supports PUT requests which modify core
parameters. As not all parameters can be changed at runtime, only
modifications to parameters that support runtime configuration are
allowed.
2017-05-24 15:05:11 +03:00
Markus Mäkelä
1067fd352c MXS-1220: Add creation and deletion of admin users
Admin users can now be created via the REST API. This allows remote
management of the administrative interface itself.
2017-05-24 15:05:11 +03:00
Markus Mäkelä
ead9059eeb MXS-1220: Add /users/ resource
The /users/ resource shows all user accounts that can be used with
MaxScale. This resource is further split into two resource collections,
/users/inet and /users/unix, which contain the network users and Linux
accounts respectively.
2017-05-24 15:05:10 +03:00
Markus Mäkelä
e3c4bd7f72 MXS-1220: Add more validation checks to request JSON
The requests that send a body should define at least a `data` member.

Added a simple test that checks that bad requests are rejected. This test
should be expanded to check that the returned error body contains the
correct members.
2017-05-24 15:05:10 +03:00
Markus Mäkelä
157b7f853b MXS-1220: Fix resource self links
The top level resource self links pointed to the collection instead of the
resource itself. The individual resoures now also have a links field that
contains the self link to the resource. This should make navigation of the
API easier as all objects have valid links in them.
2017-05-09 15:32:42 +03:00
Markus Mäkelä
778631a860 MXS-1220: Add support for conditional HTTP requests
The REST API now supports the If-Modified-Since, If-Unmodified-Since,
If-Match and If-None-Match headers and returns the correct response if the
conditional fails.

Added tests for the date parsing and expanded the HTTP header tests in the
REST API test suite.
2017-05-09 15:32:42 +03:00