@@ -16,6 +16,7 @@ package tunneloperator
16
16
17
17
import (
18
18
"fmt"
19
+ "slices"
19
20
"strings"
20
21
"time"
21
22
@@ -27,7 +28,6 @@ import (
27
28
"sigs.k8s.io/controller-runtime/pkg/client"
28
29
29
30
"github.com/liqotech/liqo/apis/net/v1alpha1"
30
- "github.com/liqotech/liqo/pkg/utils/slice"
31
31
)
32
32
33
33
const (
@@ -179,8 +179,8 @@ var _ = Describe("NatmappingOperator", func() {
179
179
Fail (fmt .Sprintf ("failed to list rules in chain %s: %s" , getClusterPreRoutingMappingChain (clusterID1 ), err ))
180
180
}
181
181
// Should contain the rule for oldIP1 but it should not contain the rule for oldIP2
182
- if slice . ContainsString (rules , fmt .Sprintf ("-d %s -j %s --to-destination %s" , newIP2 , DNAT , oldIP2 )) &&
183
- ! slice . ContainsString (rules , fmt .Sprintf ("-d %s -j %s --to-destination %s" , newIP1 , DNAT , oldIP1 )) {
182
+ if slices . Contains (rules , fmt .Sprintf ("-d %s -j %s --to-destination %s" , newIP2 , DNAT , oldIP2 )) &&
183
+ ! slices . Contains (rules , fmt .Sprintf ("-d %s -j %s --to-destination %s" , newIP1 , DNAT , oldIP1 )) {
184
184
return true
185
185
}
186
186
return false
@@ -222,8 +222,8 @@ var _ = Describe("NatmappingOperator", func() {
222
222
Fail (fmt .Sprintf ("failed to list rules in chain %s: %s" , getClusterPreRoutingMappingChain (clusterID1 ), err ))
223
223
}
224
224
// Cluster1 rules should contain the rule for oldIP1 and not contain the rule for oldIP2
225
- if ! slice . ContainsString (cluster1Rules , fmt .Sprintf ("-d %s -j %s --to-destination %s" , newIP1 , DNAT , oldIP1 )) ||
226
- slice . ContainsString (cluster1Rules , fmt .Sprintf ("-d %s -j %s --to-destination %s" , newIP2 , DNAT , oldIP2 )) {
225
+ if ! slices . Contains (cluster1Rules , fmt .Sprintf ("-d %s -j %s --to-destination %s" , newIP1 , DNAT , oldIP1 )) ||
226
+ slices . Contains (cluster1Rules , fmt .Sprintf ("-d %s -j %s --to-destination %s" , newIP2 , DNAT , oldIP2 )) {
227
227
return false
228
228
}
229
229
return true
@@ -235,8 +235,8 @@ var _ = Describe("NatmappingOperator", func() {
235
235
Fail (fmt .Sprintf ("failed to list rules in chain %s: %s" , getClusterPreRoutingMappingChain (clusterID2 ), err ))
236
236
}
237
237
// Cluster2 rules should contain the rule for oldIP2 and not contain the rule for oldIP1
238
- if ! slice . ContainsString (cluster2Rules , fmt .Sprintf ("-d %s -j %s --to-destination %s" , newIP2 , DNAT , oldIP2 )) ||
239
- slice . ContainsString (cluster2Rules , fmt .Sprintf ("-d %s -j %s --to-destination %s" , newIP1 , DNAT , oldIP1 )) {
238
+ if ! slices . Contains (cluster2Rules , fmt .Sprintf ("-d %s -j %s --to-destination %s" , newIP2 , DNAT , oldIP2 )) ||
239
+ slices . Contains (cluster2Rules , fmt .Sprintf ("-d %s -j %s --to-destination %s" , newIP1 , DNAT , oldIP1 )) {
240
240
return false
241
241
}
242
242
return true
0 commit comments