From 6c4e265c6ccffa021ffab94e31f62fcca74d3d03 Mon Sep 17 00:00:00 2001 From: Artjoms Rimdjonoks Date: Tue, 1 Nov 2022 10:17:06 +0200 Subject: [PATCH 1/5] .......... [DEV-2159] attempt to use separate file --- ui/tests/integration/testAgentItems.php | 32 ++++++++++++++----------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/ui/tests/integration/testAgentItems.php b/ui/tests/integration/testAgentItems.php index e1c0813c8ca1..6768d9a4bff3 100644 --- a/ui/tests/integration/testAgentItems.php +++ b/ui/tests/integration/testAgentItems.php @@ -36,6 +36,7 @@ class testAgentItems extends CIntegrationTest { const TEST_FILE_BASE_NAME = 'test_file'; const TEST_LINK_BASE_NAME = 'test_link'; const TEST_FILE_NAME = '/tmp/'.self::TEST_FILE_BASE_NAME; + const TEST_FILE_NAME_ACCESS = '/tmp/'.self::TEST_FILE_BASE_NAME.'_access_test'; const TEST_LINK_NAME = '/tmp/'.self::TEST_LINK_BASE_NAME; const TEST_LINK_NAME2 = '/tmp/'.self::TEST_LINK_BASE_NAME.'2'; const TEST_DIR_NAME = '/tmp/dir'; @@ -204,19 +205,19 @@ class testAgentItems extends CIntegrationTest { 'fields_exec' => ['permissions', 'user', 'group', 'uid', 'gid', 'access', 'change'], 'result' => [ 'type' => 'file', - 'permissions' => 'stat -c %04a '.self::TEST_FILE_NAME, - 'user' => 'stat -c %U '.self::TEST_FILE_NAME, - 'group' => 'stat -c %G '.self::TEST_FILE_NAME, - 'uid' => 'stat -c %u '.self::TEST_FILE_NAME, - 'gid' => 'stat -c %g '.self::TEST_FILE_NAME, + 'permissions' => 'stat -c %04a '.self::TEST_FILE_NAME_ACCESS, + 'user' => 'stat -c %U '.self::TEST_FILE_NAME_ACCESS, + 'group' => 'stat -c %G '.self::TEST_FILE_NAME_ACCESS, + 'uid' => 'stat -c %u '.self::TEST_FILE_NAME_ACCESS, + 'gid' => 'stat -c %g '.self::TEST_FILE_NAME_ACCESS, 'size' => 27, 'time' => [ 'modify' => '2021-03-29T14:59:09+0300' ], 'timestamp' => [ - 'access' => 'stat -c %X '.self::TEST_FILE_NAME, + 'access' => 'stat -c %X '.self::TEST_FILE_NAME_ACCESS, 'modify' => self::TEST_MOD_TIMESTAMP, - 'change' => 'stat -c %Z '.self::TEST_FILE_NAME + 'change' => 'stat -c %Z '.self::TEST_FILE_NAME_ACCESS ] ] ], @@ -229,19 +230,19 @@ class testAgentItems extends CIntegrationTest { 'fields_exec' => ['permissions', 'user', 'group', 'uid', 'gid', 'access', 'change'], 'result' => [ 'type' => 'file', - 'permissions' => 'stat -c %04a '.self::TEST_FILE_NAME, - 'user' => 'stat -c %U '.self::TEST_FILE_NAME, - 'group' => 'stat -c %G '.self::TEST_FILE_NAME, - 'uid' => 'stat -c %u '.self::TEST_FILE_NAME, - 'gid' => 'stat -c %g '.self::TEST_FILE_NAME, + 'permissions' => 'stat -c %04a '.self::TEST_FILE_NAME_ACCESS, + 'user' => 'stat -c %U '.self::TEST_FILE_NAME_ACCESS, + 'group' => 'stat -c %G '.self::TEST_FILE_NAME_ACCESS, + 'uid' => 'stat -c %u '.self::TEST_FILE_NAME_ACCESS, + 'gid' => 'stat -c %g '.self::TEST_FILE_NAME_ACCESS, 'size' => 27, 'time' => [ 'modify' => '2021-03-29T14:59:09+03:00' ], 'timestamp' => [ - 'access' => 'stat -c %X '.self::TEST_FILE_NAME, + 'access' => 'stat -c %X '.self::TEST_FILE_NAME_ACCESS, 'modify' => self::TEST_MOD_TIMESTAMP, - 'change' => 'stat -c %Z '.self::TEST_FILE_NAME + 'change' => 'stat -c %Z '.self::TEST_FILE_NAME_ACCESS ] ] ], @@ -708,6 +709,8 @@ public function prepareData() { // Write test file $this->assertTrue(@file_put_contents(self::TEST_FILE_NAME, "1st line\n2nd line\n3rd line\n") !== false); $this->assertTrue(@touch(self::TEST_FILE_NAME, self::TEST_MOD_TIMESTAMP)); + $this->assertTrue(@file_put_contents(self::TEST_FILE_NAME_ACCESS, "1st line\n2nd line\n3rd line\n") !== false); + $this->assertTrue(@touch(self::TEST_FILE_NAME_ACCESS, self::TEST_MOD_TIMESTAMP)); $this->assertTrue(@file_put_contents(self::TEST_DIR_FILE_NAME, "1st line\n2nd line\n3rd line\n") !== false); $this->assertTrue(@touch(self::TEST_DIR_FILE_NAME, self::TEST_MOD_TIMESTAMP)); @@ -727,6 +730,7 @@ public function prepareData() { $this->assertTrue(@touch(self::TEST_DIR_DIR1_NAME, self::TEST_MOD_TIMESTAMP)); + $this->assertTrue(@exec('touch -h -a -m -t 202103291459.09 '.self::TEST_FILE_NAME_ACCESS) !== false); return true; } From 68acdbded5c7ecca7011b97fd7e7b60286c5fd43 Mon Sep 17 00:00:00 2001 From: Artjoms Rimdjonoks Date: Tue, 1 Nov 2022 13:24:34 +0200 Subject: [PATCH 2/5] .......... [DEV-2159] reduce access file scope --- ui/tests/integration/testAgentItems.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/ui/tests/integration/testAgentItems.php b/ui/tests/integration/testAgentItems.php index 6768d9a4bff3..388185dc4ea3 100644 --- a/ui/tests/integration/testAgentItems.php +++ b/ui/tests/integration/testAgentItems.php @@ -205,11 +205,11 @@ class testAgentItems extends CIntegrationTest { 'fields_exec' => ['permissions', 'user', 'group', 'uid', 'gid', 'access', 'change'], 'result' => [ 'type' => 'file', - 'permissions' => 'stat -c %04a '.self::TEST_FILE_NAME_ACCESS, - 'user' => 'stat -c %U '.self::TEST_FILE_NAME_ACCESS, - 'group' => 'stat -c %G '.self::TEST_FILE_NAME_ACCESS, - 'uid' => 'stat -c %u '.self::TEST_FILE_NAME_ACCESS, - 'gid' => 'stat -c %g '.self::TEST_FILE_NAME_ACCESS, + 'permissions' => 'stat -c %04a '.self::TEST_FILE_NAME, + 'user' => 'stat -c %U '.self::TEST_FILE_NAME, + 'group' => 'stat -c %G '.self::TEST_FILE_NAME, + 'uid' => 'stat -c %u '.self::TEST_FILE_NAME, + 'gid' => 'stat -c %g '.self::TEST_FILE_NAME, 'size' => 27, 'time' => [ 'modify' => '2021-03-29T14:59:09+0300' @@ -217,7 +217,7 @@ class testAgentItems extends CIntegrationTest { 'timestamp' => [ 'access' => 'stat -c %X '.self::TEST_FILE_NAME_ACCESS, 'modify' => self::TEST_MOD_TIMESTAMP, - 'change' => 'stat -c %Z '.self::TEST_FILE_NAME_ACCESS + 'change' => 'stat -c %Z '.self::TEST_FILE_NAME ] ] ], @@ -230,11 +230,11 @@ class testAgentItems extends CIntegrationTest { 'fields_exec' => ['permissions', 'user', 'group', 'uid', 'gid', 'access', 'change'], 'result' => [ 'type' => 'file', - 'permissions' => 'stat -c %04a '.self::TEST_FILE_NAME_ACCESS, - 'user' => 'stat -c %U '.self::TEST_FILE_NAME_ACCESS, - 'group' => 'stat -c %G '.self::TEST_FILE_NAME_ACCESS, - 'uid' => 'stat -c %u '.self::TEST_FILE_NAME_ACCESS, - 'gid' => 'stat -c %g '.self::TEST_FILE_NAME_ACCESS, + 'permissions' => 'stat -c %04a '.self::TEST_FILE_NAME, + 'user' => 'stat -c %U '.self::TEST_FILE_NAME, + 'group' => 'stat -c %G '.self::TEST_FILE_NAME, + 'uid' => 'stat -c %u '.self::TEST_FILE_NAME, + 'gid' => 'stat -c %g '.self::TEST_FILE_NAME, 'size' => 27, 'time' => [ 'modify' => '2021-03-29T14:59:09+03:00' @@ -242,7 +242,7 @@ class testAgentItems extends CIntegrationTest { 'timestamp' => [ 'access' => 'stat -c %X '.self::TEST_FILE_NAME_ACCESS, 'modify' => self::TEST_MOD_TIMESTAMP, - 'change' => 'stat -c %Z '.self::TEST_FILE_NAME_ACCESS + 'change' => 'stat -c %Z '.self::TEST_FILE_NAME ] ] ], From 740a0841f003e0dbd0a75b5f94e7b6ccf7130b11 Mon Sep 17 00:00:00 2001 From: Artjoms Rimdjonoks Date: Tue, 1 Nov 2022 13:33:07 +0200 Subject: [PATCH 3/5] .......... [DEV-2159] added separate files for agent1 and 2 --- ui/tests/integration/testAgentItems.php | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/ui/tests/integration/testAgentItems.php b/ui/tests/integration/testAgentItems.php index 388185dc4ea3..88fa8b6d9d1f 100644 --- a/ui/tests/integration/testAgentItems.php +++ b/ui/tests/integration/testAgentItems.php @@ -36,7 +36,8 @@ class testAgentItems extends CIntegrationTest { const TEST_FILE_BASE_NAME = 'test_file'; const TEST_LINK_BASE_NAME = 'test_link'; const TEST_FILE_NAME = '/tmp/'.self::TEST_FILE_BASE_NAME; - const TEST_FILE_NAME_ACCESS = '/tmp/'.self::TEST_FILE_BASE_NAME.'_access_test'; + const TEST_FILE_NAME_ACCESS1 = '/tmp/'.self::TEST_FILE_BASE_NAME.'_access_test1'; + const TEST_FILE_NAME_ACCESS2 = '/tmp/'.self::TEST_FILE_BASE_NAME.'_access_test2'; const TEST_LINK_NAME = '/tmp/'.self::TEST_LINK_BASE_NAME; const TEST_LINK_NAME2 = '/tmp/'.self::TEST_LINK_BASE_NAME.'2'; const TEST_DIR_NAME = '/tmp/dir'; @@ -197,7 +198,7 @@ class testAgentItems extends CIntegrationTest { 'result' => 'b73a96d498012c84fc2ffa1df3c4461689cb90456ee300654723205c26ec4988' ], [ - 'key' => 'vfs.file.get['.self::TEST_FILE_NAME.']', + 'key' => 'vfs.file.get['.self::TEST_FILE_NAME_ACCESS1.']', 'type' => ITEM_TYPE_ZABBIX, 'component' => self::COMPONENT_AGENT, 'valueType' => ITEM_VALUE_TYPE_TEXT, @@ -215,14 +216,14 @@ class testAgentItems extends CIntegrationTest { 'modify' => '2021-03-29T14:59:09+0300' ], 'timestamp' => [ - 'access' => 'stat -c %X '.self::TEST_FILE_NAME_ACCESS, + 'access' => 'stat -c %X '.self::TEST_FILE_NAME_ACCESS1, 'modify' => self::TEST_MOD_TIMESTAMP, 'change' => 'stat -c %Z '.self::TEST_FILE_NAME ] ] ], [ - 'key' => 'vfs.file.get['.self::TEST_FILE_NAME.']', + 'key' => 'vfs.file.get['.self::TEST_FILE_NAME_ACCESS2.']', 'type' => ITEM_TYPE_ZABBIX, 'component' => self::COMPONENT_AGENT2, 'valueType' => ITEM_VALUE_TYPE_TEXT, @@ -240,7 +241,7 @@ class testAgentItems extends CIntegrationTest { 'modify' => '2021-03-29T14:59:09+03:00' ], 'timestamp' => [ - 'access' => 'stat -c %X '.self::TEST_FILE_NAME_ACCESS, + 'access' => 'stat -c %X '.self::TEST_FILE_NAME_ACCESS2, 'modify' => self::TEST_MOD_TIMESTAMP, 'change' => 'stat -c %Z '.self::TEST_FILE_NAME ] @@ -709,8 +710,10 @@ public function prepareData() { // Write test file $this->assertTrue(@file_put_contents(self::TEST_FILE_NAME, "1st line\n2nd line\n3rd line\n") !== false); $this->assertTrue(@touch(self::TEST_FILE_NAME, self::TEST_MOD_TIMESTAMP)); - $this->assertTrue(@file_put_contents(self::TEST_FILE_NAME_ACCESS, "1st line\n2nd line\n3rd line\n") !== false); - $this->assertTrue(@touch(self::TEST_FILE_NAME_ACCESS, self::TEST_MOD_TIMESTAMP)); + $this->assertTrue(@file_put_contents(self::TEST_FILE_NAME_ACCESS1, "1st line\n2nd line\n3rd line\n") !== false); + $this->assertTrue(@touch(self::TEST_FILE_NAME_ACCESS1, self::TEST_MOD_TIMESTAMP)); + $this->assertTrue(@file_put_contents(self::TEST_FILE_NAME_ACCESS2, "1st line\n2nd line\n3rd line\n") !== false); + $this->assertTrue(@touch(self::TEST_FILE_NAME_ACCESS2, self::TEST_MOD_TIMESTAMP)); $this->assertTrue(@file_put_contents(self::TEST_DIR_FILE_NAME, "1st line\n2nd line\n3rd line\n") !== false); $this->assertTrue(@touch(self::TEST_DIR_FILE_NAME, self::TEST_MOD_TIMESTAMP)); @@ -730,7 +733,9 @@ public function prepareData() { $this->assertTrue(@touch(self::TEST_DIR_DIR1_NAME, self::TEST_MOD_TIMESTAMP)); - $this->assertTrue(@exec('touch -h -a -m -t 202103291459.09 '.self::TEST_FILE_NAME_ACCESS) !== false); + $this->assertTrue(@exec('touch -h -a -m -t 202103291459.09 '.self::TEST_FILE_NAME_ACCESS1) !== false); + $this->assertTrue(@exec('touch -h -a -m -t 202103291459.09 '.self::TEST_FILE_NAME_ACCESS2) !== false); + return true; } From c3d3c4d500a0bb832363da0516f040b6fece4b9a Mon Sep 17 00:00:00 2001 From: Artjoms Rimdjonoks Date: Wed, 2 Nov 2022 12:10:46 +0200 Subject: [PATCH 4/5] .......... [DEV-2159] greatly increase thresholds in testGoAgentDataCollection --- .../integration/testGoAgentDataCollection.php | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/ui/tests/integration/testGoAgentDataCollection.php b/ui/tests/integration/testGoAgentDataCollection.php index 907ecb321e39..9ea43a5062a9 100644 --- a/ui/tests/integration/testGoAgentDataCollection.php +++ b/ui/tests/integration/testGoAgentDataCollection.php @@ -220,31 +220,31 @@ class testGoAgentDataCollection extends CIntegrationTest { 'key' => 'system.cpu.util[,,avg1]', 'type' => ITEM_TYPE_ZABBIX, 'valueType' => ITEM_VALUE_TYPE_FLOAT, - 'threshold' => 0.5 + 'threshold' => 0.9 ], [ 'key' => 'system.cpu.load[,avg1]', 'type' => ITEM_TYPE_ZABBIX, 'valueType' => ITEM_VALUE_TYPE_FLOAT, - 'threshold' => 0.5 + 'threshold' => 0.9 ], [ 'key' => 'vfs.dev.read[,operations]', 'type' => ITEM_TYPE_ZABBIX, 'valueType' => ITEM_VALUE_TYPE_UINT64, - 'threshold' => 10 + 'threshold' => 1000 ], [ 'key' => 'vfs.dev.write[,operations]', 'type' => ITEM_TYPE_ZABBIX, 'valueType' => ITEM_VALUE_TYPE_UINT64, - 'threshold' => 100 + 'threshold' => 10000 ], [ 'key' => 'proc.cpu.util[,,,,avg1]', 'type' => ITEM_TYPE_ZABBIX, 'valueType' => ITEM_VALUE_TYPE_FLOAT, - 'threshold' => 10.0, + 'threshold' => 90.0, 'compareType' => self::COMPARE_AVERAGE ], [ @@ -258,60 +258,60 @@ class testGoAgentDataCollection extends CIntegrationTest { 'key' => 'system.swap.out[,pages]', 'type' => ITEM_TYPE_ZABBIX, 'valueType' => ITEM_VALUE_TYPE_UINT64, - 'threshold' => 100, + 'threshold' => 10000, 'compareType' => self::COMPARE_AVERAGE ], [ 'key' => 'proc.mem[zabbix_server,zabbix,avg]', 'type' => ITEM_TYPE_ZABBIX, 'valueType' => ITEM_VALUE_TYPE_FLOAT, - 'threshold' => 100.0 + 'threshold' => 10000.0 ], [ 'key' => 'web.page.perf[http://localhost]', 'type' => ITEM_TYPE_ZABBIX, 'valueType' => ITEM_VALUE_TYPE_FLOAT, - 'threshold' => 1.0, + 'threshold' => 100.0, 'compareType' => self::COMPARE_AVERAGE ], [ 'key' => 'net.tcp.service.perf[ssh]', 'type' => ITEM_TYPE_ZABBIX, 'valueType' => ITEM_VALUE_TYPE_FLOAT, - 'threshold' => 0.05 + 'threshold' => 5.00 ], [ 'key' => 'net.udp.service.perf[ntp]', 'type' => ITEM_TYPE_ZABBIX, 'valueType' => ITEM_VALUE_TYPE_FLOAT, - 'threshold' => 0.05 + 'threshold' => 5.00 ], [ 'key' => 'system.swap.size[,total]', 'type' => ITEM_TYPE_ZABBIX, 'valueType' => ITEM_VALUE_TYPE_UINT64, - 'threshold' => 100, + 'threshold' => 10000, 'compareType' => self::COMPARE_AVERAGE ], [ 'key' => 'vfs.fs.inode[/,pfree]', 'type' => ITEM_TYPE_ZABBIX, 'valueType' => ITEM_VALUE_TYPE_FLOAT, - 'threshold' => 0.1, + 'threshold' => 0.9, 'compareType' => self::COMPARE_AVERAGE ], [ 'key' => 'vfs.fs.size[/tmp,free]', 'type' => ITEM_TYPE_ZABBIX, 'valueType' => ITEM_VALUE_TYPE_UINT64, - 'threshold' => 10000000, + 'threshold' => 100000000, 'compareType' => self::COMPARE_AVERAGE ], [ 'key' => 'vm.memory.size[free]', 'type' => ITEM_TYPE_ZABBIX, 'valueType' => ITEM_VALUE_TYPE_UINT64, - 'threshold' => 10000000, + 'threshold' => 100000000, 'compareType' => self::COMPARE_AVERAGE ], [// Should be treated as a special case, since this metric returns JSON object. @@ -319,7 +319,7 @@ class testGoAgentDataCollection extends CIntegrationTest { 'key' => 'zabbix.stats[127.0.0.1,'.PHPUNIT_PORT_PREFIX.self::SERVER_PORT_SUFFIX.']', 'type' => ITEM_TYPE_ZABBIX, 'valueType' => ITEM_VALUE_TYPE_TEXT, - 'threshold' => 50 + 'threshold' => 500 ] ]; From 4b1e3d27d3a7e9854971b9572408166fe4db06e5 Mon Sep 17 00:00:00 2001 From: Artjoms Rimdjonoks Date: Wed, 2 Nov 2022 14:27:22 +0200 Subject: [PATCH 5/5] .......... [DEV-2159] changed to used the single file for access checks --- ui/tests/integration/testAgentItems.php | 44 +++++++++++-------------- 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/ui/tests/integration/testAgentItems.php b/ui/tests/integration/testAgentItems.php index 88fa8b6d9d1f..af4aad830637 100644 --- a/ui/tests/integration/testAgentItems.php +++ b/ui/tests/integration/testAgentItems.php @@ -36,8 +36,7 @@ class testAgentItems extends CIntegrationTest { const TEST_FILE_BASE_NAME = 'test_file'; const TEST_LINK_BASE_NAME = 'test_link'; const TEST_FILE_NAME = '/tmp/'.self::TEST_FILE_BASE_NAME; - const TEST_FILE_NAME_ACCESS1 = '/tmp/'.self::TEST_FILE_BASE_NAME.'_access_test1'; - const TEST_FILE_NAME_ACCESS2 = '/tmp/'.self::TEST_FILE_BASE_NAME.'_access_test2'; + const TEST_FILE_NAME_ACCESS = '/tmp/'.self::TEST_FILE_BASE_NAME.'_access_test'; const TEST_LINK_NAME = '/tmp/'.self::TEST_LINK_BASE_NAME; const TEST_LINK_NAME2 = '/tmp/'.self::TEST_LINK_BASE_NAME.'2'; const TEST_DIR_NAME = '/tmp/dir'; @@ -198,7 +197,7 @@ class testAgentItems extends CIntegrationTest { 'result' => 'b73a96d498012c84fc2ffa1df3c4461689cb90456ee300654723205c26ec4988' ], [ - 'key' => 'vfs.file.get['.self::TEST_FILE_NAME_ACCESS1.']', + 'key' => 'vfs.file.get['.self::TEST_FILE_NAME_ACCESS.']', 'type' => ITEM_TYPE_ZABBIX, 'component' => self::COMPONENT_AGENT, 'valueType' => ITEM_VALUE_TYPE_TEXT, @@ -206,24 +205,24 @@ class testAgentItems extends CIntegrationTest { 'fields_exec' => ['permissions', 'user', 'group', 'uid', 'gid', 'access', 'change'], 'result' => [ 'type' => 'file', - 'permissions' => 'stat -c %04a '.self::TEST_FILE_NAME, - 'user' => 'stat -c %U '.self::TEST_FILE_NAME, - 'group' => 'stat -c %G '.self::TEST_FILE_NAME, - 'uid' => 'stat -c %u '.self::TEST_FILE_NAME, - 'gid' => 'stat -c %g '.self::TEST_FILE_NAME, + 'permissions' => 'stat -c %04a '.self::TEST_FILE_NAME_ACCESS, + 'user' => 'stat -c %U '.self::TEST_FILE_NAME_ACCESS, + 'group' => 'stat -c %G '.self::TEST_FILE_NAME_ACCESS, + 'uid' => 'stat -c %u '.self::TEST_FILE_NAME_ACCESS, + 'gid' => 'stat -c %g '.self::TEST_FILE_NAME_ACCESS, 'size' => 27, 'time' => [ 'modify' => '2021-03-29T14:59:09+0300' ], 'timestamp' => [ - 'access' => 'stat -c %X '.self::TEST_FILE_NAME_ACCESS1, + 'access' => 'stat -c %X '.self::TEST_FILE_NAME_ACCESS, 'modify' => self::TEST_MOD_TIMESTAMP, - 'change' => 'stat -c %Z '.self::TEST_FILE_NAME + 'change' => 'stat -c %Z '.self::TEST_FILE_NAME_ACCESS ] ] ], [ - 'key' => 'vfs.file.get['.self::TEST_FILE_NAME_ACCESS2.']', + 'key' => 'vfs.file.get['.self::TEST_FILE_NAME_ACCESS.']', 'type' => ITEM_TYPE_ZABBIX, 'component' => self::COMPONENT_AGENT2, 'valueType' => ITEM_VALUE_TYPE_TEXT, @@ -231,19 +230,19 @@ class testAgentItems extends CIntegrationTest { 'fields_exec' => ['permissions', 'user', 'group', 'uid', 'gid', 'access', 'change'], 'result' => [ 'type' => 'file', - 'permissions' => 'stat -c %04a '.self::TEST_FILE_NAME, - 'user' => 'stat -c %U '.self::TEST_FILE_NAME, - 'group' => 'stat -c %G '.self::TEST_FILE_NAME, - 'uid' => 'stat -c %u '.self::TEST_FILE_NAME, - 'gid' => 'stat -c %g '.self::TEST_FILE_NAME, + 'permissions' => 'stat -c %04a '.self::TEST_FILE_NAME_ACCESS, + 'user' => 'stat -c %U '.self::TEST_FILE_NAME_ACCESS, + 'group' => 'stat -c %G '.self::TEST_FILE_NAME_ACCESS, + 'uid' => 'stat -c %u '.self::TEST_FILE_NAME_ACCESS, + 'gid' => 'stat -c %g '.self::TEST_FILE_NAME_ACCESS, 'size' => 27, 'time' => [ 'modify' => '2021-03-29T14:59:09+03:00' ], 'timestamp' => [ - 'access' => 'stat -c %X '.self::TEST_FILE_NAME_ACCESS2, + 'access' => 'stat -c %X '.self::TEST_FILE_NAME_ACCESS, 'modify' => self::TEST_MOD_TIMESTAMP, - 'change' => 'stat -c %Z '.self::TEST_FILE_NAME + 'change' => 'stat -c %Z '.self::TEST_FILE_NAME_ACCESS ] ] ], @@ -710,10 +709,8 @@ public function prepareData() { // Write test file $this->assertTrue(@file_put_contents(self::TEST_FILE_NAME, "1st line\n2nd line\n3rd line\n") !== false); $this->assertTrue(@touch(self::TEST_FILE_NAME, self::TEST_MOD_TIMESTAMP)); - $this->assertTrue(@file_put_contents(self::TEST_FILE_NAME_ACCESS1, "1st line\n2nd line\n3rd line\n") !== false); - $this->assertTrue(@touch(self::TEST_FILE_NAME_ACCESS1, self::TEST_MOD_TIMESTAMP)); - $this->assertTrue(@file_put_contents(self::TEST_FILE_NAME_ACCESS2, "1st line\n2nd line\n3rd line\n") !== false); - $this->assertTrue(@touch(self::TEST_FILE_NAME_ACCESS2, self::TEST_MOD_TIMESTAMP)); + $this->assertTrue(@file_put_contents(self::TEST_FILE_NAME_ACCESS, "1st line\n2nd line\n3rd line\n") !== false); + $this->assertTrue(@touch(self::TEST_FILE_NAME_ACCESS, self::TEST_MOD_TIMESTAMP)); $this->assertTrue(@file_put_contents(self::TEST_DIR_FILE_NAME, "1st line\n2nd line\n3rd line\n") !== false); $this->assertTrue(@touch(self::TEST_DIR_FILE_NAME, self::TEST_MOD_TIMESTAMP)); @@ -733,8 +730,7 @@ public function prepareData() { $this->assertTrue(@touch(self::TEST_DIR_DIR1_NAME, self::TEST_MOD_TIMESTAMP)); - $this->assertTrue(@exec('touch -h -a -m -t 202103291459.09 '.self::TEST_FILE_NAME_ACCESS1) !== false); - $this->assertTrue(@exec('touch -h -a -m -t 202103291459.09 '.self::TEST_FILE_NAME_ACCESS2) !== false); + $this->assertTrue(@exec('touch -h -a -m -t 202103291459.09 '.self::TEST_FILE_NAME_ACCESS) !== false); return true; }