Commit 02d75cb4 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #45481 from CaoShuFeng/xtables/lock

Automatic merge from submit-queue Remove leaked tmp file in unit tests Some unit tests leave a temp file in work space: pkg/util/iptables/xtables.lock This patch remove that file @dcbw **Release note**: ```NONE ```
parents d602ea69 a393e950
...@@ -1042,6 +1042,7 @@ func TestRestoreAll(t *testing.T) { ...@@ -1042,6 +1042,7 @@ func TestRestoreAll(t *testing.T) {
}, },
} }
runner := newInternal(&fexec, dbus.NewFake(nil, nil), ProtocolIpv4, TestLockfilePath) runner := newInternal(&fexec, dbus.NewFake(nil, nil), ProtocolIpv4, TestLockfilePath)
defer os.Remove(TestLockfilePath)
defer runner.Destroy() defer runner.Destroy()
err := runner.RestoreAll([]byte{}, NoFlushTables, RestoreCounters) err := runner.RestoreAll([]byte{}, NoFlushTables, RestoreCounters)
...@@ -1086,6 +1087,7 @@ func TestRestoreAllWait(t *testing.T) { ...@@ -1086,6 +1087,7 @@ func TestRestoreAllWait(t *testing.T) {
}, },
} }
runner := newInternal(&fexec, dbus.NewFake(nil, nil), ProtocolIpv4, TestLockfilePath) runner := newInternal(&fexec, dbus.NewFake(nil, nil), ProtocolIpv4, TestLockfilePath)
defer os.Remove(TestLockfilePath)
defer runner.Destroy() defer runner.Destroy()
err := runner.RestoreAll([]byte{}, NoFlushTables, RestoreCounters) err := runner.RestoreAll([]byte{}, NoFlushTables, RestoreCounters)
...@@ -1131,6 +1133,7 @@ func TestRestoreAllWaitOldIptablesRestore(t *testing.T) { ...@@ -1131,6 +1133,7 @@ func TestRestoreAllWaitOldIptablesRestore(t *testing.T) {
}, },
} }
runner := newInternal(&fexec, dbus.NewFake(nil, nil), ProtocolIpv4, TestLockfilePath) runner := newInternal(&fexec, dbus.NewFake(nil, nil), ProtocolIpv4, TestLockfilePath)
defer os.Remove(TestLockfilePath)
defer runner.Destroy() defer runner.Destroy()
err := runner.RestoreAll([]byte{}, NoFlushTables, RestoreCounters) err := runner.RestoreAll([]byte{}, NoFlushTables, RestoreCounters)
...@@ -1177,6 +1180,7 @@ func TestRestoreAllGrabNewLock(t *testing.T) { ...@@ -1177,6 +1180,7 @@ func TestRestoreAllGrabNewLock(t *testing.T) {
} }
runner := newInternal(&fexec, dbus.NewFake(nil, nil), ProtocolIpv4, TestLockfilePath) runner := newInternal(&fexec, dbus.NewFake(nil, nil), ProtocolIpv4, TestLockfilePath)
defer os.Remove(TestLockfilePath)
defer runner.Destroy() defer runner.Destroy()
// Grab the /run lock and ensure the RestoreAll fails // Grab the /run lock and ensure the RestoreAll fails
...@@ -1219,6 +1223,7 @@ func TestRestoreAllGrabOldLock(t *testing.T) { ...@@ -1219,6 +1223,7 @@ func TestRestoreAllGrabOldLock(t *testing.T) {
} }
runner := newInternal(&fexec, dbus.NewFake(nil, nil), ProtocolIpv4, TestLockfilePath) runner := newInternal(&fexec, dbus.NewFake(nil, nil), ProtocolIpv4, TestLockfilePath)
defer os.Remove(TestLockfilePath)
defer runner.Destroy() defer runner.Destroy()
// Grab the abstract @xtables socket // Grab the abstract @xtables socket
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment