mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 19:01:49 +00:00
Remove dependency on test/integration from kubemark
This commit is contained in:
parent
3b57f868d3
commit
9bbcb5e3b8
@ -64,8 +64,8 @@ import (
|
||||
_ "k8s.io/kubernetes/plugin/pkg/scheduler/algorithmprovider"
|
||||
"k8s.io/kubernetes/plugin/pkg/scheduler/factory"
|
||||
e2e "k8s.io/kubernetes/test/e2e/framework"
|
||||
"k8s.io/kubernetes/test/integration"
|
||||
"k8s.io/kubernetes/test/integration/framework"
|
||||
testutils "k8s.io/kubernetes/test/utils"
|
||||
|
||||
etcd "github.com/coreos/etcd/client"
|
||||
"github.com/golang/glog"
|
||||
@ -210,8 +210,8 @@ func startComponents(firstManifestURL, secondManifestURL string) (string, string
|
||||
cadvisorInterface := new(cadvisortest.Fake)
|
||||
|
||||
// Kubelet (localhost)
|
||||
testRootDir := integration.MakeTempDirOrDie("kubelet_integ_1.", "")
|
||||
configFilePath := integration.MakeTempDirOrDie("config", testRootDir)
|
||||
testRootDir := testutils.MakeTempDirOrDie("kubelet_integ_1.", "")
|
||||
configFilePath := testutils.MakeTempDirOrDie("config", testRootDir)
|
||||
glog.Infof("Using %s as root dir for kubelet #1", testRootDir)
|
||||
cm := cm.NewStubContainerManager()
|
||||
kcfg := kubeletapp.SimpleKubelet(
|
||||
@ -245,7 +245,7 @@ func startComponents(firstManifestURL, secondManifestURL string) (string, string
|
||||
// Kubelet (machine)
|
||||
// Create a second kubelet so that the guestbook example's two redis slaves both
|
||||
// have a place they can schedule.
|
||||
testRootDir = integration.MakeTempDirOrDie("kubelet_integ_2.", "")
|
||||
testRootDir = testutils.MakeTempDirOrDie("kubelet_integ_2.", "")
|
||||
glog.Infof("Using %s as root dir for kubelet #2", testRootDir)
|
||||
|
||||
kcfg = kubeletapp.SimpleKubelet(
|
||||
|
@ -27,7 +27,7 @@ import (
|
||||
containertest "k8s.io/kubernetes/pkg/kubelet/container/testing"
|
||||
"k8s.io/kubernetes/pkg/kubelet/dockertools"
|
||||
"k8s.io/kubernetes/pkg/volume/empty_dir"
|
||||
"k8s.io/kubernetes/test/integration"
|
||||
"k8s.io/kubernetes/test/utils"
|
||||
|
||||
"github.com/golang/glog"
|
||||
)
|
||||
@ -45,8 +45,8 @@ func NewHollowKubelet(
|
||||
containerManager cm.ContainerManager,
|
||||
maxPods int, podsPerCore int,
|
||||
) *HollowKubelet {
|
||||
testRootDir := integration.MakeTempDirOrDie("hollow-kubelet.", "")
|
||||
manifestFilePath := integration.MakeTempDirOrDie("manifest", testRootDir)
|
||||
testRootDir := utils.MakeTempDirOrDie("hollow-kubelet.", "")
|
||||
manifestFilePath := utils.MakeTempDirOrDie("manifest", testRootDir)
|
||||
glog.Infof("Using %s as root dir for hollow-kubelet", testRootDir)
|
||||
|
||||
return &HollowKubelet{
|
||||
|
@ -18,9 +18,7 @@ package integration
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"math/rand"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
etcd "github.com/coreos/etcd/client"
|
||||
@ -67,20 +65,6 @@ func deleteAllEtcdKeys() {
|
||||
|
||||
}
|
||||
|
||||
func MakeTempDirOrDie(prefix string, baseDir string) string {
|
||||
if baseDir == "" {
|
||||
baseDir = "/tmp"
|
||||
}
|
||||
tempDir, err := ioutil.TempDir(baseDir, prefix)
|
||||
if err != nil {
|
||||
glog.Fatalf("Can't make a temp rootdir: %v", err)
|
||||
}
|
||||
if err = os.MkdirAll(tempDir, 0750); err != nil {
|
||||
glog.Fatalf("Can't mkdir(%q): %v", tempDir, err)
|
||||
}
|
||||
return tempDir
|
||||
}
|
||||
|
||||
func deletePodOrErrorf(t *testing.T, c *client.Client, ns, name string) {
|
||||
if err := c.Pods(ns).Delete(name, nil); err != nil {
|
||||
t.Errorf("unable to delete pod %v: %v", name, err)
|
||||
|
38
test/utils/tmpdir.go
Normal file
38
test/utils/tmpdir.go
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package utils
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"github.com/golang/glog"
|
||||
)
|
||||
|
||||
func MakeTempDirOrDie(prefix string, baseDir string) string {
|
||||
if baseDir == "" {
|
||||
baseDir = "/tmp"
|
||||
}
|
||||
tempDir, err := ioutil.TempDir(baseDir, prefix)
|
||||
if err != nil {
|
||||
glog.Fatalf("Can't make a temp rootdir: %v", err)
|
||||
}
|
||||
if err = os.MkdirAll(tempDir, 0750); err != nil {
|
||||
glog.Fatalf("Can't mkdir(%q): %v", tempDir, err)
|
||||
}
|
||||
return tempDir
|
||||
}
|
Loading…
Reference in New Issue
Block a user