Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move the e2e tests to a standalone, self dependent go module #1946

Merged
merged 3 commits into from Jun 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
53 changes: 26 additions & 27 deletions e2etest/bgptests/bgp.go
Expand Up @@ -26,24 +26,23 @@ import (

metallbv1beta1 "go.universe.tf/metallb/api/v1beta1"
metallbv1beta2 "go.universe.tf/metallb/api/v1beta2"
"go.universe.tf/metallb/e2etest/l2tests"
"go.universe.tf/metallb/e2etest/pkg/config"
"go.universe.tf/metallb/e2etest/pkg/executor"
"go.universe.tf/metallb/e2etest/pkg/k8s"
"go.universe.tf/metallb/e2etest/pkg/mac"
"go.universe.tf/metallb/e2etest/pkg/metallb"
metallbconfig "go.universe.tf/metallb/internal/config"
"go.universe.tf/metallb/internal/pointer"
"go.universe.tf/e2etest/l2tests"
"go.universe.tf/e2etest/pkg/config"
"go.universe.tf/e2etest/pkg/executor"
"go.universe.tf/e2etest/pkg/k8s"
"go.universe.tf/e2etest/pkg/mac"
"go.universe.tf/e2etest/pkg/metallb"
"go.universe.tf/e2etest/pkg/pointer"

"github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/openshift-kni/k8sreporter"

"go.universe.tf/metallb/e2etest/pkg/frr"
frrconfig "go.universe.tf/metallb/e2etest/pkg/frr/config"
frrcontainer "go.universe.tf/metallb/e2etest/pkg/frr/container"
testservice "go.universe.tf/metallb/e2etest/pkg/service"
"go.universe.tf/metallb/internal/ipfamily"
"go.universe.tf/e2etest/pkg/frr"
frrconfig "go.universe.tf/e2etest/pkg/frr/config"
frrcontainer "go.universe.tf/e2etest/pkg/frr/container"
"go.universe.tf/e2etest/pkg/ipfamily"
testservice "go.universe.tf/e2etest/pkg/service"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
Expand Down Expand Up @@ -231,7 +230,7 @@ var _ = ginkgo.Describe("BGP", func() {

ginkgo.DescribeTable("A load balancer service should work with overlapping IPs", func(pairingIPFamily ipfamily.Family, poolAddresses []string) {
var allNodes *corev1.NodeList
resources := metallbconfig.ClusterResources{
resources := config.Resources{
Pools: []metallbv1beta1.IPAddressPool{
{
ObjectMeta: metav1.ObjectMeta{
Expand Down Expand Up @@ -301,7 +300,7 @@ var _ = ginkgo.Describe("BGP", func() {
})

ginkgo.DescribeTable("set different AddressPools ranges modes", func(addressPools []metallbv1beta1.IPAddressPool, pairingFamily ipfamily.Family, tweak testservice.Tweak) {
resources := metallbconfig.ClusterResources{
resources := config.Resources{
Pools: addressPools,
Peers: metallb.PeersForContainers(FRRContainers, pairingFamily),
BGPAdvs: []metallbv1beta1.BGPAdvertisement{emptyBGPAdvertisement},
Expand Down Expand Up @@ -403,7 +402,7 @@ var _ = ginkgo.Describe("BGP", func() {
ginkgo.DescribeTable("configure peers with routerid and validate external containers are paired with nodes", func(ipFamily ipfamily.Family) {
ginkgo.By("configure peer")

resources := metallbconfig.ClusterResources{
resources := config.Resources{
Peers: metallb.WithRouterID(metallb.PeersForContainers(FRRContainers, ipFamily), "10.10.10.1"),
}

Expand All @@ -430,7 +429,7 @@ var _ = ginkgo.Describe("BGP", func() {
ginkgo.DescribeTable("validate external containers are paired with nodes", func(ipFamily ipfamily.Family) {
ginkgo.By("configure peer")

resources := metallbconfig.ClusterResources{
resources := config.Resources{
Peers: metallb.PeersForContainers(FRRContainers, ipFamily, func(p *metallbv1beta2.BGPPeer) {
p.Spec.PasswordSecret = corev1.SecretReference{Name: metallb.GetBGPPeerSecretName(p.Spec.ASN, p.Spec.Port, p.Spec.VRFName)}
p.Spec.Password = ""
Expand Down Expand Up @@ -460,7 +459,7 @@ var _ = ginkgo.Describe("BGP", func() {

ginkgo.Context("BFD", func() {
ginkgo.DescribeTable("should work with the given bfd profile", func(bfd metallbv1beta1.BFDProfile, pairingFamily ipfamily.Family, poolAddresses []string, tweak testservice.Tweak) {
resources := metallbconfig.ClusterResources{
resources := config.Resources{
Pools: []metallbv1beta1.IPAddressPool{
{
ObjectMeta: metav1.ObjectMeta{
Expand Down Expand Up @@ -622,7 +621,7 @@ var _ = ginkgo.Describe("BGP", func() {
}
pools = append(pools, pool)

resources := metallbconfig.ClusterResources{
resources := config.Resources{
Pools: pools,
Peers: metallb.PeersForContainers(FRRContainers, ipFamily),
BGPAdvs: []metallbv1beta1.BGPAdvertisement{emptyBGPAdvertisement},
Expand Down Expand Up @@ -674,7 +673,7 @@ var _ = ginkgo.Describe("BGP", func() {
for i, c := range FRRContainers {
ginkgo.By(fmt.Sprintf("configure FRR peer [%s]", c.Name))

resources := metallbconfig.ClusterResources{
resources := config.Resources{
Peers: metallb.PeersForContainers([]*frrcontainer.FRR{c}, ipFamily),
BGPAdvs: []metallbv1beta1.BGPAdvertisement{emptyBGPAdvertisement},
}
Expand Down Expand Up @@ -720,7 +719,7 @@ var _ = ginkgo.Describe("BGP", func() {
},
}

resources := metallbconfig.ClusterResources{
resources := config.Resources{
Peers: metallb.PeersForContainers(FRRContainers, ipFamily),
Communities: communities,
}
Expand All @@ -731,8 +730,8 @@ var _ = ginkgo.Describe("BGP", func() {
} else {
resources.LegacyAddressPools = make([]metallbv1beta1.AddressPool, 0)
resources.LegacyAddressPools = []metallbv1beta1.AddressPool{
config.IPAddressPoolToLegacy(poolWithAdvertisement, metallbconfig.BGP, []metallbv1beta1.BGPAdvertisement{advertisement}),
config.IPAddressPoolToLegacy(poolWithoutAdvertisement, metallbconfig.BGP, []metallbv1beta1.BGPAdvertisement{}),
config.IPAddressPoolToLegacy(poolWithAdvertisement, config.BGP, []metallbv1beta1.BGPAdvertisement{advertisement}),
config.IPAddressPoolToLegacy(poolWithoutAdvertisement, config.BGP, []metallbv1beta1.BGPAdvertisement{}),
}
}

Expand Down Expand Up @@ -1044,7 +1043,7 @@ var _ = ginkgo.Describe("BGP", func() {

ginkgo.Context("MetalLB FRR rejects", func() {
ginkgo.DescribeTable("any routes advertised by any neighbor", func(addressesRange, toInject string, pairingIPFamily ipfamily.Family) {
resources := metallbconfig.ClusterResources{
resources := config.Resources{
Pools: []metallbv1beta1.IPAddressPool{
{
ObjectMeta: metav1.ObjectMeta{
Expand Down Expand Up @@ -1105,7 +1104,7 @@ var _ = ginkgo.Describe("BGP", func() {
framework.ExpectNoError(err)
})
ginkgo.DescribeTable("to accept any routes advertised by any neighbor", func(addressesRange, toInject string, pairingIPFamily ipfamily.Family, when whenApply) {
resources := metallbconfig.ClusterResources{
resources := config.Resources{
Pools: []metallbv1beta1.IPAddressPool{
{
ObjectMeta: metav1.ObjectMeta{
Expand Down Expand Up @@ -1206,7 +1205,7 @@ var _ = ginkgo.Describe("BGP", func() {

ginkgo.Context("FRR validate reload feedback", func() {
ginkgo.It("should update MetalLB config and log reload-validate success", func() {
resources := metallbconfig.ClusterResources{
resources := config.Resources{
Pools: []metallbv1beta1.IPAddressPool{
{
ObjectMeta: metav1.ObjectMeta{
Expand Down Expand Up @@ -1249,7 +1248,7 @@ var _ = ginkgo.Describe("BGP", func() {

ginkgo.Context("validate FRR running configuration", func() {
ginkgo.It("Full BFD profile", func() {
resources := metallbconfig.ClusterResources{
resources := config.Resources{
Pools: []metallbv1beta1.IPAddressPool{
{
ObjectMeta: metav1.ObjectMeta{
Expand Down
20 changes: 10 additions & 10 deletions e2etest/bgptests/bgp_multiprotocol.go
Expand Up @@ -10,18 +10,18 @@ import (
"time"

metallbv1beta1 "go.universe.tf/metallb/api/v1beta1"
"go.universe.tf/metallb/e2etest/pkg/frr"
"go.universe.tf/metallb/e2etest/pkg/k8s"
"go.universe.tf/metallb/e2etest/pkg/metallb"
testservice "go.universe.tf/metallb/e2etest/pkg/service"
metallbconfig "go.universe.tf/metallb/internal/config"
"go.universe.tf/metallb/internal/ipfamily"
"go.universe.tf/e2etest/pkg/config"
"go.universe.tf/e2etest/pkg/frr"
"go.universe.tf/e2etest/pkg/ipfamily"
"go.universe.tf/e2etest/pkg/k8s"
"go.universe.tf/e2etest/pkg/metallb"
testservice "go.universe.tf/e2etest/pkg/service"

"github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

frrconfig "go.universe.tf/metallb/e2etest/pkg/frr/config"
frrcontainer "go.universe.tf/metallb/e2etest/pkg/frr/container"
frrconfig "go.universe.tf/e2etest/pkg/frr/config"
frrcontainer "go.universe.tf/e2etest/pkg/frr/container"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
clientset "k8s.io/client-go/kubernetes"
Expand Down Expand Up @@ -68,7 +68,7 @@ var _ = ginkgo.Describe("BGP Multiprotocol", func() {

ginkgo.Context("Multiprotocol", func() {
ginkgo.DescribeTable("should advertise both ipv4 and ipv6 addresses with", func(pairingFamily ipfamily.Family, poolAddresses []string, tweak testservice.Tweak) {
resources := metallbconfig.ClusterResources{
resources := config.Resources{
Pools: []metallbv1beta1.IPAddressPool{
{
ObjectMeta: metav1.ObjectMeta{
Expand Down Expand Up @@ -151,7 +151,7 @@ var _ = ginkgo.Describe("BGP Multiprotocol", func() {
},
}

resources := metallbconfig.ClusterResources{
resources := config.Resources{
Peers: metallb.PeersForContainers(FRRContainers, ipFamily),
Pools: []metallbv1beta1.IPAddressPool{pool},
BGPAdvs: []metallbv1beta1.BGPAdvertisement{
Expand Down
18 changes: 9 additions & 9 deletions e2etest/bgptests/bgppeer_selector.go
Expand Up @@ -10,18 +10,18 @@ import (

metallbv1beta1 "go.universe.tf/metallb/api/v1beta1"
"go.universe.tf/metallb/api/v1beta2"
"go.universe.tf/metallb/e2etest/pkg/k8s"
"go.universe.tf/metallb/e2etest/pkg/metallb"
testservice "go.universe.tf/metallb/e2etest/pkg/service"
metallbconfig "go.universe.tf/metallb/internal/config"
"go.universe.tf/metallb/internal/ipfamily"
"go.universe.tf/e2etest/pkg/config"
"go.universe.tf/e2etest/pkg/ipfamily"
"go.universe.tf/e2etest/pkg/k8s"
"go.universe.tf/e2etest/pkg/metallb"
testservice "go.universe.tf/e2etest/pkg/service"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/onsi/ginkgo/v2"

frrconfig "go.universe.tf/metallb/e2etest/pkg/frr/config"
frrcontainer "go.universe.tf/metallb/e2etest/pkg/frr/container"
frrconfig "go.universe.tf/e2etest/pkg/frr/config"
frrcontainer "go.universe.tf/e2etest/pkg/frr/container"
clientset "k8s.io/client-go/kubernetes"
"k8s.io/kubernetes/test/e2e/framework"
admissionapi "k8s.io/pod-security-admission/api"
Expand Down Expand Up @@ -84,7 +84,7 @@ var _ = ginkgo.Describe("BGP Peer Selector", func() {
framework.ExpectNoError(err)
}

resources := metallbconfig.ClusterResources{
resources := config.Resources{
Peers: metallb.PeersForContainers(FRRContainers, ipFamily),
}

Expand Down Expand Up @@ -192,7 +192,7 @@ var _ = ginkgo.Describe("BGP Peer Selector", func() {
framework.ExpectNoError(err)
}

resources := metallbconfig.ClusterResources{
resources := config.Resources{
Peers: metallb.PeersForContainers(FRRContainers, ipFamily),
}

Expand Down
8 changes: 4 additions & 4 deletions e2etest/bgptests/dump.go
Expand Up @@ -9,10 +9,10 @@ import (
"path"
"strings"

"go.universe.tf/metallb/e2etest/pkg/executor"
"go.universe.tf/metallb/e2etest/pkg/frr"
"go.universe.tf/metallb/e2etest/pkg/k8s"
"go.universe.tf/metallb/e2etest/pkg/metallb"
"go.universe.tf/e2etest/pkg/executor"
"go.universe.tf/e2etest/pkg/frr"
"go.universe.tf/e2etest/pkg/k8s"
"go.universe.tf/e2etest/pkg/metallb"
clientset "k8s.io/client-go/kubernetes"
"k8s.io/kubernetes/test/e2e/framework"
)
Expand Down
10 changes: 5 additions & 5 deletions e2etest/bgptests/infra_setup.go
Expand Up @@ -8,11 +8,11 @@ import (
"strings"

"github.com/pkg/errors"
"go.universe.tf/metallb/e2etest/pkg/container"
"go.universe.tf/metallb/e2etest/pkg/executor"
frrconfig "go.universe.tf/metallb/e2etest/pkg/frr/config"
frrcontainer "go.universe.tf/metallb/e2etest/pkg/frr/container"
"go.universe.tf/metallb/e2etest/pkg/metallb"
"go.universe.tf/e2etest/pkg/container"
"go.universe.tf/e2etest/pkg/executor"
frrconfig "go.universe.tf/e2etest/pkg/frr/config"
frrcontainer "go.universe.tf/e2etest/pkg/frr/container"
"go.universe.tf/e2etest/pkg/metallb"
clientset "k8s.io/client-go/kubernetes"
)

Expand Down
26 changes: 13 additions & 13 deletions e2etest/bgptests/metrics.go
Expand Up @@ -10,15 +10,15 @@ import (
"github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
metallbv1beta1 "go.universe.tf/metallb/api/v1beta1"
frrconfig "go.universe.tf/metallb/e2etest/pkg/frr/config"
frrcontainer "go.universe.tf/metallb/e2etest/pkg/frr/container"
"go.universe.tf/metallb/e2etest/pkg/k8s"
"go.universe.tf/metallb/e2etest/pkg/metallb"
"go.universe.tf/metallb/e2etest/pkg/metrics"
testservice "go.universe.tf/metallb/e2etest/pkg/service"
metallbconfig "go.universe.tf/metallb/internal/config"
"go.universe.tf/metallb/internal/ipfamily"
"go.universe.tf/metallb/internal/pointer"
"go.universe.tf/e2etest/pkg/config"
frrconfig "go.universe.tf/e2etest/pkg/frr/config"
frrcontainer "go.universe.tf/e2etest/pkg/frr/container"
"go.universe.tf/e2etest/pkg/ipfamily"
"go.universe.tf/e2etest/pkg/k8s"
"go.universe.tf/e2etest/pkg/metallb"
"go.universe.tf/e2etest/pkg/metrics"
"go.universe.tf/e2etest/pkg/pointer"
testservice "go.universe.tf/e2etest/pkg/service"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
clientset "k8s.io/client-go/kubernetes"
Expand Down Expand Up @@ -96,7 +96,7 @@ var _ = ginkgo.Describe("BGP metrics", func() {
ginkgo.DescribeTable("should collect BGP metrics in FRR mode", func(ipFamily ipfamily.Family, poolAddress string, addressTotal int) {
poolName := "bgp-test"

resources := metallbconfig.ClusterResources{
resources := config.Resources{
Pools: []metallbv1beta1.IPAddressPool{
{
ObjectMeta: metav1.ObjectMeta{
Expand Down Expand Up @@ -238,7 +238,7 @@ var _ = ginkgo.Describe("BGP metrics", func() {
peerAddrToName[peerAddr] = c.Name
}

resources := metallbconfig.ClusterResources{
resources := config.Resources{
Pools: []metallbv1beta1.IPAddressPool{
{
ObjectMeta: metav1.ObjectMeta{
Expand Down Expand Up @@ -393,7 +393,7 @@ var _ = ginkgo.Describe("BGP metrics", func() {
})

ginkgo.DescribeTable("BFD metrics from FRR", func(bfd metallbv1beta1.BFDProfile, pairingFamily ipfamily.Family, poolAddresses []string) {
resources := metallbconfig.ClusterResources{
resources := config.Resources{
Pools: []metallbv1beta1.IPAddressPool{
{
ObjectMeta: metav1.ObjectMeta{
Expand Down Expand Up @@ -624,7 +624,7 @@ var _ = ginkgo.Describe("BGP metrics", func() {

ginkgo.By("Creating an invalid configuration")

resources := metallbconfig.ClusterResources{
resources := config.Resources{
Pools: []metallbv1beta1.IPAddressPool{
{
ObjectMeta: metav1.ObjectMeta{
Expand Down
22 changes: 11 additions & 11 deletions e2etest/bgptests/node_selector.go
Expand Up @@ -10,17 +10,17 @@ import (

metallbv1beta1 "go.universe.tf/metallb/api/v1beta1"
metallbv1beta2 "go.universe.tf/metallb/api/v1beta2"
"go.universe.tf/metallb/e2etest/pkg/k8s"
"go.universe.tf/metallb/e2etest/pkg/metallb"
testservice "go.universe.tf/metallb/e2etest/pkg/service"
metallbconfig "go.universe.tf/metallb/internal/config"
"go.universe.tf/metallb/internal/ipfamily"
"go.universe.tf/e2etest/pkg/config"
"go.universe.tf/e2etest/pkg/ipfamily"
"go.universe.tf/e2etest/pkg/k8s"
"go.universe.tf/e2etest/pkg/metallb"
testservice "go.universe.tf/e2etest/pkg/service"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/onsi/ginkgo/v2"

frrconfig "go.universe.tf/metallb/e2etest/pkg/frr/config"
frrcontainer "go.universe.tf/metallb/e2etest/pkg/frr/container"
frrconfig "go.universe.tf/e2etest/pkg/frr/config"
frrcontainer "go.universe.tf/e2etest/pkg/frr/container"
corev1 "k8s.io/api/core/v1"
clientset "k8s.io/client-go/kubernetes"
"k8s.io/kubernetes/test/e2e/framework"
Expand Down Expand Up @@ -71,7 +71,7 @@ var _ = ginkgo.Describe("BGP Node Selector", func() {
expectedNodesForFirstPool := nodesForSelection(allNodes.Items, nodesForFirstPool)
expectedNodesForSecondPool := nodesForSelection(allNodes.Items, nodesForSecondPool)

resources := metallbconfig.ClusterResources{
resources := config.Resources{
Pools: []metallbv1beta1.IPAddressPool{
{
ObjectMeta: metav1.ObjectMeta{
Expand Down Expand Up @@ -144,7 +144,7 @@ var _ = ginkgo.Describe("BGP Node Selector", func() {
expectedNodesForFirstAdv := nodesForSelection(allNodes.Items, nodesForFirstAdv)
expectedNodesForSecondAdv := nodesForSelection(allNodes.Items, nodesForSecondAdv)

resources := metallbconfig.ClusterResources{
resources := config.Resources{
Pools: []metallbv1beta1.IPAddressPool{
{
ObjectMeta: metav1.ObjectMeta{
Expand Down Expand Up @@ -205,7 +205,7 @@ var _ = ginkgo.Describe("BGP Node Selector", func() {
framework.ExpectNoError(err)

ginkgo.By("Setting advertisement with node selector (no matching nodes)")
resources := metallbconfig.ClusterResources{
resources := config.Resources{
Pools: []metallbv1beta1.IPAddressPool{
{
ObjectMeta: metav1.ObjectMeta{
Expand Down Expand Up @@ -273,7 +273,7 @@ var _ = ginkgo.Describe("BGP Node Selector", func() {
allNodes, err := cs.CoreV1().Nodes().List(context.Background(), metav1.ListOptions{})
framework.ExpectNoError(err)

resources := metallbconfig.ClusterResources{
resources := config.Resources{
Pools: []metallbv1beta1.IPAddressPool{
{
ObjectMeta: metav1.ObjectMeta{
Expand Down