2022-08-09 14:44:47 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2022-12-21 14:40:35 +01:00
|
|
|
"testing"
|
2022-08-09 14:44:47 +00:00
|
|
|
|
|
|
|
"github.com/stretchr/testify/suite"
|
|
|
|
)
|
|
|
|
|
|
|
|
func setupSuite(s *suite.Suite, topologyName string) func() {
|
|
|
|
t := s.T()
|
2022-12-14 16:30:04 +01:00
|
|
|
topology, err := LoadTopology(NetworkTopologyDir, topologyName)
|
2022-08-09 14:44:47 +00:00
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("error on loading topology '%s': %v", topologyName, err)
|
|
|
|
}
|
|
|
|
err = topology.Configure()
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("failed to configure %s: %v", topologyName, err)
|
|
|
|
}
|
|
|
|
|
|
|
|
return func() {
|
2022-12-19 20:35:27 +01:00
|
|
|
if IsPersistent() {
|
|
|
|
return
|
|
|
|
}
|
2022-08-09 14:44:47 +00:00
|
|
|
topology.Unconfigure()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestTapSuite(t *testing.T) {
|
|
|
|
var m TapSuite
|
|
|
|
suite.Run(t, &m)
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestNs(t *testing.T) {
|
|
|
|
var m NsSuite
|
|
|
|
suite.Run(t, &m)
|
|
|
|
}
|
|
|
|
|
2022-12-01 09:56:37 +01:00
|
|
|
func TestVeths(t *testing.T) {
|
|
|
|
var m VethsSuite
|
2022-08-09 14:44:47 +00:00
|
|
|
suite.Run(t, &m)
|
|
|
|
}
|
2022-12-21 08:59:16 +01:00
|
|
|
|
|
|
|
func TestNoTopo(t *testing.T) {
|
|
|
|
var m NoTopoSuite
|
|
|
|
suite.Run(t, &m)
|
|
|
|
}
|