• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang version.CheckCompatibility函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/getgauge/gauge/version.CheckCompatibility函数的典型用法代码示例。如果您正苦于以下问题:Golang CheckCompatibility函数的具体用法?Golang CheckCompatibility怎么用?Golang CheckCompatibility使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了CheckCompatibility函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: startRunner

// Looks for a runner configuration inside the runner directory
// finds the runner configuration matching to the manifest and executes the commands for the current OS
func startRunner(manifest *manifest.Manifest, port string, reporter reporter.Reporter, killChannel chan bool) (*TestRunner, error) {
	var r Runner
	runnerDir, err := getLanguageJSONFilePath(manifest, &r)
	if err != nil {
		return nil, err
	}
	compatibilityErr := version.CheckCompatibility(version.CurrentGaugeVersion, &r.GaugeVersionSupport)
	if compatibilityErr != nil {
		return nil, fmt.Errorf("Compatibility error. %s", compatibilityErr.Error())
	}
	command := getOsSpecificCommand(r)
	env := getCleanEnv(port, os.Environ())
	cmd, err := common.ExecuteCommandWithEnv(command, runnerDir, reporter, reporter, env)
	if err != nil {
		return nil, err
	}
	go func() {
		select {
		case <-killChannel:
			cmd.Process.Kill()
		}
	}()
	// Wait for the process to exit so we will get a detailed error message
	errChannel := make(chan error)
	testRunner := &TestRunner{Cmd: cmd, ErrorChannel: errChannel, mutex: &sync.Mutex{}}
	testRunner.waitAndGetErrorMessage()
	return testRunner, nil
}
开发者ID:jean,项目名称:gauge,代码行数:30,代码来源:runner.go


示例2: startRunner

// Looks for a runner configuration inside the runner directory
// finds the runner configuration matching to the manifest and executes the commands for the current OS
func startRunner(manifest *manifest.Manifest, port string, log *logger.GaugeLogger, killChannel chan bool) (*TestRunner, error) {
	var r Runner
	runnerDir, err := getLanguageJSONFilePath(manifest, &r)
	if err != nil {
		return nil, err
	}
	compatibilityErr := version.CheckCompatibility(version.CurrentGaugeVersion, &r.GaugeVersionSupport)
	if compatibilityErr != nil {
		return nil, errors.New(fmt.Sprintf("Compatible runner version to %s not found. To update plugin, run `gauge --update {pluginName}`.", version.CurrentGaugeVersion))
	}
	command := getOsSpecificCommand(r)
	env := getCleanEnv(port, os.Environ())
	cmd, err := common.ExecuteCommandWithEnv(command, runnerDir, log, log, env)
	if err != nil {
		return nil, err
	}
	go func() {
		select {
		case <-killChannel:
			cmd.Process.Kill()
		}
	}()
	// Wait for the process to exit so we will get a detailed error message
	errChannel := make(chan error)
	waitAndGetErrorMessage(errChannel, cmd, log)
	return &TestRunner{Cmd: cmd, ErrorChannel: errChannel}, nil
}
开发者ID:krwhitney,项目名称:gauge,代码行数:29,代码来源:runner.go


示例3: getLatestCompatibleVersionTo

func (installDesc *installDescription) getLatestCompatibleVersionTo(currentVersion *version.Version) (*versionInstallDescription, error) {
	installDesc.sortVersionInstallDescriptions()
	for _, versionInstallDesc := range installDesc.Versions {
		if err := version.CheckCompatibility(currentVersion, &versionInstallDesc.GaugeVersionSupport); err == nil {
			return &versionInstallDesc, nil
		}
	}
	return nil, fmt.Errorf("Compatible version to %s not found", currentVersion)
}
开发者ID:0-T-0,项目名称:gauge,代码行数:9,代码来源:install.go


示例4: TestCheckVersionCompatibilityFailure

