Merge pull request #891 from DanielMSchmidt/patch-1

docs(e2e): make example e2e.go compilable
This commit is contained in:
Brian Goff
2020-10-12 15:44:26 -07:00
committed by GitHub

View File

@@ -92,6 +92,9 @@ You will need an `EndToEndTestSuiteConfig` to create an `EndToEndTestSuite` usin
package e2e package e2e
import ( import (
"flag"
"fmt"
"testing"
"time" "time"
vke2e "github.com/virtual-kubelet/virtual-kubelet/test/e2e" vke2e "github.com/virtual-kubelet/virtual-kubelet/test/e2e"
@@ -99,10 +102,13 @@ import (
var ( var (
kubeconfig string kubeconfig string
namespace string namespace string
nodeName string nodeName string
) )
var defaultNamespace = "default"
var defaultNodeName = "default-node"
// Read the following variables from command-line flags // Read the following variables from command-line flags
func init() { func init() {
flag.StringVar(&kubeconfig, "kubeconfig", "", "path to the kubeconfig file to use when running the test suite outside a kubernetes cluster") flag.StringVar(&kubeconfig, "kubeconfig", "", "path to the kubeconfig file to use when running the test suite outside a kubernetes cluster")
@@ -126,6 +132,7 @@ func shouldSkipTest(testName string) bool {
return testName == "TestGetStatsSummary" return testName == "TestGetStatsSummary"
} }
// TestEndToEnd runs the e2e tests against a previously configured cluster
func TestEndToEnd(t *testing.T) { func TestEndToEnd(t *testing.T) {
config := vke2e.EndToEndTestSuiteConfig{ config := vke2e.EndToEndTestSuiteConfig{
Kubeconfig: kubeconfig, Kubeconfig: kubeconfig,
@@ -134,7 +141,7 @@ func TestEndToEnd(t *testing.T) {
Setup: setup, Setup: setup,
Teardown: teardown, Teardown: teardown,
ShouldSkipTest: shouldSkipTest, ShouldSkipTest: shouldSkipTest,
WaitTimeout: 5 * time.Minute, WatchTimeout: 5 * time.Minute,
} }
ts := vke2e.NewEndToEndTestSuite(config) ts := vke2e.NewEndToEndTestSuite(config)
ts.Run(t) ts.Run(t)