mirror of
https://github.com/DanielLavrushin/b4.git
synced 2026-08-17 13:03:49 +00:00
fix(tests): enhance stubBinaries function to properly manage binary cache cleanup
Some checks failed
Deploy documentation / build-and-deploy (push) Has been cancelled
Some checks failed
Deploy documentation / build-and-deploy (push) Has been cancelled
This commit is contained in:
parent
6f2c19f234
commit
df4796da34
1 changed files with 16 additions and 0 deletions
|
|
@ -19,8 +19,24 @@ func mssClampSet(id string, size int, ips, macs []string) *config.SetConfig {
|
|||
return &set
|
||||
}
|
||||
|
||||
func stubBinaries(t *testing.T, names ...string) {
|
||||
t.Helper()
|
||||
for _, name := range names {
|
||||
prev, had := hasBinaryCache.Load(name)
|
||||
t.Cleanup(func() {
|
||||
if had {
|
||||
hasBinaryCache.Store(name, prev)
|
||||
} else {
|
||||
hasBinaryCache.Delete(name)
|
||||
}
|
||||
})
|
||||
hasBinaryCache.Store(name, true)
|
||||
}
|
||||
}
|
||||
|
||||
func mssSpecs(t *testing.T, cfg *config.Config, ipt string) []string {
|
||||
t.Helper()
|
||||
stubBinaries(t, backendIPTables, backendIP6Tables, "ipset")
|
||||
manager := NewIPTablesManager(cfg, false)
|
||||
_, rules := manager.buildMSSManifest("PREROUTING")
|
||||
var out []string
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue