-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from fedepaol/withatest
Add the first e2e test
- Loading branch information
Showing
17 changed files
with
2,227 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: "collectlogs" | ||
description: "Collect and upload the logs" | ||
|
||
inputs: | ||
artifact-name: | ||
description: "the name of artifacts to store" | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Log permissions | ||
shell: bash | ||
run: | | ||
sudo chmod -R o+r /tmp/kind_logs | ||
- name: Upload logs | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: ${{ inputs.artifact-name }} | ||
path: /tmp/kind_logs/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
password zebra | ||
log stdout debugging | ||
log file /tmp/frr.log debugging | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# This file tells the frr package which daemons to start. | ||
# | ||
# Sample configurations for these daemons can be found in | ||
# /usr/share/doc/frr/examples/. | ||
# | ||
# ATTENTION: | ||
# | ||
# When activating a daemon for the first time, a config file, even if it is | ||
# empty, has to be present *and* be owned by the user and group "frr", else | ||
# the daemon will not be started by /etc/init.d/frr. The permissions should | ||
# be u=rw,g=r,o=. | ||
# When using "vtysh" such a config file is also needed. It should be owned by | ||
# group "frrvty" and set to ug=rw,o= though. Check /etc/pam.d/frr, too. | ||
# | ||
# The watchfrr and zebra daemons are always started. | ||
# | ||
bgpd=yes | ||
ospfd=no | ||
ospf6d=no | ||
ripd=no | ||
ripngd=no | ||
isisd=no | ||
pimd=no | ||
ldpd=no | ||
nhrpd=no | ||
eigrpd=no | ||
babeld=no | ||
sharpd=no | ||
pbrd=no | ||
bfdd=yes | ||
fabricd=no | ||
vrrpd=no | ||
|
||
# | ||
# If this option is set the /etc/init.d/frr script automatically loads | ||
# the config via "vtysh -b" when the servers are started. | ||
# Check /etc/pam.d/frr if you intend to use "vtysh"! | ||
# | ||
vtysh_enable=yes | ||
zebra_options=" -A 127.0.0.1 -s 90000000" | ||
bgpd_options=" -A 127.0.0.1 -p {{.BGPPort}}" | ||
ospfd_options=" -A 127.0.0.1" | ||
ospf6d_options=" -A ::1" | ||
ripd_options=" -A 127.0.0.1" | ||
ripngd_options=" -A ::1" | ||
isisd_options=" -A 127.0.0.1" | ||
pimd_options=" -A 127.0.0.1" | ||
ldpd_options=" -A 127.0.0.1" | ||
nhrpd_options=" -A 127.0.0.1" | ||
eigrpd_options=" -A 127.0.0.1" | ||
babeld_options=" -A 127.0.0.1" | ||
sharpd_options=" -A 127.0.0.1" | ||
pbrd_options=" -A 127.0.0.1" | ||
staticd_options="-A 127.0.0.1" | ||
bfdd_options=" -A 127.0.0.1" | ||
fabricd_options="-A 127.0.0.1" | ||
vrrpd_options=" -A 127.0.0.1" | ||
|
||
# configuration profile | ||
# | ||
#frr_profile="traditional" | ||
#frr_profile="datacenter" | ||
|
||
# | ||
# This is the maximum number of FD's that will be available. | ||
# Upon startup this is read by the control files and ulimit | ||
# is called. Uncomment and use a reasonable value for your | ||
# setup if you are expecting a large number of peers in | ||
# say BGP. | ||
#MAX_FDS=1024 | ||
|
||
# The list of daemons to watch is automatically generated by the init script. | ||
#watchfrr_options="" | ||
|
||
# for debugging purposes, you can specify a "wrap" command to start instead | ||
# of starting the daemon directly, e.g. to use valgrind on ospfd: | ||
# ospfd_wrap="/usr/bin/valgrind" | ||
# or you can use "all_wrap" for all daemons, e.g. to use perf record: | ||
# all_wrap="/usr/bin/perf record --call-graph -" | ||
# the normal daemon command is added to this at the end. |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
password zebra | ||
enable password zebra |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
// SPDX-License-Identifier:Apache-2.0 | ||
|
||
package e2e | ||
|
||
import ( | ||
"flag" | ||
"fmt" | ||
"os" | ||
"testing" | ||
|
||
"github.com/metallb/frrk8stests/pkg/infra" | ||
_ "github.com/metallb/frrk8stests/tests" | ||
"github.com/onsi/ginkgo/v2" | ||
"github.com/onsi/gomega" | ||
"k8s.io/client-go/tools/clientcmd" | ||
"k8s.io/kubernetes/test/e2e/framework" | ||
e2econfig "k8s.io/kubernetes/test/e2e/framework/config" | ||
) | ||
|
||
var ( | ||
skipDockerCmd bool | ||
reportPath string | ||
prometheusNamespace string | ||
localNics string | ||
externalContainers string | ||
runOnHost bool | ||
bgpNativeMode bool | ||
frrImage string | ||
) | ||
|
||
// handleFlags sets up all flags and parses the command line. | ||
func handleFlags() { | ||
e2econfig.CopyFlags(e2econfig.Flags, flag.CommandLine) | ||
framework.RegisterCommonFlags(flag.CommandLine) | ||
/* | ||
Using framework.RegisterClusterFlags(flag.CommandLine) results in a panic: | ||
"flag redefined: kubeconfig". | ||
This happens because controller-runtime registers the kubeconfig flag as well. | ||
To solve this we set the framework's kubeconfig directly via the KUBECONFIG env var | ||
instead of letting it call the flag. Since we also use the provider flag it is handled manually. | ||
*/ | ||
flag.StringVar(&framework.TestContext.Provider, "provider", "", "The name of the Kubernetes provider (gce, gke, local, skeleton (the fallback if not set), etc.)") | ||
framework.TestContext.KubeConfig = os.Getenv(clientcmd.RecommendedConfigPathEnvVar) | ||
|
||
flag.BoolVar(&skipDockerCmd, "skip-docker", false, "set this to true if the BGP daemon is running on the host instead of in a container") | ||
flag.StringVar(&reportPath, "report-path", "/tmp/report", "the path to be used to dump test failure information") | ||
flag.StringVar(&prometheusNamespace, "prometheus-namespace", "monitoring", "the namespace prometheus is running in (if running)") | ||
flag.StringVar(&externalContainers, "external-containers", "", "a comma separated list of external containers names to use for the test. (valid parameters are: ibgp-single-hop / ibgp-multi-hop / ebgp-single-hop / ebgp-multi-hop)") | ||
flag.StringVar(&frrImage, "frr-image", "quay.io/frrouting/frr:8.4.2", "the image to use for the external frr containers") | ||
|
||
flag.Parse() | ||
|
||
if _, res := os.LookupEnv("RUN_FRR_CONTAINER_ON_HOST_NETWORK"); res { | ||
runOnHost = true | ||
} | ||
} | ||
|
||
func TestMain(m *testing.M) { | ||
// Register test flags, then parse flags. | ||
handleFlags() | ||
if testing.Short() { | ||
return | ||
} | ||
|
||
framework.AfterReadingAllFlags(&framework.TestContext) | ||
|
||
os.Exit(m.Run()) | ||
} | ||
|
||
func TestE2E(t *testing.T) { | ||
if testing.Short() { | ||
return | ||
} | ||
|
||
gomega.RegisterFailHandler(framework.Fail) | ||
ginkgo.RunSpecs(t, "E2E Suite") | ||
} | ||
|
||
var _ = ginkgo.BeforeSuite(func() { | ||
// Make sure the framework's kubeconfig is set. | ||
framework.ExpectNotEqual(framework.TestContext.KubeConfig, "", fmt.Sprintf("%s env var not set", clientcmd.RecommendedConfigPathEnvVar)) | ||
|
||
cs, err := framework.LoadClientset() | ||
framework.ExpectNoError(err) | ||
|
||
switch { | ||
case externalContainers != "": | ||
infra.FRRContainers, err = infra.ExternalContainersSetup(externalContainers, cs) | ||
framework.ExpectNoError(err) | ||
case runOnHost: | ||
infra.FRRContainers, err = infra.HostContainerSetup(frrImage) | ||
framework.ExpectNoError(err) | ||
default: | ||
infra.FRRContainers, err = infra.KindnetContainersSetup(cs, frrImage) | ||
framework.ExpectNoError(err) | ||
/* | ||
vrfFRRContainers, err := bgptests.VRFContainersSetup(cs) | ||
framework.ExpectNoError(err) | ||
bgptests.FRRContainers = append(bgptests.FRRContainers, vrfFRRContainers...) | ||
*/ | ||
} | ||
|
||
//reporter := k8s.InitReporter(framework.TestContext.KubeConfig, reportPath, metallb.Namespace) | ||
}) | ||
|
||
var _ = ginkgo.AfterSuite(func() { | ||
cs, err := framework.LoadClientset() | ||
framework.ExpectNoError(err) | ||
|
||
err = infra.InfraTearDown(cs) | ||
framework.ExpectNoError(err) | ||
/* | ||
err = bgptests.InfraTearDownVRF(cs) | ||
framework.ExpectNoError(err) | ||
*/ | ||
}) |
Oops, something went wrong.