diff options
| author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-03-07 18:18:29 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-07 18:18:29 +0100 |
| commit | 03b09f7ce06f25b5ccdbd685d8f25931dff41cc8 (patch) | |
| tree | 80b6ccdcb7f3e492c22b8c53c33184ad139cf5a8 /NPTest.pm | |
| parent | 9e1c72ac154d44f561635f1754103dac75cffb99 (diff) | |
| parent | f2275431783a5aaed25c35b5deec37c244872a7a (diff) | |
| download | monitoring-plugins-03b09f7ce06f25b5ccdbd685d8f25931dff41cc8.tar.gz | |
Merge pull request #2076 from RincewindsHat/feature/json_parsing_in_tests
Implement JSON output parsing for tests
Diffstat (limited to 'NPTest.pm')
| -rw-r--r-- | NPTest.pm | 8 |
1 files changed, 8 insertions, 0 deletions
| @@ -15,6 +15,10 @@ use warnings; | |||
| 15 | use Cwd; | 15 | use Cwd; |
| 16 | use File::Basename; | 16 | use File::Basename; |
| 17 | 17 | ||
| 18 | use JSON; | ||
| 19 | |||
| 20 | use Try::Tiny; | ||
| 21 | |||
| 18 | use IO::File; | 22 | use IO::File; |
| 19 | use Data::Dumper; | 23 | use Data::Dumper; |
| 20 | 24 | ||
| @@ -617,6 +621,10 @@ sub testCmd { | |||
| 617 | chomp $output; | 621 | chomp $output; |
| 618 | $object->output($output); | 622 | $object->output($output); |
| 619 | 623 | ||
| 624 | try { | ||
| 625 | $object->{'mp_test_result'} = decode_json($output); | ||
| 626 | }; | ||
| 627 | |||
| 620 | alarm(0); | 628 | alarm(0); |
| 621 | 629 | ||
| 622 | my ($pkg, $file, $line) = caller(0); | 630 | my ($pkg, $file, $line) = caller(0); |
