Commit Graph

976 Commits

Author SHA1 Message Date
14f1bbed51 NamedServerFilter: Deprecate message for legacy parameter use 2018-01-15 15:30:38 +02:00
224f918845 MXS-1592 Make all modules lowercase
Make all modules lowercase and make module loading case
insensitive. Further, make command invocation case insensitive,
as far as the module name is conserned.
2018-01-03 14:57:18 +02:00
9689271a34 MXS-1541: Use session ID in topfilter
The topfilter now uses the session ID as the filename suffix.
2018-01-03 08:56:41 +02:00
cf29430476 Merge branch '2.1' into 2.2 2018-01-02 09:31:07 +02:00
95983ddaf4 Fix unit test failures
When the unit tests were run without installing the libraries in their
final locations, the loading of the modules would fail. Using locations
relative to the build directory allows unit testing without having to
install the libraries.
2017-12-29 10:09:16 +02:00
cf627203cb Fix issues revealed on CentOS6 2017-12-02 13:42:15 +02:00
481892b452 MXS-1512 Add test case for cache options
Here's now tested that the cache properly deals with the configuration
setting "cache_in_transactions" and the current transaction state.
2017-11-29 12:41:34 +02:00
b225eeff2c MXS-1512 Allow autocommit and trx state to be set for a session
When mocking you want to be able to set explicitly how a filter
session should see the current context.
2017-11-29 12:41:34 +02:00
02cf284b61 MXS-1512 Add mock Backend class that can generate resultsets 2017-11-29 12:41:34 +02:00
6d66ffe9f7 Use FilterModule::ConfigParameters in test_dbfwfilter 2017-11-29 12:41:34 +02:00
9aa4a2d1ff MXS-1512 Create parameters object from default parameters 2017-11-29 12:41:34 +02:00
7ae2acecf7 MXS-1512 Take module object type as template argument
Makes it possible to move the module object pointer into the
SpecificModule template.
2017-11-29 12:41:34 +02:00
e0818fdbeb Fix include path error 2017-11-23 12:55:24 +02:00
396b81f336 Fix in-source builds
The internal header directory conflicted with in-source builds causing a
build failure. This is fixed by renaming the internal header directory to
something other than maxscale.

The renaming pointed out a few problems in a couple of source files that
appeared to include internal headers when the headers were in fact public
headers.

Fixed maxctrl in-source builds by making the copying of the sources
optional.
2017-11-22 18:40:18 +02:00
c38fbd0b74 Move utility and mock classes to .../filter/test
The utility and mock classes created for the testing of dbfwfilter
will be used for testing certain aspects of the cache filter.
Consequently better to move them somewhere outside dbfwfilter.
Sofar they will be built separately for each filter.
2017-11-22 10:00:34 +02:00
bc7209c04e cache: Update test-program due to qc-changes
In 2.2 it is no longer possible to know where a particular column
appears. Hence the result when a column appears amongst the selected
columns and the where-clause must be the same.
2017-11-20 15:21:46 +02:00
fc8c25803a cache: Perform thread initialization in test program 2017-11-20 15:19:54 +02:00
cd89b976a9 cache: Fix iteration of rules
Incrementation of index ended up outside iteration block at
earlier refactoring.
2017-11-20 15:18:17 +02:00
604502e1cb MXS-1461 Template Module -> class Module + template SpecificModule 2017-11-20 13:14:02 +02:00
25e288b571 MXS-1461 Add firewall test cases 2017-11-20 13:14:02 +02:00
8abe5a659e MXS-1461 Allow user and host to be exluded in test cases 2017-11-20 13:14:02 +02:00
a596e1a77c MXS-1461 Move client data to Client
The user and host are now in Client.
2017-11-20 13:14:02 +02:00
083c3bcad7 MXS-1461 Rename Upstream to Client 2017-11-20 13:14:02 +02:00
a35a4c7e9f MXS-1461 Modify mock classes 2017-11-20 13:14:02 +02:00
8fba2a8049 MXS-1461 Add local firewall filter tests
Only two now, more to be added.
2017-11-20 13:14:02 +02:00
da989d636e MXS-1461 Add TempFile
Class for creating a temporary file.
2017-11-20 13:14:02 +02:00
edb271fa8e MXS-1461 Modify some mock-classes 2017-11-20 13:14:02 +02:00
843c9b0ce1 MXS-1461 Add mock Upstream class
Upstream can be used as the upstream filter of a filter to
be tested.
2017-11-20 13:14:02 +02:00
8aeb49cffa MXS-1461 Add FilterModule class 2017-11-20 13:14:02 +02:00
815da1b7ad MXS-1461 Add mock RouterSession 2017-11-20 13:14:02 +02:00
1edccba885 MXS-1461 Add mock Backend class 2017-11-20 13:14:02 +02:00
d2c80d2e91 MXS-1461 Add QueryClassifierModule 2017-11-20 13:14:02 +02:00
531a8bafbd MXS-1461 Add mock classes Session and Dcb 2017-11-20 13:14:02 +02:00
65cf491350 MXS-1461 Add general purpose mocking functions 2017-11-20 13:14:02 +02:00
e434c7ec66 MXS-1461 Add template Module
This is the first in a series of commits that introduce components
that allow filters to be tested without MaxScale or backends.
Obviously the environment is not suited for all cases, but allow e.g.
the behaviour of the firewall filter to be tested in isolation.

