** 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.
"github.com/google/go-cmp/cmp"
"golang.zabbix.com/agent2/plugins/smart/mock"
"golang.zabbix.com/sdk/errs"
"golang.zabbix.com/sdk/log"
"golang.zabbix.com/sdk/plugin"
func TestPlugin_execute(t *testing.T) {
sampleFailedAllSmartInfoScan := []byte(
"json_format_version": [1, 0],
"platform_info": "x86_64-w64-mingw32-2016-1607",
"build_info": "(sf-7.3-1)",
"argv": ["smartctl", "-a", "/dev/sda", "-d", "3ware,0", "-j"],
"string": "/dev/sda: Unknown device type '3ware,0'",
"string": "=======> VALID ARGUMENTS ARE: ata, scsi[+TYPE], nvme[,NSID], sat[,auto][,N][+TYPE], usbcypress[,X], usbjmicron[,p][,x][,N], usbprolific, usbsunplus, sntasmedia, sntjmicron[,NSID], sntrealtek, intelliprop,N[+TYPE], jmb39x[-q],N[,sLBA][,force][+TYPE], jms56x,N[,sLBA][,force][+TYPE], aacraid,H,L,ID, areca,N[/E], auto, test <=======",
"asctime": "Fri Sep 16 22:52:58 2022 BST"