parent
642cf387a3
commit
2c698d2cb0
|
@ -5,6 +5,7 @@ import (
|
|||
"fmt"
|
||||
"log"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
|
@ -817,7 +818,7 @@ func idHash(rType, protocol string, toPort, fromPort int64, self bool) string {
|
|||
buf.WriteString(fmt.Sprintf("%s-", rType))
|
||||
buf.WriteString(fmt.Sprintf("%d-", toPort))
|
||||
buf.WriteString(fmt.Sprintf("%d-", fromPort))
|
||||
buf.WriteString(fmt.Sprintf("%s-", protocol))
|
||||
buf.WriteString(fmt.Sprintf("%s-", strings.ToLower(protocol)))
|
||||
buf.WriteString(fmt.Sprintf("%t-", self))
|
||||
|
||||
return fmt.Sprintf("rule-%d", hashcode.String(buf.String()))
|
||||
|
|
|
@ -186,6 +186,30 @@ func TestRulesMixedMatching(t *testing.T) {
|
|||
},
|
||||
},
|
||||
},
|
||||
// test lower/ uppercase handling
|
||||
{
|
||||
local: []interface{}{
|
||||
map[string]interface{}{
|
||||
"from_port": 80,
|
||||
"to_port": 8000,
|
||||
"protocol": "TCP",
|
||||
},
|
||||
},
|
||||
remote: []map[string]interface{}{
|
||||
map[string]interface{}{
|
||||
"from_port": int64(80),
|
||||
"to_port": int64(8000),
|
||||
"protocol": "tcp",
|
||||
},
|
||||
},
|
||||
saves: []map[string]interface{}{
|
||||
map[string]interface{}{
|
||||
"from_port": 80,
|
||||
"to_port": 8000,
|
||||
"protocol": "tcp",
|
||||
},
|
||||
},
|
||||
},
|
||||
// local and remote differ
|
||||
{
|
||||
local: []interface{}{
|
||||
|
|
Loading…
Reference in New Issue