Skip to content

Commit

Permalink
e2e: topomgr: add option to specify the SRIOV conf
Browse files Browse the repository at this point in the history
We cannot anticipate all the possible configurations
needed by the SRIOV device plugin: there is too much variety.

Hence, we need to allow the test environment to supply
a host-specific ConfigMap to properly configure the device
plugin and avoid false negatives.

We still provide a the default config map as fallback and reference.

Signed-off-by: Francesco Romani <[email protected]>
  • Loading branch information
ffromani committed Feb 10, 2020
1 parent 6687fcc commit 1b5801a
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
3 changes: 3 additions & 0 deletions test/e2e/framework/test_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,9 @@ type TestContextType struct {

// ProgressReportURL is the URL which progress updates will be posted to as tests complete. If empty, no updates are sent.
ProgressReportURL string

// SriovdpConfigMapFile is the path to the ConfigMap to configure the SRIOV device plugin on this host.
SriovdpConfigMapFile string
}

// NodeKillerConfig describes configuration of NodeKiller -- a utility to
Expand Down
1 change: 1 addition & 0 deletions test/e2e_node/e2e_node_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ func registerNodeFlags(flags *flag.FlagSet) {
flags.StringVar(&framework.TestContext.ImageDescription, "image-description", "", "The description of the image which the test will be running on.")
flags.StringVar(&framework.TestContext.SystemSpecName, "system-spec-name", "", "The name of the system spec (e.g., gke) that's used in the node e2e test. The system specs are in test/e2e_node/system/specs/. This is used by the test framework to determine which tests to run for validating the system requirements.")
flags.Var(cliflag.NewMapStringString(&framework.TestContext.ExtraEnvs), "extra-envs", "The extra environment variables needed for node e2e tests. Format: a list of key=value pairs, e.g., env1=val1,env2=val2")
flags.StringVar(&framework.TestContext.SriovdpConfigMapFile, "sriovdp-configmap-file", "", "The name of the SRIOV device plugin Config Map to load.")
}

func init() {
Expand Down
4 changes: 2 additions & 2 deletions test/e2e_node/testing-manifests/sriovdp-cm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ data:
"resourceName": "intel_sriov_netdevice",
"selectors": {
"vendors": ["8086"],
"devices": ["154c", "10ed", "1521"],
"drivers": ["i40evf", "ixgbevf", "igb"]
"devices": ["154c", "10ed"],
"drivers": ["i40evf", "ixgbevf"]
}
},
{
Expand Down
15 changes: 14 additions & 1 deletion test/e2e_node/topology_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package e2enode
import (
"context"
"fmt"
"io/ioutil"
"os/exec"
"regexp"
"strconv"
Expand Down Expand Up @@ -491,9 +492,21 @@ func runTopologyManagerNodeAlignmentSinglePodTest(f *framework.Framework, sriovR
}

func runTopologyManagerNodeAlignmentSuiteTests(f *framework.Framework, numaNodes int) {
cmData := testfiles.ReadOrDie(SRIOVDevicePluginCMYAML)
var err error

configMap := readConfigMapV1OrDie(testfiles.ReadOrDie(SRIOVDevicePluginCMYAML))
// the SRIOVDP configuration is hw-dependent, so we allow per-test-host customization.
framework.Logf("host-local SRIOV Device Plugin Config Map %q", framework.TestContext.SriovdpConfigMapFile)
if framework.TestContext.SriovdpConfigMapFile != "" {
cmData, err = ioutil.ReadFile(framework.TestContext.SriovdpConfigMapFile)
if err != nil {
framework.Failf("unable to load the SRIOV Device Plugin ConfigMap: %v", err)
}
} else {
framework.Logf("Using built-in SRIOV Device Plugin Config Map")
}

configMap := readConfigMapV1OrDie(cmData)
ginkgo.By(fmt.Sprintf("Creating configMap %v/%v", metav1.NamespaceSystem, configMap.Name))
if _, err = f.ClientSet.CoreV1().ConfigMaps(metav1.NamespaceSystem).Create(context.TODO(), configMap, metav1.CreateOptions{}); err != nil {
framework.Failf("unable to create test configMap %s: %v", configMap.Name, err)
Expand Down

0 comments on commit 1b5801a

Please sign in to comment.