Load the toolbox container in the tests
This commit is contained in:
1 parent
060148de2c
commit
434f8ad3e0
3 files changed
+23
-19
No files matched your search
File renamed without changes.
@@ -10,13 +10,14 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/rook/rook/e2e/framework/contracts"
|
||||
"github.com/rook/rook/e2e/framework/enums"
|
||||
"github.com/rook/rook/e2e/framework/objects"
|
||||
"github.com/rook/rook/e2e/framework/transport"
|
||||
"github.com/rook/rook/e2e/framework/utils"
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
type rookTestInfraManager struct {
|
||||
@@ -39,16 +40,16 @@ const (
|
||||
tempImageFileName = "temp_image.tar"
|
||||
rookOperatorFileName = "rook-operator.yaml"
|
||||
rookClusterFileName = "rook-cluster.yaml"
|
||||
rookClientFileName = "rook-client.yaml"
|
||||
rookToolsFileName = "rook-tools.yaml"
|
||||
podSpecPath = "src/github.com/rook/rook/demo/kubernetes"
|
||||
scriptsPath = "scripts"
|
||||
k8sFalsePostiveSuccessErrorMsg = "exit status 1" //When kubectl drain is executed, exit status 1 is always returned in stdout
|
||||
rookDindK8sClusterScriptv1_5 = "rook-dind-cluster-v1.5.sh"
|
||||
rookDindK8sClusterScriptv1_6 = "rook-dind-cluster-v1.6.sh"
|
||||
rookOperatorImagePodSpecTag = "quay.io/rook/rookd:master-latest"
|
||||
rookClientImagePodSpecTag = "quay.io/rook/rook:master-latest"
|
||||
rookToolsImagePodSpecTag = "quay.io/rook/toolbox:master-latest"
|
||||
rookOperatorPrefix = "quay.io/rook/rookd"
|
||||
rookClientPrefix = "quay.io/rook/rook"
|
||||
rookToolboxPrefix = "quay.io/rook/toolbox-amd64"
|
||||
rookOperatorCreatedTpr = "cluster.rook.io"
|
||||
masterContinerName = "kube-master"
|
||||
node1ContinerName = "kube-node-1"
|
||||
@@ -171,6 +172,9 @@ func (r *rookTestInfraManager) copyImageToNode(containerId string, imageName str
|
||||
fmt.Println("Image does not exist locally")
|
||||
}
|
||||
|
||||
cmdOut = utils.ExecuteCommand(objects.CommandArgs{Command: "docker", CmdArgs: []string{"images"}})
|
||||
fmt.Printf("Did not find docker images %s locally\nDocker images:\n%s\n", imageName, cmdOut.StdOut)
|
||||
|
||||
if strings.EqualFold(cmdOut.StdOut, "") {
|
||||
fmt.Println("searching remotely for the docker image: " + imageName)
|
||||
cmdOut := utils.ExecuteCommand(objects.CommandArgs{Command: "docker", CmdArgs: []string{"pull", imageName}})
|
||||
@@ -306,20 +310,20 @@ func createK8sRookOperator(k8sHelper *utils.K8sHelper, tag string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func createK8sRookClient(k8sHelper *utils.K8sHelper, tag string) (err error) {
|
||||
func createK8sRookToolbox(k8sHelper *utils.K8sHelper, tag string) (err error) {
|
||||
|
||||
//Create rook client
|
||||
raw, err := ioutil.ReadFile(path.Join(getPodSpecPath(), rookClientFileName))
|
||||
raw, err := ioutil.ReadFile(path.Join(getPodSpecPath(), rookToolsFileName))
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
if !bytes.Contains(raw, []byte(rookClientImagePodSpecTag)) {
|
||||
return fmt.Errorf(" %s tag to be replaced with %s couldn't be found in rook-client.yaml", rookClientImagePodSpecTag, tag)
|
||||
if !bytes.Contains(raw, []byte(rookToolsImagePodSpecTag)) {
|
||||
return fmt.Errorf(" %s tag to be replaced with %s couldn't be found in rook-tools.yaml", rookToolsImagePodSpecTag, tag)
|
||||
}
|
||||
|
||||
rawUpdated := bytes.Replace(raw, []byte(rookClientImagePodSpecTag), []byte(tag), 1)
|
||||
rawUpdated := bytes.Replace(raw, []byte(rookToolsImagePodSpecTag), []byte(tag), 1)
|
||||
rookClient := string(rawUpdated)
|
||||
|
||||
_, _, exitCode := r.transportClient.CreateWithStdin(rookClient)
|
||||
@@ -328,10 +332,10 @@ func createK8sRookClient(k8sHelper *utils.K8sHelper, tag string) (err error) {
|
||||
return fmt.Errorf(string(exitCode))
|
||||
}
|
||||
|
||||
if !k8sHelper.IsPodRunningInNamespace("rook-client") {
|
||||
return fmt.Errorf("Rook Client couldn't start")
|
||||
if !k8sHelper.IsPodRunningInNamespace("rook-tools") {
|
||||
return fmt.Errorf("Rook Toolbox couldn't start")
|
||||
} else {
|
||||
fmt.Println("Rook Client started")
|
||||
fmt.Println("Rook Toolbox started")
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -374,7 +378,7 @@ func (r *rookTestInfraManager) InstallRook(tag string, skipInstall bool) (err er
|
||||
}
|
||||
|
||||
rookOperatorTag := rookOperatorPrefix + ":" + tag
|
||||
rookClientTag := rookClientPrefix + ":" + tag
|
||||
rookToolboxTag := rookToolboxPrefix + ":" + tag
|
||||
|
||||
err = r.copyImageToNode(r.getContainerIdByName(masterContinerName), rookOperatorTag)
|
||||
if err != nil {
|
||||
@@ -390,17 +394,17 @@ func (r *rookTestInfraManager) InstallRook(tag string, skipInstall bool) (err er
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
err = r.copyImageToNode(r.getContainerIdByName(masterContinerName), rookClientTag)
|
||||
err = r.copyImageToNode(r.getContainerIdByName(masterContinerName), rookToolboxTag)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
err = r.copyImageToNode(r.getContainerIdByName(node1ContinerName), rookClientTag)
|
||||
err = r.copyImageToNode(r.getContainerIdByName(node1ContinerName), rookToolboxTag)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
err = r.copyImageToNode(r.getContainerIdByName(node2ContinerName), rookClientTag)
|
||||
err = r.copyImageToNode(r.getContainerIdByName(node2ContinerName), rookToolboxTag)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -424,7 +428,7 @@ func (r *rookTestInfraManager) InstallRook(tag string, skipInstall bool) (err er
|
||||
time.Sleep(5 * time.Second)
|
||||
|
||||
//Create rook client
|
||||
err = createK8sRookClient(k8sHelp, rookClientTag)
|
||||
err = createK8sRookToolbox(k8sHelp, rookToolboxTag)
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
||||
@@ -133,7 +133,7 @@ rook_infra::cleanup() {
|
||||
|
||||
rook_infra::create
|
||||
rook_infra::try_copy_docker_image_to_rook_infra quay.io/rook/rookd:${tag_name}
|
||||
rook_infra::try_copy_docker_image_to_rook_infra quay.io/rook/rook:${tag_name}
|
||||
rook_infra::try_copy_docker_image_to_rook_infra quay.io/rook/toolbox:${tag_name}
|
||||
rook_infra::init
|
||||
|
||||
rook_infra::run_test SmokeSuite ${tag_name} ${rook_platform} ${k8s_version}
|
||||
|
||||
Reference in new issue
Block a user