From 9e9c10e466e276f2baf51db322c071258c2899e1 Mon Sep 17 00:00:00 2001 From: Stefan Schantl Date: Mon, 17 Apr 2023 15:23:26 +0200 Subject: [PATCH] Add test to remove ports from a set Signed-off-by: Stefan Schantl --- t/IPSet.t | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/t/IPSet.t b/t/IPSet.t index 8705c01..e3f003b 100644 --- a/t/IPSet.t +++ b/t/IPSet.t @@ -8,7 +8,7 @@ use strict; use warnings; -use Test::More tests => 24; +use Test::More tests => 27; BEGIN { use_ok('IPSet') }; ######################### @@ -129,6 +129,15 @@ foreach my $port (@ports) { $data = &IPSet::get_set_data($session, $portset{'name'}); ok($data->{entries} eq scalar(@ports), "All ports added successfully to the set"); +# Remove a port from the set. +$remove = &IPSet::remove_port($session, $portset{'name'}, $ports[0]); +ok($remove, "Successfully removed $ports[0] from $portset{'name'}"); + +# Grab set data from portset once again. +$data = &IPSet::get_set_data($session, $portset{'name'}); +ok($data->{entries} lt scalar(@ports), "Less entries in the set than at the ports array"); +ok($data->{entries} gt 0, "At least one entry on the portset"); + # Destroy the port set. &IPSet::delete_set($session, $portset{'name'}); -- 2.39.5