libnetwork/iptables: TestReloaded(): minor cleanup

- remove local bridgeName variable that shadowed the const, but
  used the same value
- remove some redundant `var` declarations, and changed fixed
  values to a const

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2023-07-05 23:02:52 +02:00
parent b216669a02
commit 126525c03e
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
2 changed files with 5 additions and 9 deletions

View file

@ -19,15 +19,11 @@ func TestFirewalldInit(t *testing.T) {
}
func TestReloaded(t *testing.T) {
var err error
var fwdChain *ChainInfo
iptable := GetIptable(IPv4)
fwdChain, err = iptable.NewChain("FWD", Filter, false)
fwdChain, err := iptable.NewChain("FWD", Filter, false)
if err != nil {
t.Fatal(err)
}
bridgeName := "lo"
err = iptable.ProgramChain(fwdChain, bridgeName, false, true)
if err != nil {
@ -38,8 +34,8 @@ func TestReloaded(t *testing.T) {
// copy-pasted from iptables_test:TestLink
ip1 := net.ParseIP("192.168.1.1")
ip2 := net.ParseIP("192.168.1.2")
port := 1234
proto := "tcp"
const port = 1234
const proto = "tcp"
err = fwdChain.Link(Append, ip1, ip2, port, proto, bridgeName)
if err != nil {

View file

@ -252,8 +252,8 @@ func TestCleanup(t *testing.T) {
}
func TestExistsRaw(t *testing.T) {
testChain1 := "ABCD"
testChain2 := "EFGH"
const testChain1 = "ABCD"
const testChain2 = "EFGH"
iptable := GetIptable(IPv4)