From 9fae4ea25b71f9ebbd1253ebb481a038b567493a Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Sat, 17 Feb 2024 13:38:53 +0000 Subject: [PATCH] [Test] Working with bloody robot to add some new tests --- .../cases/120_fuzzy/encrypted-dyn1.robot | 14 ++++ .../cases/120_fuzzy/encrypted-dyn2.robot | 14 ++++ .../cases/120_fuzzy/encrypted.robot | 8 --- test/functional/cases/120_fuzzy/lib.robot | 27 +++++++- .../configs/fuzzy-encryption-key.conf | 2 +- test/functional/lib/vars.py | 64 +++++++++++++++++++ 6 files changed, 119 insertions(+), 10 deletions(-) create mode 100644 test/functional/cases/120_fuzzy/encrypted-dyn1.robot create mode 100644 test/functional/cases/120_fuzzy/encrypted-dyn2.robot diff --git a/test/functional/cases/120_fuzzy/encrypted-dyn1.robot b/test/functional/cases/120_fuzzy/encrypted-dyn1.robot new file mode 100644 index 000000000..dae74879f --- /dev/null +++ b/test/functional/cases/120_fuzzy/encrypted-dyn1.robot @@ -0,0 +1,14 @@ +*** Settings *** +Suite Setup Fuzzy Setup Encrypted Dyn1 Siphash +Suite Teardown Rspamd Redis Teardown +Resource lib.robot + +*** Test Cases *** +Fuzzy Add + Fuzzy Multimessage Add Test + +Fuzzy Fuzzy + Fuzzy Multimessage Fuzzy Test + +Fuzzy Miss + Fuzzy Multimessage Miss Test diff --git a/test/functional/cases/120_fuzzy/encrypted-dyn2.robot b/test/functional/cases/120_fuzzy/encrypted-dyn2.robot new file mode 100644 index 000000000..ef10ca3ae --- /dev/null +++ b/test/functional/cases/120_fuzzy/encrypted-dyn2.robot @@ -0,0 +1,14 @@ +*** Settings *** +Suite Setup Fuzzy Setup Encrypted Dyn2 Siphash +Suite Teardown Rspamd Redis Teardown +Resource lib.robot + +*** Test Cases *** +Fuzzy Add + Fuzzy Multimessage Add Test + +Fuzzy Fuzzy + Fuzzy Multimessage Fuzzy Test + +Fuzzy Miss + Fuzzy Multimessage Miss Test diff --git a/test/functional/cases/120_fuzzy/encrypted.robot b/test/functional/cases/120_fuzzy/encrypted.robot index 331fada2d..548ea8cb9 100644 --- a/test/functional/cases/120_fuzzy/encrypted.robot +++ b/test/functional/cases/120_fuzzy/encrypted.robot @@ -12,11 +12,3 @@ Fuzzy Fuzzy Fuzzy Miss Fuzzy Multimessage Miss Test - -Fuzzy Fuzzy Dynamic Key - Set Suite Variable ${RSPAMD_FUZZY_ENCRYPTION_KEY} "mbggdnw3tdx7r3ruakjecpf5hcqr4cb4nmdp1fxynx3drbyujb3y" - Fuzzy Multimessage Fuzzy Encrypted Test - -Fuzzy Fuzzy Another Dynamic Key - Set Suite Variable ${RSPAMD_FUZZY_ENCRYPTION_KEY} "c98d3pnb7ejjz1rkobumbbjzo5pbeh64rj68dudy8w7h8mipg1by" - Fuzzy Multimessage Fuzzy Encrypted Test diff --git a/test/functional/cases/120_fuzzy/lib.robot b/test/functional/cases/120_fuzzy/lib.robot index bc0fdd51f..fda0af54a 100644 --- a/test/functional/cases/120_fuzzy/lib.robot +++ b/test/functional/cases/120_fuzzy/lib.robot @@ -107,15 +107,34 @@ Fuzzy Setup Encrypted Set Suite Variable ${RSPAMD_FUZZY_ALGORITHM} ${algorithm} Set Suite Variable ${RSPAMD_FUZZY_ENCRYPTED_ONLY} true Set Suite Variable ${RSPAMD_FUZZY_ENCRYPTION_KEY} ${RSPAMD_KEY_PUB1} + Set Suite Variable ${RSPAMD_FUZZY_CLIENT_ENCRYPTION_KEY} ${RSPAMD_KEY_PUB1} Set Suite Variable ${RSPAMD_FUZZY_INCLUDE} ${RSPAMD_TESTDIR}/configs/fuzzy-encryption-key.conf Rspamd Redis Setup -Fuzzy Setup Encrypted Keyed +Fuzzy Setup Encrypted Dyn1 [Arguments] ${algorithm} Set Suite Variable ${RSPAMD_FUZZY_ALGORITHM} ${algorithm} Set Suite Variable ${RSPAMD_FUZZY_ENCRYPTED_ONLY} true Set Suite Variable ${RSPAMD_FUZZY_ENCRYPTION_KEY} ${RSPAMD_KEY_PUB1} + Set Suite Variable ${RSPAMD_FUZZY_CLIENT_ENCRYPTION_KEY} ${RSPAMD_KEY_PUB2} + Set Suite Variable ${RSPAMD_FUZZY_INCLUDE} ${RSPAMD_TESTDIR}/configs/fuzzy-encryption-key.conf + Rspamd Redis Setup +Fuzzy Setup Encrypted Dyn2 + [Arguments] ${algorithm} + Set Suite Variable ${RSPAMD_FUZZY_ALGORITHM} ${algorithm} + Set Suite Variable ${RSPAMD_FUZZY_ENCRYPTED_ONLY} true + Set Suite Variable ${RSPAMD_FUZZY_ENCRYPTION_KEY} ${RSPAMD_KEY_PUB1} + Set Suite Variable ${RSPAMD_FUZZY_CLIENT_ENCRYPTION_KEY} ${RSPAMD_KEY_PUB3} + Set Suite Variable ${RSPAMD_FUZZY_INCLUDE} ${RSPAMD_TESTDIR}/configs/fuzzy-encryption-key.conf + Rspamd Redis Setup + +Fuzzy Setup Encrypted Keyed + [Arguments] ${algorithm} + Set Suite Variable ${RSPAMD_FUZZY_ALGORITHM} ${algorithm} + Set Suite Variable ${RSPAMD_FUZZY_ENCRYPTED_ONLY} true + Set Suite Variable ${RSPAMD_FUZZY_ENCRYPTION_KEY} ${RSPAMD_KEY_PUB1} + Set Suite Variable ${RSPAMD_FUZZY_CLIENT_ENCRYPTION_KEY} ${RSPAMD_KEY_PUB1} Set Suite Variable ${RSPAMD_FUZZY_KEY} mYN888sydwLTfE32g2hN Set Suite Variable ${RSPAMD_FUZZY_SHINGLES_KEY} hXUCgul9yYY3Zlk1QIT2 Rspamd Redis Setup @@ -159,6 +178,12 @@ Fuzzy Setup Keyed Xxhash Fuzzy Setup Encrypted Siphash Fuzzy Setup Encrypted siphash +Fuzzy Setup Encrypted Dyn1 Siphash + Fuzzy Setup Encrypted Dyn1 siphash + +Fuzzy Setup Encrypted Dyn2 Siphash + Fuzzy Setup Encrypted Dyn2 siphash + Fuzzy Skip Hash Test Message FOR ${i} IN @{MESSAGES_SKIP} Fuzzy Skip Add Test Base ${i} diff --git a/test/functional/configs/fuzzy-encryption-key.conf b/test/functional/configs/fuzzy-encryption-key.conf index 522081b08..3cb29e5af 100644 --- a/test/functional/configs/fuzzy-encryption-key.conf +++ b/test/functional/configs/fuzzy-encryption-key.conf @@ -1,2 +1,2 @@ # Setting this to null does not work out so it's hidden in an include -encryption_key = {= env.FUZZY_ENCRYPTION_KEY =}; +encryption_key = {= env.FUZZY_CLIENT_ENCRYPTION_KEY =}; diff --git a/test/functional/lib/vars.py b/test/functional/lib/vars.py index 0a12a8191..a4bcbadda 100644 --- a/test/functional/lib/vars.py +++ b/test/functional/lib/vars.py @@ -1,3 +1,65 @@ +# Copyright 2024 Vsevolod Stakhov +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + import shutil import socket @@ -6,6 +68,8 @@ HAVE_MILTERTEST = shutil.which('miltertest') and True or False RSPAMD_EXTERNAL_RELAY_ENABLED = False RSPAMD_KEY_PVT1 = 'ekd3x36tfa5gd76t6pa8hqif3ott7n1siuux68exbkk7ukscte9y' RSPAMD_KEY_PUB1 = 'm8kneubpcjsb8sbsoj7jy7azj9fdd3xmj63txni86a8ye9ncomny' +RSPAMD_KEY_PUB2 = 'mbggdnw3tdx7r3ruakjecpf5hcqr4cb4nmdp1fxynx3drbyujb3y' +RSPAMD_KEY_PUB3 = 'zhypei8sartqrtow84dddgp5exh3gsr65kbw88wj7ppot1bwmuiy' RSPAMD_LOCAL_ADDR = '127.0.0.1' RSPAMD_MAP_WATCH_INTERVAL = '1min' RSPAMD_PORT_CONTROLLER = 56790 -- 2.39.5