func (s *MySuite) TestCheckVersionCompatibilityFailure(c *C) {
	versionsSupported := &version.VersionSupport{"0.6.5", "1.8.5"}
	gaugeVersion := &version.Version{1, 9, 9}
	c.Assert(version.CheckCompatibility(gaugeVersion, versionsSupported), NotNil)

	versionsSupported = &version.VersionSupport{"0.0.1", "0.0.1"}
	gaugeVersion = &version.Version{0, 0, 2}
	c.Assert(version.CheckCompatibility(gaugeVersion, versionsSupported), NotNil)

	versionsSupported = &version.VersionSupport{Minimum: "1.3.1"}
	gaugeVersion = &version.Version{1, 3, 0}
	c.Assert(version.CheckCompatibility(gaugeVersion, versionsSupported), NotNil)

	versionsSupported = &version.VersionSupport{Minimum: "0.5.1"}
	gaugeVersion = &version.Version{0, 0, 9}
	c.Assert(version.CheckCompatibility(gaugeVersion, versionsSupported), NotNil)

}
开发者ID:ranjeet-floyd,项目名称:gauge,代码行数:18,代码来源:install_test.go


示例5: TestCheckVersionCompatibilitySuccess

func (s *MySuite) TestCheckVersionCompatibilitySuccess(c *C) {
	versionSupported := &version.VersionSupport{"0.6.5", "1.8.5"}
	gaugeVersion := &version.Version{0, 6, 7}
	c.Assert(version.CheckCompatibility(gaugeVersion, versionSupported), Equals, nil)

	versionSupported = &version.VersionSupport{"0.0.1", "0.0.1"}
	gaugeVersion = &version.Version{0, 0, 1}
	c.Assert(version.CheckCompatibility(gaugeVersion, versionSupported), Equals, nil)

	versionSupported = &version.VersionSupport{Minimum: "0.0.1"}
	gaugeVersion = &version.Version{1, 5, 2}
	c.Assert(version.CheckCompatibility(gaugeVersion, versionSupported), Equals, nil)

	versionSupported = &version.VersionSupport{Minimum: "0.5.1"}
	gaugeVersion = &version.Version{0, 5, 1}
	c.Assert(version.CheckCompatibility(gaugeVersion, versionSupported), Equals, nil)

}
开发者ID:ranjeet-floyd,项目名称:gauge,代码行数:18,代码来源:install_test.go


示例6: IsCompatiblePluginInstalled

// IsCompatiblePluginInstalled checks if a plugin compatible to gauge is installed
// TODO: This always checks if latest installed version of a given plugin is compatible. This should also check for older versions.
func IsCompatiblePluginInstalled(pluginName string, isRunner bool) bool {
	if isRunner {
		return isCompatibleLanguagePluginInstalled(pluginName)
	}
	pd, err := plugin.GetPluginDescriptor(pluginName, "")
	if err != nil {
		return false
	}
	return version.CheckCompatibility(version.CurrentGaugeVersion, &pd.GaugeVersionSupport) == nil
}
开发者ID:mattdotmatt,项目名称:gauge,代码行数:12,代码来源:install.go


示例7: IsCompatibleLanguagePluginInstalled

func IsCompatibleLanguagePluginInstalled(name string) bool {
	jsonFilePath, err := plugin.GetLanguageJSONFilePath(name)
	if err != nil {
		return false
	}

	r, err := getRunnerJSONContents(jsonFilePath)
	if err != nil {
		return false
	}
	return (version.CheckCompatibility(version.CurrentGaugeVersion, &r.GaugeVersionSupport) == nil)
}
开发者ID:0-T-0,项目名称:gauge,代码行数:12,代码来源:install.go


示例8: isCompatiblePluginInstalled

func isCompatiblePluginInstalled(pluginName string, pluginVersion string, isRunner bool) bool {
	if isRunner {
		return IsCompatibleLanguagePluginInstalled(pluginName)
	} else {
		pd, err := plugin.GetPluginDescriptor(pluginName, pluginVersion)
		if err != nil {
			return false
		}
		err = version.CheckCompatibility(version.CurrentGaugeVersion, &pd.GaugeVersionSupport)
		if err != nil {
			return false
		}
		return true
	}
}
开发者ID:krwhitney,项目名称:gauge,代码行数:15,代码来源:install.go


示例9: IsCompatibleLanguagePluginInstalled

