forked from sealerio/sealer
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add join test and optimize build test
- Loading branch information
Showing
8 changed files
with
123 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,62 @@ | ||
package test | ||
|
||
import ( | ||
"fmt" | ||
"strconv" | ||
"strings" | ||
|
||
"github.com/alibaba/sealer/test/suites/apply" | ||
"github.com/alibaba/sealer/test/testhelper" | ||
"github.com/alibaba/sealer/test/testhelper/settings" | ||
. "github.com/onsi/ginkgo" | ||
. "github.com/onsi/gomega" | ||
. "github.com/onsi/gomega/gexec" | ||
) | ||
|
||
var _ = Describe("sealer run", func() { | ||
Context("start run", func() { | ||
Context("regular scenario", func() { | ||
Context("run on ali cloud", func() { | ||
AfterEach(func() { | ||
apply.DeleteClusterByFile(settings.GetClusterWorkClusterfile(settings.ClusterNameForRun)) | ||
}) | ||
|
||
It("exec sealer run", func() { | ||
master := "1" | ||
node := "1" | ||
cmd := fmt.Sprintf("%s run %s -m %s -n %s", settings.DefaultSealerBin, settings.ImageNameForRun, master, node) | ||
sess, err := testhelper.Start(cmd) | ||
Expect(err).NotTo(HaveOccurred()) | ||
Eventually(sess, settings.MaxWaiteTime).Should(Exit(0)) | ||
apply.CheckNodeNumLocally(2) | ||
}) | ||
|
||
}) | ||
Context("run on ali cloud", func() { | ||
AfterEach(func() { | ||
apply.DeleteClusterByFile(settings.GetClusterWorkClusterfile(settings.ClusterNameForRun)) | ||
}) | ||
|
||
It("exec sealer run", func() { | ||
master := strconv.Itoa(1) | ||
node := strconv.Itoa(1) | ||
apply.SealerRun(master, node, "") | ||
apply.CheckNodeNumLocally(2) | ||
}) | ||
|
||
}) | ||
|
||
Context("run on bareMetal", func() { | ||
var tempFile string | ||
BeforeEach(func() { | ||
tempFile = testhelper.CreateTempFile() | ||
}) | ||
|
||
AfterEach(func() { | ||
testhelper.RemoveTempFile(tempFile) | ||
}) | ||
|
||
It("bareMetal run", func() { | ||
rawCluster := apply.LoadClusterFileFromDisk(apply.GetRawClusterFilePath()) | ||
By("start to prepare infra") | ||
usedCluster := apply.CreateAliCloudInfraAndSave(rawCluster, tempFile) | ||
//defer to delete cluster | ||
defer func() { | ||
apply.CleanUpAliCloudInfra(usedCluster) | ||
}() | ||
sshClient := testhelper.NewSSHClientByCluster(usedCluster) | ||
Eventually(func() bool { | ||
err := sshClient.SSH.Copy(sshClient.RemoteHostIP, settings.DefaultSealerBin, settings.DefaultSealerBin) | ||
return err == nil | ||
}, settings.MaxWaiteTime).Should(BeTrue()) | ||
|
||
By("start to init cluster", func() { | ||
masters := strings.Join(usedCluster.Spec.Masters.IPList, ",") | ||
nodes := strings.Join(usedCluster.Spec.Nodes.IPList, ",") | ||
apply.SendAndRunCluster(sshClient, tempFile, masters, nodes, usedCluster.Spec.SSH.Passwd) | ||
apply.CheckNodeNumWithSSH(sshClient, 2) | ||
}) | ||
|
||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters