Source
$this->waitForLogLineToBePresent(self::COMPONENT_SERVER_HANODE1, '"'.self::NODE2_NAME.'" node started in "standby" mode', true, 3, 3);
<?php
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
** See the GNU Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
require_once dirname(__FILE__).'/../include/CIntegrationTest.php';
/**
* Test suite for High availability
*
* @backup ha_node, globalvars
*/
class testSnmpTrapsInHa extends CIntegrationTest {
const NODE1_NAME = 'node1';
const NODE2_NAME = 'node2';
const TC1_TRAPFILE1 = 'ha1.trap';
const TC1_TRAPFILE2 = 'ha2.trap';
const TC2_TRAPFILE1 = 'ha3.trap';
const TC2_TRAPFILE2 = 'ha4.trap';
/**
* @required-components server, server_ha1
* @inheritdoc
*/
public function prepareData() {
$socketDir = $this->getConfigurationValue(self::COMPONENT_SERVER_HANODE1, 'SocketDir');
if (file_exists($socketDir) === false) {
mkdir($socketDir);
}
foreach ([self::TC1_TRAPFILE1, self::TC1_TRAPFILE2, self::TC2_TRAPFILE1, self::TC2_TRAPFILE2] as $fn) {
$this->assertTrue(copy('integration/data/snmptrap/'.$fn, '/tmp/'.$fn));
$this->assertTrue(chmod('/tmp/'.$fn, 0644));
}
return true;
}
/**
* @return array
*/
public function serverConfigurationProvider_tc1() {
return [
self::COMPONENT_SERVER => [
'HANodeName' => self::NODE1_NAME,
'ListenPort' => PHPUNIT_PORT_PREFIX.self::SERVER_HANODE1_PORT_SUFFIX,
'StartSNMPTrapper' => 1,
'SNMPTrapperFile' => '/tmp/'.self::TC1_TRAPFILE1
],