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
diff options
context:
space:
mode:
Diffstat (limited to 'tests/libs/zbxsysinfo/common/vfs_file_exists.yaml')
-rw-r--r--tests/libs/zbxsysinfo/common/vfs_file_exists.yaml87
1 files changed, 87 insertions, 0 deletions
diff --git a/tests/libs/zbxsysinfo/common/vfs_file_exists.yaml b/tests/libs/zbxsysinfo/common/vfs_file_exists.yaml
new file mode 100644
index 00000000000..47df00417fb
--- /dev/null
+++ b/tests/libs/zbxsysinfo/common/vfs_file_exists.yaml
@@ -0,0 +1,87 @@
+---
+test case: file exists
+files:
+ file.txt: |
+ 123456
+in:
+ key: "vfs.file.exists[file.txt]"
+out:
+ result: SYSINFO_RET_OK
+ file_exists: 1
+
+---
+test case: file exists, include all
+files:
+ file.txt: |
+ 123456
+in:
+ key: "vfs.file.exists[file.txt, all]"
+out:
+ result: SYSINFO_RET_OK
+ file_exists: 1
+---
+test case: file exists, exclude sockets
+files:
+ file.txt: |
+ 123456
+in:
+ key: "vfs.file.exists[file.txt,, sock]"
+out:
+ result: SYSINFO_RET_OK
+ file_exists: 1
+---
+test case: file does not exist
+files:
+ file.txt: |
+ 123456
+in:
+ key: "vfs.file.exists[nonexistent.txt]"
+out:
+ result: SYSINFO_RET_OK
+ file_exists: 0
+---
+test case: file exist but is excluded
+files:
+ file.txt: |
+ 123456
+in:
+ key: "vfs.file.exists[file.txt,, file]"
+out:
+ result: SYSINFO_RET_OK
+ file_exists: 0
+---
+test case: empty file name
+in:
+ key: "vfs.file.exists[]"
+out:
+ result: SYSINFO_RET_FAIL
+ error: "Invalid first parameter."
+---
+test case: too many parameters
+in:
+ key: "vfs.file.exists[foo, bar, buz, qux]"
+out:
+ result: SYSINFO_RET_FAIL
+ error: "Too many parameters."
+---
+test case: invalid "include types" parameter
+in:
+ key: "vfs.file.exists[foo, bar]"
+out:
+ result: SYSINFO_RET_FAIL
+ error: "Invalid type \"bar\"."
+---
+test case: invalid "exclude types" parameter
+in:
+ key: "vfs.file.exists[foo, file, baz]"
+out:
+ result: SYSINFO_RET_FAIL
+ error: "Invalid type \"baz\"."
+---
+test case: invalid both "include types" and "exclude types" parameters
+in:
+ key: "vfs.file.exists[foo, bar, baz]"
+out:
+ result: SYSINFO_RET_FAIL
+ error: "Invalid type \"bar\"."
+...