The environment consists of helper classes loading and manipulating
modules and filters and mock-classes that provide the needed
scaffolding around a filter.

Currently all components exist under the test directory of the firewall
filter, but once proven they can be moved to a more general purpose
location.
2017-11-20 13:14:02 +02:00
204fa17322 MXS-1519 Prevent "inheritance" of fw rules
By using an the value of a global incremented integer as the
initial version number of a Dbfw instance it is ensured that every
such instance does not "inherit" any rules from a previous instance
that happened to exist in the same place as the new instance to be
created.
2017-11-20 10:11:23 +02:00
decd5578bc MXS-1525 Check exact match first when checking host
Given a rule like

  ...
  users %@127.0.0.1 match any rules ...

the code started with %@127.0.0.%, which meant that the exact
match rule would be missed.
2017-11-16 14:09:28 +02:00
11a240cb15 MXS-1519 Use fw instance specific rules and users
The rules and users need to be distinct not only for each thread
but for each instance and thread.
2017-11-16 14:06:50 +02:00
032b2f3846 MXS-1333: QLAFilter, add option to log execution time
Adds an option 'reply_time' to log_data. When enabled, query execution time
in milliseconds is logged. Execution time is measured as the time between
routeQuery and the first clientReply.
2017-11-15 16:56:39 +02:00
9d686c4c41 MXS-1461 Create error message only when blocking
Only if the filter is in blocking mode, will a match cause an error
to be returned. Thus, no point in creating the error message unless
the filter is in blocking mode.
2017-11-14 13:03:07 +02:00
ea0f8978b2 MXS-1461 Update log messages of firewall rules
Whether or not a match causes the query to be blocked or to be allowed
depends on whether the filter is in white-listing or black-listing mode,
so better if the text is neutral.
2017-11-14 13:03:07 +02:00
3eba77f43e MXS-1461 Implement not_function
If the instance represents `not_function` then it is a match if the
used function is not found amongst the listed functions.
2017-11-14 13:03:07 +02:00
3993ece209 MXS-1461 Remove special handling for function + allow
No need for this when 'not_function' is available.
2017-11-14 13:03:07 +02:00
3215458b30 MXS-1461 Introduce 'not_function' rule
Using 'not_function' it is possible to match functions other than
a specific set of ones. That will make it significantly easier to
allow certain functions to be used with certain columns.

The special handling of no arguments to `function` in conjunction
with an allowing filter has been removed. The same effect can now
be achieved, without special handling, using `not_function`, no
arguments and a blocking filter.

Implementation will follow in a subsequent commit.
2017-11-14 13:03:07 +02:00
0131841787 Fix dbfwfilter and cachetester dependencies
The two depended on the PCRE2 and Connector-C libraries which means that
the libraries need to be built first. This information needs to be told to
CMake with the add_dependency call.
2017-11-05 19:24:56 +02:00
18bfc515e2 MXS-1474 Set correct default and fix typo 2017-10-31 15:09:54 +02:00
f52a0acbbe MXS-1474 Document and act in the same way
From the documentation:

   * `never`: When there is an active transaction, no data will be returned
     from the cache, but all requests will always be sent to the backend.
     The cache will be populated inside _explicitly_ read-only transactions.
     Inside transactions that are not explicitly read-only, the cache will
     be populated _until_ the first non-SELECT statement.
   * `read_only_transactions`: The cache will be used and populated inside
     _explicitly_ read-only transactions. Inside transactions that are not
     explicitly read-only, the cache will be populated, but not used
     _until_ the first non-SELECT statement.
   * `all_transactions`: The cache will be used and populated inside
     _explicitly_ read-only transactions. Inside transactions that are not
     explicitly read-only, the cache will be used and populated _until_ the
     first non-SELECT statement.
2017-10-31 10:58:03 +02:00
e45ee22ec3 MXS-1474 Refactor for forthcoming changes 2017-10-31 10:58:03 +02:00
93edc230f9 MXS-1474 Use enum instead of boolean
Clearer for the reader with an explicit value indicating the desired
action, instrad of a boolean whose meaning is implicit.
2017-10-31 10:58:03 +02:00
20bb825882 MXS-1474 Factor out functionality
More changes coming, so better to factor out the COM_QUERY handling.
2017-10-31 10:58:03 +02:00