Beispiel #1
0
func addStatus(context string, success bool, ciStatus *github.CombinedStatus) {
	status := github.RepoStatus{
		Context: stringPtr(context),
	}
	setStatus(&status, success)
	ciStatus.Statuses = append(ciStatus.Statuses, status)
}
Beispiel #2
0
// 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)
	}
}
Beispiel #3
0
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)
}
Beispiel #4
0
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)
}