Source
'{{#LLD_MACRO}.regsub("(.*)_([0-9]+)", \1)} label1 ', 0, ['lldmacros' => true],
<?php
/*
** Zabbix
** 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 General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** 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 General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
use PHPUnit\Framework\TestCase;
class CPrometheusOutputParserTest extends TestCase {
/**
* An array of Prometheus outputs and parsed results.
*/
public static function dataProvider() {
return [
// success
[
'labelname123', 0, [],
[
'rc' => CParser::PARSE_SUCCESS,
'match' => 'labelname123'
]
],
[
'labelname123', 8, [],
[
'rc' => CParser::PARSE_SUCCESS,
'match' => 'e123'
]
],
[
'{$M}', 0, ['usermacros' => true],
[
'rc' => CParser::PARSE_SUCCESS,
'match' => '{$M}'
]
],
[
'{$FS_MAX: "/home"}', 0, ['usermacros' => true],
[
'rc' => CParser::PARSE_SUCCESS,
'match' => '{$FS_MAX: "/home"}'
]
],
[
'{#LLD}', 0, ['lldmacros' => true],
[
'rc' => CParser::PARSE_SUCCESS,