summaryrefslogtreecommitdiff
path: root/libpod/network/netavark/netavark_suite_test.go
blob: 4d0c0463480a490ca04c58c31be767ac6fc3af40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// +build linux

package netavark_test

import (
	"os"
	"path/filepath"
	"testing"

	"github.com/containers/podman/v3/libpod/network/netavark"
	"github.com/containers/podman/v3/libpod/network/types"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

func TestNetavark(t *testing.T) {
	RegisterFailHandler(Fail)
	RunSpecs(t, "Netavark Suite")
}

var netavarkBinary string

func init() {
	netavarkBinary = os.Getenv("NETAVARK_BINARY")
	if netavarkBinary == "" {
		netavarkBinary = "/usr/libexec/podman/netavark"
	}
}

func getNetworkInterface(confDir string, machine bool) (types.ContainerNetwork, error) {
	return netavark.NewNetworkInterface(netavark.InitConfig{
		NetworkConfigDir: confDir,
		IsMachine:        machine,
		NetavarkBinary:   netavarkBinary,
		IPAMDBPath:       filepath.Join(confDir, "ipam.db"),
		LockFile:         filepath.Join(confDir, "netavark.lock"),
	})
}