mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 19:01:49 +00:00
Merge pull request #85235 from oomichi/move-suites
Move suites.go to e2e package
This commit is contained in:
commit
ee1160cf9b
@ -47,6 +47,7 @@ go_library(
|
|||||||
"examples.go",
|
"examples.go",
|
||||||
"gke_local_ssd.go",
|
"gke_local_ssd.go",
|
||||||
"gke_node_pools.go",
|
"gke_node_pools.go",
|
||||||
|
"suites.go",
|
||||||
],
|
],
|
||||||
importpath = "k8s.io/kubernetes/test/e2e",
|
importpath = "k8s.io/kubernetes/test/e2e",
|
||||||
deps = [
|
deps = [
|
||||||
@ -67,6 +68,7 @@ go_library(
|
|||||||
"//test/e2e/framework:go_default_library",
|
"//test/e2e/framework:go_default_library",
|
||||||
"//test/e2e/framework/auth:go_default_library",
|
"//test/e2e/framework/auth:go_default_library",
|
||||||
"//test/e2e/framework/log:go_default_library",
|
"//test/e2e/framework/log:go_default_library",
|
||||||
|
"//test/e2e/framework/metrics:go_default_library",
|
||||||
"//test/e2e/framework/node:go_default_library",
|
"//test/e2e/framework/node:go_default_library",
|
||||||
"//test/e2e/framework/pod:go_default_library",
|
"//test/e2e/framework/pod:go_default_library",
|
||||||
"//test/e2e/framework/providers/aws:go_default_library",
|
"//test/e2e/framework/providers/aws:go_default_library",
|
||||||
|
@ -70,9 +70,9 @@ var _ = ginkgo.SynchronizedBeforeSuite(func() []byte {
|
|||||||
})
|
})
|
||||||
|
|
||||||
var _ = ginkgo.SynchronizedAfterSuite(func() {
|
var _ = ginkgo.SynchronizedAfterSuite(func() {
|
||||||
framework.CleanupSuite()
|
CleanupSuite()
|
||||||
}, func() {
|
}, func() {
|
||||||
framework.AfterSuiteActions()
|
AfterSuiteActions()
|
||||||
})
|
})
|
||||||
|
|
||||||
// RunE2ETests checks configuration parameters (specified through flags) and then runs
|
// RunE2ETests checks configuration parameters (specified through flags) and then runs
|
||||||
|
@ -22,7 +22,6 @@ go_library(
|
|||||||
"resource_usage_gatherer.go",
|
"resource_usage_gatherer.go",
|
||||||
"size.go",
|
"size.go",
|
||||||
"skip.go",
|
"skip.go",
|
||||||
"suites.go",
|
|
||||||
"test_context.go",
|
"test_context.go",
|
||||||
"util.go",
|
"util.go",
|
||||||
],
|
],
|
||||||
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package framework
|
package e2e
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -22,7 +22,7 @@ import (
|
|||||||
"path"
|
"path"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
// TODO: Remove the following imports (ref: https://github.com/kubernetes/kubernetes/issues/81245)
|
"k8s.io/kubernetes/test/e2e/framework"
|
||||||
e2emetrics "k8s.io/kubernetes/test/e2e/framework/metrics"
|
e2emetrics "k8s.io/kubernetes/test/e2e/framework/metrics"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -32,36 +32,36 @@ import (
|
|||||||
// and then the function that only runs on the first Ginkgo node.
|
// and then the function that only runs on the first Ginkgo node.
|
||||||
func CleanupSuite() {
|
func CleanupSuite() {
|
||||||
// Run on all Ginkgo nodes
|
// Run on all Ginkgo nodes
|
||||||
Logf("Running AfterSuite actions on all nodes")
|
framework.Logf("Running AfterSuite actions on all nodes")
|
||||||
RunCleanupActions()
|
framework.RunCleanupActions()
|
||||||
}
|
}
|
||||||
|
|
||||||
// AfterSuiteActions are actions that are run on ginkgo's SynchronizedAfterSuite
|
// AfterSuiteActions are actions that are run on ginkgo's SynchronizedAfterSuite
|
||||||
func AfterSuiteActions() {
|
func AfterSuiteActions() {
|
||||||
// Run only Ginkgo on node 1
|
// Run only Ginkgo on node 1
|
||||||
Logf("Running AfterSuite actions on node 1")
|
framework.Logf("Running AfterSuite actions on node 1")
|
||||||
if TestContext.ReportDir != "" {
|
if framework.TestContext.ReportDir != "" {
|
||||||
CoreDump(TestContext.ReportDir)
|
framework.CoreDump(framework.TestContext.ReportDir)
|
||||||
}
|
}
|
||||||
if TestContext.GatherSuiteMetricsAfterTest {
|
if framework.TestContext.GatherSuiteMetricsAfterTest {
|
||||||
if err := gatherTestSuiteMetrics(); err != nil {
|
if err := gatherTestSuiteMetrics(); err != nil {
|
||||||
Logf("Error gathering metrics: %v", err)
|
framework.Logf("Error gathering metrics: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if TestContext.NodeKiller.Enabled {
|
if framework.TestContext.NodeKiller.Enabled {
|
||||||
close(TestContext.NodeKiller.NodeKillerStopCh)
|
close(framework.TestContext.NodeKiller.NodeKillerStopCh)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func gatherTestSuiteMetrics() error {
|
func gatherTestSuiteMetrics() error {
|
||||||
Logf("Gathering metrics")
|
framework.Logf("Gathering metrics")
|
||||||
c, err := LoadClientset()
|
c, err := framework.LoadClientset()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error loading client: %v", err)
|
return fmt.Errorf("error loading client: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Grab metrics for apiserver, scheduler, controller-manager, kubelet (for non-kubemark case) and cluster autoscaler (optionally).
|
// Grab metrics for apiserver, scheduler, controller-manager, kubelet (for non-kubemark case) and cluster autoscaler (optionally).
|
||||||
grabber, err := e2emetrics.NewMetricsGrabber(c, nil, !ProviderIs("kubemark"), true, true, true, TestContext.IncludeClusterAutoscalerMetrics)
|
grabber, err := e2emetrics.NewMetricsGrabber(c, nil, !framework.ProviderIs("kubemark"), true, true, true, framework.TestContext.IncludeClusterAutoscalerMetrics)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to create MetricsGrabber: %v", err)
|
return fmt.Errorf("failed to create MetricsGrabber: %v", err)
|
||||||
}
|
}
|
||||||
@ -73,13 +73,13 @@ func gatherTestSuiteMetrics() error {
|
|||||||
|
|
||||||
metricsForE2E := (*e2emetrics.ComponentCollection)(&received)
|
metricsForE2E := (*e2emetrics.ComponentCollection)(&received)
|
||||||
metricsJSON := metricsForE2E.PrintJSON()
|
metricsJSON := metricsForE2E.PrintJSON()
|
||||||
if TestContext.ReportDir != "" {
|
if framework.TestContext.ReportDir != "" {
|
||||||
filePath := path.Join(TestContext.ReportDir, "MetricsForE2ESuite_"+time.Now().Format(time.RFC3339)+".json")
|
filePath := path.Join(framework.TestContext.ReportDir, "MetricsForE2ESuite_"+time.Now().Format(time.RFC3339)+".json")
|
||||||
if err := ioutil.WriteFile(filePath, []byte(metricsJSON), 0644); err != nil {
|
if err := ioutil.WriteFile(filePath, []byte(metricsJSON), 0644); err != nil {
|
||||||
return fmt.Errorf("error writing to %q: %v", filePath, err)
|
return fmt.Errorf("error writing to %q: %v", filePath, err)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Logf("\n\nTest Suite Metrics:\n%s\n", metricsJSON)
|
framework.Logf("\n\nTest Suite Metrics:\n%s\n", metricsJSON)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
Loading…
Reference in New Issue
Block a user