Skip to content

Commit

Permalink
integration: Add a new networking integration test suite
Browse files Browse the repository at this point in the history
This commit introduces a new integration test suite aimed at testing
networking features like inter-container communication, network
isolation, port mapping, etc... and how they interact with daemon-level
and network-level parameters.

So far, there's pretty much no tests making sure our networks are well
configured: 1. there're a few tests for port mapping, but they don't
cover all use cases ; 2. there're a few tests that check if a specific
iptables rule exist, but that doesn't prevent that specific iptables
rule to be wrong in the first place.

As we're planning to refactor how iptables rules are written, and change
some of them to fix known security issues, we need a way to test all
combinations of parameters. So far, this was done by hand, which is
particularly painful and time consuming. As such, this new test suite is
foundational to upcoming work.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
(cherry picked from commit 409ea70)
Signed-off-by: Cory Snider <csnider@mirantis.com>
  • Loading branch information
akerouanton authored and corhere committed Mar 19, 2024
1 parent 6730201 commit a379e02
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions integration/networking/main_test.go
@@ -0,0 +1,34 @@
package networking

import (
"context"
"os"
"testing"

"github.com/docker/docker/testutil/environment"
)

var testEnv *environment.Execution

func TestMain(m *testing.M) {
var err error
testEnv, err = environment.New()
if err != nil {
panic(err)
}

err = environment.EnsureFrozenImagesLinux(testEnv)
if err != nil {
panic(err)
}

testEnv.Print()
code := m.Run()
os.Exit(code)
}

func setupTest(t *testing.T) context.Context {
environment.ProtectAll(t, testEnv)
t.Cleanup(func() { testEnv.Clean(t) })
return context.Background()
}

0 comments on commit a379e02

Please sign in to comment.