|
|
|
@ -16,7 +16,8 @@ import (
|
|
|
|
|
var DefaultStartTimeout = float64(60 * 60)
|
|
|
|
|
|
|
|
|
|
type Framework struct {
|
|
|
|
|
Config *Config
|
|
|
|
|
Config *Config
|
|
|
|
|
ClusterConfig *ClusterConfig
|
|
|
|
|
|
|
|
|
|
configFile string // 配置文件的路径
|
|
|
|
|
initTimeout float64 // 启动时候,包括安装集群和依赖及本程序的超时时间
|
|
|
|
@ -60,8 +61,17 @@ func (f *Framework) SynchronizedBeforeSuite(initFunc func()) *Framework {
|
|
|
|
|
|
|
|
|
|
// 2. 初始化环境访问的授权,也就是创建kubectl 访问需要的config
|
|
|
|
|
ginkgo.By("kubectl switch context")
|
|
|
|
|
// TODO
|
|
|
|
|
// kubectl config
|
|
|
|
|
kubectlConfig := NewKubectlConfig(f.Config)
|
|
|
|
|
if err := kubectlConfig.SetContext(f.ClusterConfig); err != nil {
|
|
|
|
|
panic(err)
|
|
|
|
|
}
|
|
|
|
|
// 推出前清理context
|
|
|
|
|
defer func() {
|
|
|
|
|
ginkgo.By("kubectl reverting context")
|
|
|
|
|
if !f.Config.Sub("cluster").Sub("kind").GetBool("retain") {
|
|
|
|
|
_ = kubectlConfig.DeleteContext(f.ClusterConfig)
|
|
|
|
|
}
|
|
|
|
|
}()
|
|
|
|
|
|
|
|
|
|
// 3. 安装依赖和我们的程序
|
|
|
|
|
ginkgo.By("Preparing install steps")
|
|
|
|
@ -110,6 +120,7 @@ func (f *Framework) WithConfig(config *Config) *Framework {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO
|
|
|
|
|
// 创建环境之后,填充f.ClusterConfig
|
|
|
|
|
func (f *Framework) DeployTestEnvironment() error {
|
|
|
|
|
return nil
|
|
|
|
|
|
|
|
|
|