MCPcopy
hub / github.com/kubernetes/test-infra / run

Function run

kubetest/e2e.go:49–332  ·  view source on GitHub ↗
(deploy deployer, o options)

Source from the content-addressed store, hash-verified

47}
48
49func run(deploy deployer, o options) error {
50 cmd, err := deploy.KubectlCommand()
51 if err != nil {
52 return err
53 }
54 if cmd == nil {
55 cmd = exec.Command("./cluster/kubectl.sh")
56 }
57 if o.checkSkew {
58 cmd.Args = append(cmd.Args, "--match-server-version")
59 }
60 os.Setenv("KUBECTL", strings.Join(cmd.Args, " "))
61
62 os.Setenv("KUBE_CONFIG_FILE", "config-test.sh")
63 os.Setenv("KUBE_RUNTIME_CONFIG", o.runtimeConfig)
64
65 var errs []error
66
67 dump, err := util.OptionalAbsPath(o.dump)
68 if err != nil {
69 return fmt.Errorf("failed handling --dump path: %w", err)
70 }
71
72 dumpPreTestLogs, err := util.OptionalAbsPath(o.dumpPreTestLogs)
73 if err != nil {
74 return fmt.Errorf("failed handling --dump-pre-test-logs path: %w", err)
75 }
76
77 if o.up {
78 if err := control.XMLWrap(&suite, "TearDown Previous", deploy.Down); err != nil {
79 return fmt.Errorf("error tearing down previous cluster: %s", err)
80 }
81 }
82
83 // Ensures that the cleanup/down action is performed exactly once.
84 var (
85 downDone = false
86 kubemarkUpErr error
87 )
88
89 var (
90 beforeResources []byte
91 upResources []byte
92 downResources []byte
93 afterResources []byte
94 )
95
96 if o.checkLeaks {
97 errs = util.AppendError(errs, control.XMLWrap(&suite, "listResources Before", func() error {
98 beforeResources, err = listResources()
99 return err
100 }))
101 }
102
103 if o.postTestCmd != "" {
104 // Guaranteed to run after the entire test, including teardown.
105 defer control.XMLWrap(&suite, "Deferred post-test command", func() error {
106 if o.test || (kubemarkUpErr == nil && o.testCmd != "") {

Callers 1

completeFunction · 0.70

Calls 15

RunMethod · 0.95
OptionalAbsPathFunction · 0.92
AppendErrorFunction · 0.92
listResourcesFunction · 0.85
getKubectlVersionFunction · 0.85
listNodesFunction · 0.85
skewTestEnvFunction · 0.85
argFieldsFunction · 0.85
dumpRemoteLogsFunction · 0.85
nodeTestFunction · 0.85
skewTestFunction · 0.85
toBuildTesterOptionsFunction · 0.85

Tested by

no test coverage detected