Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAndris Zeila <andris.zeila@zabbix.com>2020-09-21 15:13:10 +0300
committerAndris Zeila <andris.zeila@zabbix.com>2020-09-21 15:13:30 +0300
commit9d1542328a7c863bb7cce480b3a0fa78cc2c0618 (patch)
tree8c74e17e0b36d5bd1ab17e92d2ae53f578264d16 /tests
parent7e82dd5536f452a2d7c49af81d3bbb81e4db650f (diff)
........S. [ZBXNEXT-6140] fixed expression macro parsing
Diffstat (limited to 'tests')
-rw-r--r--tests/libs/zbxcommon/zbx_token_find.yaml81
-rw-r--r--tests/libs/zbxdbcache/dc_function_calculate_nextcheck_test.c2
-rw-r--r--tests/libs/zbxdbhigh/Makefile.am1
-rw-r--r--tests/libs/zbxtrends/zbx_trends_parse_range.yaml9
4 files changed, 84 insertions, 9 deletions
diff --git a/tests/libs/zbxcommon/zbx_token_find.yaml b/tests/libs/zbxcommon/zbx_token_find.yaml
index b3dac6e8c09..55a636f77c6 100644
--- a/tests/libs/zbxcommon/zbx_token_find.yaml
+++ b/tests/libs/zbxcommon/zbx_token_find.yaml
@@ -473,4 +473,85 @@ out:
token_type: ZBX_TOKEN_EXPRESSION_MACRO
expression: '{$VALUE:"context}"}*2'
return: SUCCEED
+---
+test case: 'Failure: {?}'
+in:
+ expression: '{?}'
+out:
+ return: FAIL
+---
+test case: 'Failure: {?"}'
+in:
+ expression: '{?"}'
+out:
+ return: FAIL
+---
+test case: 'Failure: {?"\"}'
+in:
+ expression: '{?"\"}'
+out:
+ return: FAIL
+---
+test case: 'Success: {?"abc"}'
+in:
+ expression: '{?"abc"}'
+out:
+ token: '{?"abc"}'
+ token_type: ZBX_TOKEN_EXPRESSION_MACRO
+ expression: '"abc"'
+ return: SUCCEED
+---
+test case: 'Success: {?"a\"b\"c"}'
+in:
+ expression: '{?"a\"b\"c"}'
+out:
+ token: '{?"a\"b\"c"}'
+ token_type: ZBX_TOKEN_EXPRESSION_MACRO
+ expression: '"a\"b\"c"'
+ return: SUCCEED
+---
+test case: 'Success: {?"}"}'
+in:
+ expression: '{?"}"}'
+out:
+ token: '{?"}"}'
+ token_type: ZBX_TOKEN_EXPRESSION_MACRO
+ expression: '"}"'
+ return: SUCCEED
+---
+test case: 'Success: {?{?}}'
+in:
+ expression: '{?{?}}'
+out:
+ token: '{?{?}'
+ token_type: ZBX_TOKEN_EXPRESSION_MACRO
+ expression: '{?'
+ return: SUCCEED
+---
+test case: 'Success: {?{host:key.func()}}'
+in:
+ expression: '{?{host:key.func()}}'
+out:
+ token: '{?{host:key.func()}}'
+ token_type: ZBX_TOKEN_EXPRESSION_MACRO
+ expression: '{host:key.func()}'
+ return: SUCCEED
+---
+test case: 'Success: {?{HOST.HOST}}'
+in:
+ expression: '{?{HOST.HOST}}'
+out:
+ token: '{?{HOST.HOST}'
+ token_type: ZBX_TOKEN_EXPRESSION_MACRO
+ expression: '{HOST.HOST'
+ return: SUCCEED
+---
+test case: 'Success: {?{$MACRO}}'
+in:
+ expression: '{?{$MACRO}}'
+out:
+ token: '{?{$MACRO}}'
+ token_type: ZBX_TOKEN_EXPRESSION_MACRO
+ expression: '{$MACRO}'
+ return: SUCCEED
...
diff --git a/tests/libs/zbxdbcache/dc_function_calculate_nextcheck_test.c b/tests/libs/zbxdbcache/dc_function_calculate_nextcheck_test.c
index 018ba0297db..e8689d0ec8d 100644
--- a/tests/libs/zbxdbcache/dc_function_calculate_nextcheck_test.c
+++ b/tests/libs/zbxdbcache/dc_function_calculate_nextcheck_test.c
@@ -1,3 +1,5 @@
+int zbx_dc_function_calculate_nextcheck(const zbx_trigger_timer_t *timer, time_t from, zbx_uint64_t seed);
+
int zbx_dc_function_calculate_nextcheck(const zbx_trigger_timer_t *timer, time_t from, zbx_uint64_t seed)
{
return dc_function_calculate_nextcheck(timer, from, seed);
diff --git a/tests/libs/zbxdbhigh/Makefile.am b/tests/libs/zbxdbhigh/Makefile.am
index 07078f0705f..0aa505b1fc2 100644
--- a/tests/libs/zbxdbhigh/Makefile.am
+++ b/tests/libs/zbxdbhigh/Makefile.am
@@ -16,6 +16,7 @@ COMMON_FLAGS = -I@top_srcdir@/tests
COMMON_LIB = \
$(top_srcdir)/src/libs/zbxserver/libzbxserver.a \
+ $(top_srcdir)/src/libs/zbxtrends/libzbxtrends.a \
$(top_srcdir)/src/libs/zbxhistory/libzbxhistory.a \
$(top_srcdir)/src/libs/zbxmemory/libzbxmemory.a \
$(top_srcdir)/src/libs/zbxexec/libzbxexec.a \
diff --git a/tests/libs/zbxtrends/zbx_trends_parse_range.yaml b/tests/libs/zbxtrends/zbx_trends_parse_range.yaml
index 10219374e6c..852966be369 100644
--- a/tests/libs/zbxtrends/zbx_trends_parse_range.yaml
+++ b/tests/libs/zbxtrends/zbx_trends_parse_range.yaml
@@ -118,15 +118,6 @@ in:
out:
return: FAIL
---
-test case: Invalid period shift 'now/h+1h'
-in:
- period: 1h
- shift: now/h+1h
- timezone: :Europe/Riga
- time: 2020-09-01 00:00:00.000000000 +03:00
-out:
- return: FAIL
----
test case: Valid parameters '1h,now/h-1h'
in:
period: 1h