本文整理汇总了Golang中github.com/google/go-github/github.CombinedStatus类的典型用法代码示例。如果您正苦于以下问题:Golang CombinedStatus类的具体用法?Golang CombinedStatus怎么用?Golang CombinedStatus使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CombinedStatus类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: fakeRunGithubE2ESuccess
// fakeRunGithubE2ESuccess imitates jenkins running
func fakeRunGithubE2ESuccess(ciStatus *github.CombinedStatus, context1Pass, context2Pass bool) {
ciStatus.State = stringPtr("pending")
for id := range ciStatus.Statuses {
status := &ciStatus.Statuses[id]
if *status.Context == requiredReTestContext1 || *status.Context == requiredReTestContext2 {
status.State = stringPtr("pending")
}
}
// short sleep like the test is running
time.Sleep(500 * time.Millisecond)
if context1Pass && context2Pass {
ciStatus.State = stringPtr("success")
}
foundContext1 := false
foundContext2 := false
for id := range ciStatus.Statuses {
status := &ciStatus.Statuses[id]
if *status.Context == requiredReTestContext1 {
setStatus(status, context1Pass)
foundContext1 = true
}
if *status.Context == requiredReTestContext2 {
setStatus(status, context2Pass)
foundContext2 = true
}
}
if !foundContext1 {
addStatus(jenkinsE2EContext, context1Pass, ciStatus)
}
if !foundContext2 {
addStatus(jenkinsUnitContext, context2Pass, ciStatus)
}
}
开发者ID:danielibrahim,项目名称:contrib,代码行数:34,代码来源:submit-queue_test.go
示例2: fakeRunGithubE2ESuccess
// fakeRunGithubE2ESuccess imitates jenkins running
func fakeRunGithubE2ESuccess(ciStatus *github.CombinedStatus, e2ePass, unitPass bool) {
ciStatus.State = stringPtr("pending")
for id := range ciStatus.Statuses {
status := &ciStatus.Statuses[id]
if *status.Context == jenkinsE2EContext || *status.Context == jenkinsUnitContext {
status.State = stringPtr("pending")
}
}
// short sleep like the test is running
time.Sleep(500 * time.Millisecond)
ciStatus.State = stringPtr("success")
foundE2E := false
foundUnit := false
for id := range ciStatus.Statuses {
status := &ciStatus.Statuses[id]
if *status.Context == jenkinsE2EContext {
setStatus(status, e2ePass)
foundE2E = true
}
if *status.Context == jenkinsUnitContext {
setStatus(status, unitPass)
foundUnit = true
}
}
if !foundE2E {
addStatus(jenkinsE2EContext, e2ePass, ciStatus)
}
if !foundUnit {
addStatus(jenkinsUnitContext, unitPass, ciStatus)
}
}
开发者ID:resouer,项目名称:contrib,代码行数:32,代码来源:submit-queue_test.go
示例3: fakeRunGithubE2ESuccess
// fakeRunGithubE2ESuccess imitates the github e2e running, but indicates
// success after a short sleep
func fakeRunGithubE2ESuccess(ciStatus *github.CombinedStatus, shouldPass bool) {
ciStatus.State = stringPtr("pending")
for id := range ciStatus.Statuses {
status := &ciStatus.Statuses[id]
if *status.Context == gceE2EContext {
status.State = stringPtr("pending")
break
}
}
// short sleep like the test is running
time.Sleep(500 * time.Millisecond)
ciStatus.State = stringPtr("success")
found := false
for id := range ciStatus.Statuses {
status := &ciStatus.Statuses[id]
if *status.Context == gceE2EContext {
if shouldPass {
status.State = stringPtr("success")
} else {
status.State = stringPtr("failure")
}
found = true
break
}
}
if !found {
e2eStatus := github.RepoStatus{
Context: stringPtr(gceE2EContext),
State: stringPtr("success"),
}
ciStatus.Statuses = append(ciStatus.Statuses, e2eStatus)
}
}
开发者ID:josafat,项目名称:contrib,代码行数:35,代码来源:submit-queue_test.go
示例4: addStatus
func addStatus(context string, success bool, ciStatus *github.CombinedStatus) {
status := github.RepoStatus{
Context: stringPtr(context),
}
setStatus(&status, success)
ciStatus.Statuses = append(ciStatus.Statuses, status)
}
开发者ID:resouer,项目名称:contrib,代码行数:7,代码来源:submit-queue_test.go
示例5: updateStatusState
func updateStatusState(status *github.CombinedStatus) *github.CombinedStatus {
prioMap := map[string]int{
"pending": 4,
"error": 3,
"failure": 2,
"success": 1,
"": 0,
}
backMap := map[int]string{
4: "pending",
3: "error",
2: "failure",
1: "success",
0: "",
}
sint := 1
for _, s := range status.Statuses {
newSint := prioMap[*s.State]
if newSint > sint {
sint = newSint
}
}
status.State = stringPtr(backMap[sint])
return status
}
开发者ID:krancour,项目名称:kubernetes-contrib,代码行数:27,代码来源:github.go
示例6: failGithubStatus
func failGithubStatus(status github.CombinedStatus) github.CombinedStatus {
s := github.RepoStatus{
Context: stringPtr(gceE2EContext),
State: stringPtr("failure"),
}
status.Statuses = append(status.Statuses, s)
return updateStatusState(status)
}
开发者ID:josafat,项目名称:contrib,代码行数:8,代码来源:submit-queue_test.go
示例7: claStatus
func claStatus(status github.CombinedStatus) github.CombinedStatus {
s := github.RepoStatus{
Context: stringPtr("cla/google"),
State: stringPtr("success"),
}
status.Statuses = append(status.Statuses, s)
return updateStatusState(status)
}
开发者ID:josafat,项目名称:contrib,代码行数:8,代码来源:submit-queue_test.go
注:本文中的github.com/google/go-github/github.CombinedStatus类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论