'c0mmunity', 'snmp_password' => "auth'pass", 'snmp_priv_passphrase' => '']; expect(exec_poll(exec_mask_failing_command(), 5, $item))->toBe('out c0mmunity'); $log = implode("\n", $GLOBALS['exec_mask_log']); expect($log)->toContain('ErrorCode:3') ->and($log)->toContain('exited with code 3') ->and($log)->toContain('out ********') ->and($log)->toContain('err ********') ->and($log)->not->toContain('c0mmunity') ->and($log)->not->toContain('auth'); }); test('exec_with_timeout logs the command as given when the caller passes no mask', function () { $output = []; $return = 0; exec_with_timeout(exec_mask_failing_command(), $output, $return, 5); expect($return)->toBe(3) ->and(implode("\n", $GLOBALS['exec_mask_log']))->toContain('c0mmunity'); }); test('every script data source caller passes the poller item to exec_poll', function () { $root = dirname(__DIR__, 4); expect(file_get_contents($root . '/cmd.php'))->toContain('exec_poll($item[\'arg1\'], $script_timeout, $item)') ->and(file_get_contents($root . '/cmd.php'))->toContain('exec_poll($index_item[\'arg1\'], $script_timeout, $item)') ->and(file_get_contents($root . '/cmd_realtime.php'))->toContain('exec_poll($item[\'arg1\'], 2, $item)') ->and(file_get_contents($root . '/remote_agent.php'))->toContain('exec_poll($item[\'arg1\'], 5, $item)'); });