Skip to content

Commit

Permalink
pj-rehearse: code cleanups
Browse files Browse the repository at this point in the history
Unused parameters and misplaced nil check.
  • Loading branch information
petr-muller committed Jul 9, 2020
1 parent d56f3c1 commit c17675e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cmd/pj-rehearse/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ func rehearseMain() error {
toRehearseClusterProfiles := diffs.GetPresubmitsForClusterProfiles(prConfig.Prow, changedClusterProfiles, logger)
toRehearse.AddAll(toRehearseClusterProfiles)

presubmitsWithChangedRegistry := rehearse.AddRandomJobsForChangedRegistry(changedRegistrySteps, graph, prConfig.Prow.JobConfig.PresubmitsStatic, filepath.Join(o.releaseRepoPath, config.CiopConfigInRepoPath), loggers)
presubmitsWithChangedRegistry := rehearse.AddRandomJobsForChangedRegistry(changedRegistrySteps, prConfig.Prow.JobConfig.PresubmitsStatic, filepath.Join(o.releaseRepoPath, config.CiopConfigInRepoPath), loggers)
toRehearse.AddAll(presubmitsWithChangedRegistry)

resolver := registry.NewResolver(refs, chains, workflows)
Expand Down
6 changes: 3 additions & 3 deletions pkg/config/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,12 @@ func TestCreateClusterProfiles(t *testing.T) {
t.Fatal(err)
}
cms, err := client.List(metav1.ListOptions{})
sort.Slice(cms.Items, func(i, j int) bool {
return cms.Items[i].Name < cms.Items[j].Name
})
if err != nil {
t.Fatal(err)
}
sort.Slice(cms.Items, func(i, j int) bool {
return cms.Items[i].Name < cms.Items[j].Name
})
expected := []v1.ConfigMap{{
ObjectMeta: metav1.ObjectMeta{
Name: "rehearse-cluster-profile-profile0-e92d4a59",
Expand Down
2 changes: 1 addition & 1 deletion pkg/rehearse/jobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ func getAllAncestors(changed []registry.Node) []registry.Node {
return ancestors
}

func AddRandomJobsForChangedRegistry(regSteps []registry.Node, graph registry.NodeByName, prConfigPresubmits map[string][]prowconfig.Presubmit, configPath string, loggers Loggers) config.Presubmits {
func AddRandomJobsForChangedRegistry(regSteps []registry.Node, prConfigPresubmits map[string][]prowconfig.Presubmit, configPath string, loggers Loggers) config.Presubmits {
configsByFilename, err := config.LoadDataByFilename(configPath)
if err != nil {
loggers.Debug.Errorf("Failed to load config by filename in AddRandomJobsForChangedRegistry: %v", err)
Expand Down
4 changes: 2 additions & 2 deletions pkg/rehearse/jobs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,10 @@ func TestReplaceClusterProfiles(t *testing.T) {
}

profiles := []config.ConfigMapSource{{
SHA: "47f520ef9c2662fc9a2675f1dd4f02d5082b2776",
SHA: "47f520ef9c2662fc9a2675f1dd4f02d5082b2776",
PathInRepo: filepath.Join(config.ClusterProfilesPath, "changed-profile0"),
}, {
SHA: "85c627078710b8beee65d06d0cf157094fc46b03",
SHA: "85c627078710b8beee65d06d0cf157094fc46b03",
PathInRepo: filepath.Join(config.ClusterProfilesPath, "changed-profile1"),
}}

Expand Down

0 comments on commit c17675e

Please sign in to comment.