Repository: jenkins-x/lighthouse
Pull request #680 (2020-04-22 19:28:19)

chore(deps): bump from
Update [jenkins-x/go-scm](https://github.com/jenkins-x/go-scm) from v1.5.99 to 1.5.100

Command run was `jx step create pr go --name github.com/jenkins-x/go-scm --version 1.5.100 --build make mod --repo https://github.com/jenkins-x/lighthouse.git`
<hr />

Update [jenkins-x/jx](https://github.com/jenkins-x/jx) from v0.0.0-20200422130737-877bc4f04855 to [2.1.9](https://github.com/jenkins-x/jx/releases/tag/v2.1.9)

Command run was `jx step create pr go --name github.com/jenkins-x/jx --version 2.1.9 --build make mod --repo https://github.com/jenkins-x/lighthouse.git`


Patch:
diff --git a/dependency-matrix/matrix.md b/dependency-matrix/matrix.md
index c7b46fd3..39db0645 100644
--- a/dependency-matrix/matrix.md
+++ b/dependency-matrix/matrix.md
@@ -2,5 +2,5 @@
 
 Dependency | Sources | Version | Mismatched versions
 ---------- | ------- | ------- | -------------------
-[jenkins-x/go-scm](https://github.com/jenkins-x/go-scm) |  | [1.5.94]() | 
+[jenkins-x/go-scm](https://github.com/jenkins-x/go-scm) |  | [1.5.100]() | 
 [jenkins-x/jx](https://github.com/jenkins-x/jx) |  | [2.1.6](https://github.com/jenkins-x/jx/releases/tag/v2.1.6) | 
diff --git a/dependency-matrix/matrix.yaml b/dependency-matrix/matrix.yaml
index 94419e7d..fa4c720a 100644
--- a/dependency-matrix/matrix.yaml
+++ b/dependency-matrix/matrix.yaml
@@ -3,11 +3,11 @@ dependencies:
   owner: jenkins-x
   repo: go-scm
   url: https://github.com/jenkins-x/go-scm
-  version: 1.5.94
+  version: 1.5.100
   versionURL: ""
 - host: github.com
   owner: jenkins-x
   repo: jx
   url: https://github.com/jenkins-x/jx
-  version: 2.1.6
-  versionURL: https://github.com/jenkins-x/jx/releases/tag/v2.1.6
+  version: 2.1.9
+  versionURL: https://github.com/jenkins-x/jx/releases/tag/v2.1.9
diff --git a/go.mod b/go.mod
index 378a631d..af9ff4be 100644
--- a/go.mod
+++ b/go.mod
@@ -4,10 +4,11 @@ require (
 	cloud.google.com/go v0.37.4 // indirect
 	github.com/evanphx/json-patch v4.5.0+incompatible
 	github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
+	github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db // indirect
 	github.com/google/go-cmp v0.3.1
 	github.com/gophercloud/gophercloud v0.1.0 // indirect
 	github.com/gorilla/sessions v1.1.3
-	github.com/jenkins-x/go-scm v1.5.99
+	github.com/jenkins-x/go-scm v1.5.100
 	github.com/jenkins-x/jx v0.0.0-20200422130737-877bc4f04855
 	github.com/knative/build v0.7.0
 	github.com/pkg/errors v0.8.1
diff --git a/go.sum b/go.sum
index 9fedd203..dda3cda0 100644
--- a/go.sum
+++ b/go.sum
@@ -410,18 +410,14 @@ github.com/jbrukh/bayesian v0.0.0-20161210175230-bf3f261f9a9c h1:jqLMOnuwp+ac6nI
 github.com/jbrukh/bayesian v0.0.0-20161210175230-bf3f261f9a9c/go.mod h1:SELxwZQq/mPnfPCR2mchLmT4TQaPJvYtLcCtDWSM7vM=
 github.com/jenkins-x/draft-repo v0.0.0-20180417100212-2f66cc518135 h1:3zy/Nvdi9V95Jfu6+W4NAJrHDeypB58FSLyzI3XfO/4=
 github.com/jenkins-x/draft-repo v0.0.0-20180417100212-2f66cc518135/go.mod h1:K/L25ViEpDx196rOZyjn433tAM5zr2F/IouK+3g+DkE=
-github.com/jenkins-x/go-scm v1.5.94 h1:+o0yYkc4/ZeELzKONR5yO8qpm7f/OuqaM/QUjLyFpz8=
-github.com/jenkins-x/go-scm v1.5.94/go.mod h1:PCT338UhP/pQ0IeEeMEf/hoLTYKcH7qjGEKd7jPkeYg=
-github.com/jenkins-x/go-scm v1.5.95 h1:2LhwhB3HiBwM0OkO9hm+ls2GJtvLBoA3Jmc0OH3aLOc=
-github.com/jenkins-x/go-scm v1.5.95/go.mod h1:PCT338UhP/pQ0IeEeMEf/hoLTYKcH7qjGEKd7jPkeYg=
-github.com/jenkins-x/go-scm v1.5.99 h1:eNjv8nntsgn/D8Ffytb+HIpmrIuEwggcquDIMx0me5I=
-github.com/jenkins-x/go-scm v1.5.99/go.mod h1:PCT338UhP/pQ0IeEeMEf/hoLTYKcH7qjGEKd7jPkeYg=
+github.com/jenkins-x/go-scm v1.5.100 h1:YD8yEn4/RT2AwUtphGhrVUgwtdhmQlWfvkBbvnwrOno=
+github.com/jenkins-x/go-scm v1.5.100/go.mod h1:PCT338UhP/pQ0IeEeMEf/hoLTYKcH7qjGEKd7jPkeYg=
 github.com/jenkins-x/golang-jenkins v0.0.0-20180919102630-65b83ad42314 h1:kyBMx/ucSV92S+umX/V6DDaPNynlFFOM9MGJWApltoU=
 github.com/jenkins-x/golang-jenkins v0.0.0-20180919102630-65b83ad42314/go.mod h1:C6j5HgwlHGjRU27W4XCs6jXksqYFo8OdBu+p44jqQeM=
-github.com/jenkins-x/jx v0.0.0-20200420183151-716e150464ad h1:mNs3YEsVkyggw2k+Baaniz3PwT8o7Da4ylWd+MLEMq4=
-github.com/jenkins-x/jx v0.0.0-20200420183151-716e150464ad/go.mod h1:AJ/IR1nGGbDLePNIxD0X9yiGGmlIJDB7+OuiBcT+KHo=
 github.com/jenkins-x/jx v0.0.0-20200422130737-877bc4f04855 h1:76PBOzKP59jcM4/EZfQHbpsRzTmlSg5UB9SpTR7MRAw=
 github.com/jenkins-x/jx v0.0.0-20200422130737-877bc4f04855/go.mod h1:AJ/IR1nGGbDLePNIxD0X9yiGGmlIJDB7+OuiBcT+KHo=
+github.com/jenkins-x/jx v0.0.0-20200422185619-b02a6f83fc15 h1:iISq9INwZaSji7ZLH5ijStCqZdUrMkkbSUkkBwSuoY4=
+github.com/jenkins-x/jx v0.0.0-20200422185619-b02a6f83fc15/go.mod h1:AJ/IR1nGGbDLePNIxD0X9yiGGmlIJDB7+OuiBcT+KHo=
 github.com/jenkins-x/logrus-stackdriver-formatter v0.1.1-0.20200408213659-1dcf20c371bb h1:woC0LbYpL9rgwZn13Z0KQBEGAmi9ugpWgWtQezHqsBM=
 github.com/jenkins-x/logrus-stackdriver-formatter v0.1.1-0.20200408213659-1dcf20c371bb/go.mod h1:Erk5rrGYkvFlFAoVbz/7obMDEIUFCEbhK1odoR0Msqo=
 github.com/jenkins-x/sonobuoy v0.11.7-0.20190318120422-253758214767 h1:lKtC9uHyWi8wd+EUch3Pfzk3/8XSJvYRJhvk9dK4YKY=
diff --git a/pkg/keeper/keeper.go b/pkg/keeper/keeper.go
index 9de37f4c..50fbede3 100644
--- a/pkg/keeper/keeper.go
+++ b/pkg/keeper/keeper.go
@@ -572,17 +572,6 @@ const (
 	successState simpleState = "success"
 )
 
-func githubqlStatusStateToSimpleState(gqlState githubql.StatusState) simpleState {
-	switch gqlState {
-	case githubql.StatusStateSuccess:
-		return successState
-	case githubql.StatusStateExpected, githubql.StatusStatePending:
-		return pendingState
-	default:
-		return failureState
-	}
-}
-
 func toSimpleState(s v1alpha1.PipelineState) simpleState {
 	if s == v1alpha1.TriggeredState || s == v1alpha1.PendingState || s == v1alpha1.RunningState {
 		return pendingState
@@ -658,7 +647,7 @@ func pickSmallestPassingNumber(log *logrus.Entry, spc scmProviderClient, prs []P
 // accumulateBatch returns a list of PRs that can be merged after passing batch
 // testing, if any exist. It also returns a list of PRs currently being batch
 // tested.
-func accumulateBatch(presubmits map[int][]config.Presubmit, prs []PullRequest, pjs []v1alpha1.LighthouseJob, spc scmProviderClient, log *logrus.Entry) ([]PullRequest, []PullRequest) {
+func accumulateBatch(presubmits map[int][]config.Presubmit, prs []PullRequest, pjs []v1alpha1.LighthouseJob, log *logrus.Entry) ([]PullRequest, []PullRequest) {
 	log.Debug("accumulating PRs for batch testing")
 	if len(presubmits) == 0 {
 		log.Debug("no presubmits configured, no batch can be triggered")
@@ -711,22 +700,6 @@ func accumulateBatch(presubmits map[int][]config.Presubmit, prs []PullRequest, p
 		context := pj.Spec.Context
 		jobState := toSimpleState(pj.Status.State)
 
-		// Check for possible override cases by looking for the PR with the PJ's lastCommitSHA and checking its statuses.
-		for _, pr := range states[ref].prs {
-			if prHeadIsInPJPulls(pr, pj) {
-				contextStatuses, err := headContexts(log, spc, &pr)
-				if err != nil {
-					log.WithError(err).Error("Error getting head contexts, solely using PJs for status")
-				}
-				// Iterate over contexts and reset the job state if the context matches and is overridden.
-				for _, contextInfo := range contextStatuses {
-					if string(contextInfo.Context) == context {
-						jobState = commitStatusOrPJStatusForContext(contextInfo, jobState)
-					}
-				}
-			}
-		}
-
 		// Store the best result for this ref+context.
 		if s, ok := states[ref].jobStates[context]; !ok || s == failureState || jobState == successState {
 			states[ref].jobStates[context] = jobState
@@ -765,27 +738,12 @@ func accumulateBatch(presubmits map[int][]config.Presubmit, prs []PullRequest, p
 	return successBatch, pendingBatch
 }
 
-// prHeadIsInPJPulls checks to see if the given pull request's head sha is one of the pull shas in the job.
-func prHeadIsInPJPulls(pr PullRequest, pj v1alpha1.LighthouseJob) bool {
-	for _, pull := range pj.Spec.Refs.Pulls {
-		if pull.SHA == string(pr.HeadRefOID) {
-			return true
-		}
-	}
-	return false
-}
-
 // accumulate returns the supplied PRs sorted into three buckets based on their
 // accumulated state across the presubmits.
-func accumulate(presubmits map[int][]config.Presubmit, prs []PullRequest, pjs []v1alpha1.LighthouseJob, spc scmProviderClient, log *logrus.Entry) (successes, pendings, missings []PullRequest, missingTests map[int][]config.Presubmit) {
+func accumulate(presubmits map[int][]config.Presubmit, prs []PullRequest, pjs []v1alpha1.LighthouseJob, log *logrus.Entry) (successes, pendings, missings []PullRequest, missingTests map[int][]config.Presubmit) {
 
 	missingTests = map[int][]config.Presubmit{}
 	for _, pr := range prs {
-		// Get the actual contexts for the HEAD of the PR as well, to deal with things like override.
-		contexts, err := headContexts(log, spc, &pr)
-		if err != nil {
-			log.WithError(err).Error("Error getting head contexts, solely using PJs for status")
-		}
 		// Accumulate the best result for each job (Passing > Pending > Failing/Unknown)
 		// We can ignore the baseSHA here because the subPool only contains PipelineActivitys with the correct baseSHA
 		psStates := make(map[string]simpleState)
@@ -809,13 +767,6 @@ func accumulate(presubmits map[int][]config.Presubmit, prs []PullRequest, pjs []
 				psStates[name] = successState
 			}
 		}
-		// Iterate over the commit status contexts
-		for _, contextInfo := range contexts {
-			// If there's already a state recorded, see if it needs to be updated due to override.
-			if existingState, ok := psStates[string(contextInfo.Context)]; ok {
-				psStates[string(contextInfo.Context)] = commitStatusOrPJStatusForContext(contextInfo, existingState)
-			}
-		}
 		// The overall result for the PR is the worst of the best of all its
 		// required Presubmits
 		overallState := successState
@@ -848,17 +799,6 @@ func accumulate(presubmits map[int][]config.Presubmit, prs []PullRequest, pjs []
 	return
 }
 
-func commitStatusOrPJStatusForContext(contextInfo Context, existingStatus simpleState) simpleState {
-	// If the context status is success, the existing status is neither an empty string nor success, and the context
-	// status description starts with util.OverriddenByPrefix, let's overwrite the state for the context.
-	contextState := githubqlStatusStateToSimpleState(contextInfo.State)
-	if existingStatus != "" && contextState == successState && existingStatus != successState &&
-		strings.HasPrefix(string(contextInfo.Description), util.OverriddenByPrefix) {
-		return contextState
-	}
-	return existingStatus
-}
-
 func prNumbers(prs []PullRequest) []int {
 	var nums []int
 	for _, pr := range prs {
@@ -1310,8 +1250,8 @@ func (c *DefaultController) presubmitsByPull(sp *subpool) (map[int][]config.Pres
 
 func (c *DefaultController) syncSubpool(sp subpool, blocks []blockers.Blocker) (Pool, error) {
 	sp.log.Infof("Syncing subpool: %d PRs, %d PJs.", len(sp.prs), len(sp.pjs))
-	successes, pendings, missings, missingSerialTests := accumulate(sp.presubmits, sp.prs, sp.pjs, c.spc, sp.log)
-	batchMerge, batchPending := accumulateBatch(sp.presubmits, sp.prs, sp.pjs, c.spc, sp.log)
+	successes, pendings, missings, missingSerialTests := accumulate(sp.presubmits, sp.prs, sp.pjs, sp.log)
+	batchMerge, batchPending := accumulateBatch(sp.presubmits, sp.prs, sp.pjs, sp.log)
 	sp.log.WithFields(logrus.Fields{
 		"prs-passing":   prNumbers(successes),
 		"prs-pending":   prNumbers(pendings),
diff --git a/pkg/plugins/override/override.go b/pkg/plugins/override/override.go
index cfca9afa..5745d05d 100644
--- a/pkg/plugins/override/override.go
+++ b/pkg/plugins/override/override.go
@@ -69,7 +69,13 @@ type client struct {
 }
 
 func (c client) createOverrideJob(job *v1alpha1.LighthouseJob) (*v1alpha1.LighthouseJob, error) {
-	return c.lhClient.Create(job)
+	overrideStatus := job.Status
+	createdJob, err := c.lhClient.Create(job)
+	if err != nil {
+		return nil, err
+	}
+	createdJob.Status = overrideStatus
+	return c.lhClient.UpdateStatus(createdJob)
 }
 
 func (c client) CreateComment(owner, repo string, number int, pr bool, comment string) error {
diff --git a/pkg/webhook/webhook.go b/pkg/webhook/webhook.go
index b4343fc0..692e4021 100644
--- a/pkg/webhook/webhook.go
+++ b/pkg/webhook/webhook.go
@@ -61,6 +61,7 @@ type Options struct {
 	gitServerURL     string
 	configMapWatcher *watcher.ConfigMapWatcher
 	gitClient        git.Client
+	launcher         launcher.PipelineLauncher
 }
 
 // NewCmdWebhook creates the command
@@ -132,6 +133,18 @@ func (o *Options) Run() error {
 
 	o.gitClient = gitClient
 
+	_, jxClient, _, lhClient, _, err := clients.GetClientsAndNamespace(nil)
+	if err != nil {
+		err = errors.Wrapf(err, "failed to create JX client")
+		logrus.Errorf("%s", err.Error())
+		return err
+	}
+	o.launcher, err = launcher.NewLauncher(jxClient, lhClient, o.namespace)
+	if err != nil {
+		err = errors.Wrapf(err, "failed to create PipelineLauncher client")
+		logrus.Errorf("%s", err.Error())
+		return err
+	}
 	mux := http.NewServeMux()
 	mux.Handle(HealthPath, http.HandlerFunc(o.health))
 	mux.Handle(ReadyPath, http.HandlerFunc(o.ready))
@@ -261,6 +274,7 @@ func (o *Options) handleWebHookRequests(w http.ResponseWriter, r *http.Request)
 		KubernetesClient:  kubeClient,
 		GitClient:         o.gitClient,
 		LighthouseClient:  lhClient.LighthouseV1alpha1().LighthouseJobs(o.namespace),
+		LauncherClient:    o.launcher,
 	}
 	l, output, err := o.ProcessWebHook(logrus.WithField("Webhook", webhook.Kind()), webhook)
 	if err != nil {
@@ -313,11 +327,6 @@ func (o *Options) ProcessWebHook(l *logrus.Entry, webhook scm.Webhook) (*logrus.
 
 		l.Info("invoking Push handler")
 
-		err := o.updateLauncherClientAndReturnError(l, o.server, pushHook.Repository())
-		if err != nil {
-			return l, "", err
-		}
-
 		o.server.HandlePushEvent(l, pushHook)
 		return l, "processed push hook", nil
 	}
@@ -334,11 +343,6 @@ func (o *Options) ProcessWebHook(l *logrus.Entry, webhook scm.Webhook) (*logrus.
 
 		l.Info("invoking PR handler")
 
-		err := o.updateLauncherClientAndReturnError(l, o.server, prHook.Repository())
-		if err != nil {
-			return l, "", err
-		}
-
 		o.server.HandlePullRequestEvent(l, prHook)
 		return l, "processed PR hook", nil
 	}
@@ -353,11 +357,6 @@ func (o *Options) ProcessWebHook(l *logrus.Entry, webhook scm.Webhook) (*logrus.
 
 		l.Info("invoking branch handler")
 
-		err := o.updateLauncherClientAndReturnError(l, o.server, branchHook.Repository())
-		if err != nil {
-			return l, "", err
-		}
-
 		o.server.HandleBranchEvent(l, branchHook)
 		return l, "processed branch hook", nil
 	}
@@ -378,10 +377,6 @@ func (o *Options) ProcessWebHook(l *logrus.Entry, webhook scm.Webhook) (*logrus.
 
 		l.Info("invoking Issue Comment handler")
 
-		err := o.updateLauncherClientAndReturnError(l, o.server, issueCommentHook.Repository())
-		if err != nil {
-			return l, "", err
-		}
 		o.server.HandleIssueCommentEvent(l, *issueCommentHook)
 		return l, "processed issue comment hook", nil
 	}
@@ -406,10 +401,6 @@ func (o *Options) ProcessWebHook(l *logrus.Entry, webhook scm.Webhook) (*logrus.
 
 		l.Info("invoking Issue Comment handler")
 
-		err := o.updateLauncherClientAndReturnError(l, o.server, prCommentHook.Repository())
-		if err != nil {
-			return l, "", err
-		}
 		o.server.HandlePullRequestCommentEvent(l, *prCommentHook)
 		return l, "processed PR comment hook", nil
 	}
@@ -553,23 +544,6 @@ func (o *Options) createHookServer() (*Server, error) {
 	return server, nil
 }
 
-func (o *Options) updateLauncherClientAndReturnError(l *logrus.Entry, server *Server, repository scm.Repository) error {
-	_, jxClient, _, lhClient, _, err := clients.GetClientsAndNamespace(nil)
-	if err != nil {
-		err = errors.Wrapf(err, "failed to create JX client")
-		l.Errorf("%s", err.Error())
-		return err
-	}
-	launcherClient, err := launcher.NewLauncher(jxClient, lhClient, o.namespace)
-	if err != nil {
-		err = errors.Wrapf(err, "failed to create PipelineLauncher client")
-		l.Errorf("%s", err.Error())
-		return err
-	}
-	server.ClientAgent.LauncherClient = launcherClient
-	return nil
-}
-
 func responseHTTPError(w http.ResponseWriter, statusCode int, response string) {
 	logrus.WithFields(logrus.Fields{
 		"response":    response,


Test patch:
diff --git a/pkg/keeper/keeper_test.go b/pkg/keeper/keeper_test.go
index d4eccaef..4eeda72b 100644
--- a/pkg/keeper/keeper_test.go
+++ b/pkg/keeper/keeper_test.go
@@ -87,11 +87,10 @@ func TestAccumulateBatch(t *testing.T) {
 		state v1alpha1.PipelineState
 	}
 	tests := []struct {
-		name             string
-		presubmits       map[int][]config.Presubmit
-		pulls            []pull
-		activities       []activity
-		combinedContexts map[string]map[string]commitStatus
+		name       string
+		presubmits map[int][]config.Presubmit
+		pulls      []pull
+		activities []activity
 
 		merges  []int
 		pending bool
@@ -152,25 +151,6 @@ func TestAccumulateBatch(t *testing.T) {
 			},
 			merges: []int{1, 2},
 		},
-		{
-			name:       "failure in run but overridden, multiple PRs",
-			presubmits: map[int][]config.Presubmit{1: jobSet, 2: jobSet},
-			pulls:      []pull{{1, "a"}, {2, "b"}},
-			activities: []activity{
-				{job: "foo", state: v1alpha1.SuccessState, prs: []pull{{1, "a"}, {2, "b"}}},
-				{job: "bar", state: v1alpha1.FailureState, prs: []pull{{1, "a"}, {2, "b"}}},
-				{job: "baz", state: v1alpha1.SuccessState, prs: []pull{{1, "a"}, {2, "b"}}},
-			},
-			combinedContexts: map[string]map[string]commitStatus{
-				"a": {
-					"bar": toCommitStatus("success", "Overridden by someone"),
-				},
-				"b": {
-					"bar": toCommitStatus("success", "Overridden by someone"),
-				},
-			},
-			merges: []int{1, 2},
-		},
 		{
 			name:       "successful run, failures in past",
 			presubmits: map[int][]config.Presubmit{1: jobSet, 2: jobSet},
@@ -239,7 +219,6 @@ func TestAccumulateBatch(t *testing.T) {
 	}
 	for _, test := range tests {
 		t.Run(test.name, func(t *testing.T) {
-			fgc := &fgc{ignoreExpected: true, combinedStatus: test.combinedContexts}
 			var pulls []PullRequest
 			for _, p := range test.pulls {
 				pr := PullRequest{
@@ -267,7 +246,7 @@ func TestAccumulateBatch(t *testing.T) {
 				}
 				pjs = append(pjs, npj)
 			}
-			merges, pending := accumulateBatch(test.presubmits, pulls, pjs, fgc, logrus.NewEntry(logrus.New()))
+			merges, pending := accumulateBatch(test.presubmits, pulls, pjs, logrus.NewEntry(logrus.New()))
 			if (len(pending) > 0) != test.pending {
 				t.Errorf("For case \"%s\", got wrong pending.", test.name)
 			}
@@ -296,11 +275,10 @@ func TestAccumulate(t *testing.T) {
 		sha      string
 	}
 	tests := []struct {
-		name             string
-		presubmits       map[int][]config.Presubmit
-		pullRequests     map[int]string
-		activities       []activity
-		combinedContexts map[string]map[string]commitStatus
+		name         string
+		presubmits   map[int][]config.Presubmit
+		pullRequests map[int]string
+		activities   []activity
 
 		successes []int
 		pendings  []int
@@ -334,18 +312,10 @@ func TestAccumulate(t *testing.T) {
 				{7, "job2", v1alpha1.SuccessState, "sha7"},
 				{7, "job1", v1alpha1.FailureState, "sha7"},
 			},
-			combinedContexts: map[string]map[string]commitStatus{
-				"sha2": {
-					"job2": toCommitStatus("success", "Some other message"),
-				},
-				"sha4": {
-					"job1": toCommitStatus("success", "Overridden by someone"),
-				},
-			},
 
 			successes: []int{7},
-			pendings:  []int{3, 4, 5, 6},
-			none:      []int{1, 2},
+			pendings:  []int{3, 5, 6},
+			none:      []int{1, 2, 4},
 		},
 		{
 			name:         "one PR, four jobs, mix of failures and success",
@@ -489,7 +459,6 @@ func TestAccumulate(t *testing.T) {
 
 	for i, test := range tests {
 		t.Run(test.name, func(t *testing.T) {
-			fgc := &fgc{ignoreExpected: true, combinedStatus: test.combinedContexts}
 			var pulls []PullRequest
 			for num, sha := range test.pullRequests {
 				pulls = append(
@@ -510,7 +479,7 @@ func TestAccumulate(t *testing.T) {
 				})
 			}
 
-			successes, pendings, nones, _ := accumulate(test.presubmits, pulls, pjs, fgc, logrus.NewEntry(logrus.New()))
+			successes, pendings, nones, _ := accumulate(test.presubmits, pulls, pjs, logrus.NewEntry(logrus.New()))
 
 			t.Logf("test run %d", i)
 			testPullsMatchList(t, "successes", successes, test.successes)
@@ -2761,7 +2730,7 @@ func TestAccumulateReturnsCorrectMissingTests(t *testing.T) {
 	log := logrus.NewEntry(logrus.New())
 	for _, tc := range testCases {
 		t.Run(tc.name, func(t *testing.T) {
-			_, _, _, missingSerialTests := accumulate(tc.presubmits, tc.prs, tc.pjs, &fgc{}, log)
+			_, _, _, missingSerialTests := accumulate(tc.presubmits, tc.prs, tc.pjs, log)
 			// Apiequality treats nil slices/maps equal to a zero length slice/map, keeping us from
 			// the burden of having to always initialize them
 			if !apiequality.Semantic.DeepEqual(tc.expectedPresubmits, missingSerialTests) {