func IsCompatibleLanguagePluginInstalled(name string) bool {
	jsonFilePath, err := common.GetLanguageJSONFilePath(name)
	if err != nil {
		return false
	}
	var r runner.Runner
	contents, err := common.ReadFileContents(jsonFilePath)
	if err != nil {
		return false
	}
	err = json.Unmarshal([]byte(contents), &r)
	if err != nil {
		return false
	}
	return (version.CheckCompatibility(version.CurrentGaugeVersion, &r.GaugeVersionSupport) == nil)
}
开发者ID:krwhitney,项目名称:gauge,代码行数:16,代码来源:install.go


示例10: startPluginsForExecution

func startPluginsForExecution(manifest *manifest.Manifest) (*Handler, []string) {
	var warnings []string
	handler := &Handler{}
	envProperties := make(map[string]string)

	for _, pluginID := range manifest.Plugins {
		pd, err := GetPluginDescriptor(pluginID, "")
		if err != nil {
			warnings = append(warnings, fmt.Sprintf("Error starting plugin %s. Failed to get plugin.json. %s. To install, run `gauge --install %s`.", pluginID, err.Error(), pluginID))
			continue
		}
		compatibilityErr := version.CheckCompatibility(version.CurrentGaugeVersion, &pd.GaugeVersionSupport)
		if compatibilityErr != nil {
			warnings = append(warnings, fmt.Sprintf("Compatible %s plugin version to current Gauge version %s not found", pd.Name, version.CurrentGaugeVersion))
			continue
		}
		if isExecutionScopePlugin(pd) {
			gaugeConnectionHandler, err := conn.NewGaugeConnectionHandler(0, nil)
			if err != nil {
				warnings = append(warnings, err.Error())
				continue
			}
			envProperties[pluginConnectionPortEnv] = strconv.Itoa(gaugeConnectionHandler.ConnectionPortNumber())
			err = SetEnvForPlugin(executionScope, pd, manifest, envProperties)
			if err != nil {
				warnings = append(warnings, fmt.Sprintf("Error setting environment for plugin %s %s. %s", pd.Name, pd.Version, err.Error()))
				continue
			}

			plugin, err := StartPlugin(pd, executionScope)
			if err != nil {
				warnings = append(warnings, fmt.Sprintf("Error starting plugin %s %s. %s", pd.Name, pd.Version, err.Error()))
				continue
			}
			pluginConnection, err := gaugeConnectionHandler.AcceptConnection(config.PluginConnectionTimeout(), make(chan error))
			if err != nil {
				warnings = append(warnings, fmt.Sprintf("Error starting plugin %s %s. Failed to connect to plugin. %s", pd.Name, pd.Version, err.Error()))
				plugin.pluginCmd.Process.Kill()
				continue
			}
			plugin.connection = pluginConnection
			handler.addPlugin(pluginID, plugin)
		}

	}
	return handler, warnings
}
开发者ID:mattdotmatt,项目名称:gauge,代码行数:47,代码来源:plugin.go


示例11: installPluginWithDescription

func installPluginWithDescription(installDescription *installDescription, currentVersion string) installResult {
	var versionInstallDescription *versionInstallDescription
	var err error
	if currentVersion != "" {
		versionInstallDescription, err = installDescription.getVersion(currentVersion)
		if err != nil {
			return installError(err.Error())
		}
		if compatibilityError := version.CheckCompatibility(version.CurrentGaugeVersion, &versionInstallDescription.GaugeVersionSupport); compatibilityError != nil {
			return installError(fmt.Sprintf("Plugin Version %s-%s is not supported for gauge %s : %s", installDescription.Name, versionInstallDescription.Version, version.CurrentGaugeVersion.String(), compatibilityError.Error()))
		}
	} else {
		versionInstallDescription, err = installDescription.getLatestCompatibleVersionTo(version.CurrentGaugeVersion)
		if err != nil {
			return installError(fmt.Sprintf("Could not find compatible version for plugin %s. : %s", installDescription.Name, err))
		}
	}
	return installPluginVersion(installDescription, versionInstallDescription)
}
开发者ID:0-T-0,项目名称:gauge,代码行数:19,代码来源:install.go



注:本文中的github.com/getgauge/gauge/version.CheckCompatibility函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang fdcount.Matching函数代码示例发布时间:2022-05-23
下一篇:
Golang util.IsSpec函数代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap