Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update test-infra #2954

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
48 changes: 24 additions & 24 deletions cmd/branchingconfigmanagers/tide-config-manager/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ func TestReconcile(t *testing.T) {
args: args{
target: afero.NewMemMapFs(),
event: featureFreezeEvent,
config: &prowconfig.ProwConfig{Tide: config.Tide{Queries: config.TideQueries{
config: &prowconfig.ProwConfig{Tide: config.Tide{TideGitHubConfig: config.TideGitHubConfig{Queries: config.TideQueries{
{
Repos: repos,
Labels: []string{qeApproved},
IncludedBranches: []string{masterBranch},
},
}}},
}}}},
},
wantErr: false,
expectedShardFiles: map[string]string{
Expand All @@ -88,13 +88,13 @@ func TestReconcile(t *testing.T) {
args: args{
target: afero.NewMemMapFs(),
event: featureFreezeEvent,
config: &prowconfig.ProwConfig{Tide: config.Tide{Queries: config.TideQueries{
config: &prowconfig.ProwConfig{Tide: config.Tide{TideGitHubConfig: config.TideGitHubConfig{Queries: config.TideQueries{
{
Repos: repos,
Labels: []string{cherryPickApproved},
IncludedBranches: []string{mainBranch, "release-4.9"},
},
}}},
}}}},
},
wantErr: false,
expectedShardFiles: map[string]string{
Expand All @@ -105,13 +105,13 @@ func TestReconcile(t *testing.T) {
args: args{
target: afero.NewMemMapFs(),
event: featureFreezeEvent,
config: &prowconfig.ProwConfig{Tide: config.Tide{Queries: config.TideQueries{
config: &prowconfig.ProwConfig{Tide: config.Tide{TideGitHubConfig: config.TideGitHubConfig{Queries: config.TideQueries{
{
Repos: privRepos,
Labels: []string{cherryPickApproved},
IncludedBranches: []string{mainBranch, "openshift-4.9"},
},
}}},
}}}},
},
wantErr: false,
expectedShardFiles: map[string]string{
Expand All @@ -122,13 +122,13 @@ func TestReconcile(t *testing.T) {
args: args{
target: afero.NewMemMapFs(),
event: featureFreezeEvent,
config: &prowconfig.ProwConfig{Tide: config.Tide{Queries: config.TideQueries{
config: &prowconfig.ProwConfig{Tide: config.Tide{TideGitHubConfig: config.TideGitHubConfig{Queries: config.TideQueries{
{
Repos: repos,
Labels: []string{cherryPickApproved},
IncludedBranches: []string{"openshift-4.9"},
},
}}},
}}}},
},
wantErr: false,
expectedShardFiles: map[string]string{
Expand All @@ -139,12 +139,12 @@ func TestReconcile(t *testing.T) {
args: args{
target: afero.NewMemMapFs(),
event: featureFreezeEvent,
config: &prowconfig.ProwConfig{Tide: config.Tide{Queries: config.TideQueries{
config: &prowconfig.ProwConfig{Tide: config.Tide{TideGitHubConfig: config.TideGitHubConfig{Queries: config.TideQueries{
{
Repos: repos,
IncludedBranches: []string{masterBranch, "openshift-4.9"},
},
}}},
}}}},
},
wantErr: false,
expectedShardFiles: map[string]string{
Expand All @@ -155,13 +155,13 @@ func TestReconcile(t *testing.T) {
args: args{
target: afero.NewMemMapFs(),
event: codeFreezeEvent,
config: &prowconfig.ProwConfig{Tide: config.Tide{Queries: config.TideQueries{
config: &prowconfig.ProwConfig{Tide: config.Tide{TideGitHubConfig: config.TideGitHubConfig{Queries: config.TideQueries{
{
Repos: repos,
Labels: []string{validBug},
IncludedBranches: []string{mainBranch, "release-4.9"},
},
}}},
}}}},
},
wantErr: false,
expectedShardFiles: map[string]string{
Expand All @@ -172,13 +172,13 @@ func TestReconcile(t *testing.T) {
args: args{
target: afero.NewMemMapFs(),
event: codeFreezeEvent,
config: &prowconfig.ProwConfig{Tide: config.Tide{Queries: config.TideQueries{
config: &prowconfig.ProwConfig{Tide: config.Tide{TideGitHubConfig: config.TideGitHubConfig{Queries: config.TideQueries{
{
Repos: repos,
Labels: []string{validBug, qeApproved},
IncludedBranches: []string{mainBranch, "release-4.9"},
},
}}},
}}}},
},
wantErr: false,
expectedShardFiles: map[string]string{
Expand All @@ -189,13 +189,13 @@ func TestReconcile(t *testing.T) {
args: args{
target: afero.NewMemMapFs(),
event: codeFreezeEvent,
config: &prowconfig.ProwConfig{Tide: config.Tide{Queries: config.TideQueries{
config: &prowconfig.ProwConfig{Tide: config.Tide{TideGitHubConfig: config.TideGitHubConfig{Queries: config.TideQueries{
{
Repos: repos,
Labels: []string{validBug},
IncludedBranches: []string{"openshift-4.9", "release-4.9"},
},
}}},
}}}},
},
wantErr: false,
expectedShardFiles: map[string]string{
Expand All @@ -206,13 +206,13 @@ func TestReconcile(t *testing.T) {
args: args{
target: afero.NewMemMapFs(),
event: generalAvailabilityEvent,
config: &prowconfig.ProwConfig{Tide: config.Tide{Queries: config.TideQueries{
config: &prowconfig.ProwConfig{Tide: config.Tide{TideGitHubConfig: config.TideGitHubConfig{Queries: config.TideQueries{
{
Repos: repos,
Labels: []string{staffEngApproved},
IncludedBranches: []string{"openshift-4.9", "release-4.9"},
},
}}},
}}}},
},
wantErr: false,
expectedShardFiles: map[string]string{
Expand All @@ -223,13 +223,13 @@ func TestReconcile(t *testing.T) {
args: args{
target: afero.NewMemMapFs(),
event: generalAvailabilityEvent,
config: &prowconfig.ProwConfig{Tide: config.Tide{Queries: config.TideQueries{
config: &prowconfig.ProwConfig{Tide: config.Tide{TideGitHubConfig: config.TideGitHubConfig{Queries: config.TideQueries{
{
Repos: repos,
Labels: []string{staffEngApproved},
IncludedBranches: []string{"openshift-4.9", "release-4.9"},
},
}}},
}}}},
},
wantErr: false,
expectedShardFiles: map[string]string{
Expand All @@ -240,13 +240,13 @@ func TestReconcile(t *testing.T) {
args: args{
target: afero.NewMemMapFs(),
event: generalAvailabilityEvent,
config: &prowconfig.ProwConfig{Tide: config.Tide{Queries: config.TideQueries{
config: &prowconfig.ProwConfig{Tide: config.Tide{TideGitHubConfig: config.TideGitHubConfig{Queries: config.TideQueries{
{
Repos: repos,
Labels: []string{cherryPickApproved},
IncludedBranches: []string{"openshift-4.8", "release-4.8"},
},
}}},
}}}},
},
wantErr: false,
expectedShardFiles: map[string]string{
Expand All @@ -257,12 +257,12 @@ func TestReconcile(t *testing.T) {
args: args{
target: afero.NewMemMapFs(),
event: generalAvailabilityEvent,
config: &prowconfig.ProwConfig{Tide: config.Tide{Queries: config.TideQueries{
config: &prowconfig.ProwConfig{Tide: config.Tide{TideGitHubConfig: config.TideGitHubConfig{Queries: config.TideQueries{
{
Repos: repos,
ExcludedBranches: []string{"openshift-4.8", "release-4.8"},
},
}}},
}}}},
},
wantErr: false,
expectedShardFiles: map[string]string{
Expand Down
18 changes: 9 additions & 9 deletions cmd/ci-operator/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func TestProwMetadata(t *testing.T) {
func verifyMetadata(jobSpec *api.JobSpec, namespace string, customMetadata map[string]string) error {
tempDir, err := ioutil.TempDir("", "")
if err != nil {
return fmt.Errorf("Unable to create temporary directory: %v", err)
return fmt.Errorf("unable to create temporary directory: %w", err)
}
defer os.RemoveAll(tempDir)
if err := os.Setenv("ARTIFACTS", tempDir); err != nil {
Expand All @@ -128,17 +128,17 @@ func verifyMetadata(jobSpec *api.JobSpec, namespace string, customMetadata map[s
}

if err := o.writeMetadataJSON(); err != nil {
return fmt.Errorf("error while writing metadata JSON: %v", err)
return fmt.Errorf("error while writing metadata JSON: %w", err)
}

metadataFileContents, err := ioutil.ReadFile(metadataFile)
if err != nil {
return fmt.Errorf("error reading metadata file: %v", err)
return fmt.Errorf("error reading metadata file: %w", err)
}

var writtenMetadata prowResultMetadata
if err := json.Unmarshal(metadataFileContents, &writtenMetadata); err != nil {
return fmt.Errorf("error parsing prow metadata: %v", err)
return fmt.Errorf("error parsing prow metadata: %w", err)
}

expectedMetadata := prowResultMetadata{
Expand All @@ -165,11 +165,11 @@ func verifyMetadata(jobSpec *api.JobSpec, namespace string, customMetadata map[s
if len(customMetadata) > 0 {
testJSON, err := json.MarshalIndent(customMetadata, "", "")
if err != nil {
return fmt.Errorf("error marshalling custom metadata: %v", err)
return fmt.Errorf("error marshalling custom metadata: %w", err)
}
err = ioutil.WriteFile(filepath.Join(testArtifactDirectory, "custom-prow-metadata.json"), testJSON, os.FileMode(0644))
if err != nil {
return fmt.Errorf("unable to create custom metadata file: %v", err)
return fmt.Errorf("unable to create custom metadata file: %w", err)
}
}

Expand All @@ -184,16 +184,16 @@ func verifyMetadata(jobSpec *api.JobSpec, namespace string, customMetadata map[s
}

if err := o.writeMetadataJSON(); err != nil {
return fmt.Errorf("error while writing metadata JSON: %v", err)
return fmt.Errorf("error while writing metadata JSON: %w", err)
}

metadataFileContents, err = ioutil.ReadFile(metadataFile)
if err != nil {
return fmt.Errorf("error reading metadata file (second revision): %v", err)
return fmt.Errorf("error reading metadata file (second revision): %w", err)
}

if err = json.Unmarshal(metadataFileContents, &writtenMetadata); err != nil {
return fmt.Errorf("error parsing prow metadata (second revision): %v", err)
return fmt.Errorf("error parsing prow metadata (second revision): %w", err)
}

revision := "1"
Expand Down
12 changes: 6 additions & 6 deletions cmd/determinize-prow-config/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ func TestShardProwConfig(t *testing.T) {
name: "Org and repo mergemethod config gets written out",
in: &config.ProwConfig{
Tide: config.Tide{
MergeType: map[string]types.PullRequestMergeType{
TideGitHubConfig: config.TideGitHubConfig{MergeType: map[string]types.PullRequestMergeType{
"openshift": types.MergeSquash,
"openshift/release": types.MergeRebase,
},
}},
},
},

Expand Down Expand Up @@ -130,10 +130,10 @@ func TestShardProwConfig(t *testing.T) {
},
},
Tide: config.Tide{
MergeType: map[string]types.PullRequestMergeType{
TideGitHubConfig: config.TideGitHubConfig{MergeType: map[string]types.PullRequestMergeType{
"openshift": types.MergeSquash,
"openshift/release": types.MergeRebase,
},
}},
},
},

Expand Down Expand Up @@ -164,12 +164,12 @@ func TestShardProwConfig(t *testing.T) {
},
{
name: "Tide queries get sharded",
in: &config.ProwConfig{Tide: config.Tide{Queries: config.TideQueries{
in: &config.ProwConfig{Tide: config.Tide{TideGitHubConfig: config.TideGitHubConfig{Queries: config.TideQueries{
{Orgs: []string{"openshift", "openshift-priv"}, Repos: []string{"kube-reporting/ghostunnel", "kube-reporting/presto"}, Labels: []string{"lgtm", "approved", "bugzilla/valid-bug"}},
{Orgs: []string{"codeready-toolchain", "integr8ly"}, Repos: []string{"containers/buildah", "containers/common"}, Labels: []string{"lgtm", "approved"}},
{Orgs: []string{"integr8ly"}, Author: "openshift-bot"},
{Repos: []string{"openshift/release"}, Author: "openshift-bot"},
}}},
}}}},
expectedShardFiles: map[string]string{
"codeready-toolchain/_prowconfig.yaml": `tide:
queries:
Expand Down
18 changes: 9 additions & 9 deletions cmd/publicize/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ func TestMergeAndPushToRemote(t *testing.T) {
fixedTimeUnix := fixedTime.Unix()
makeRepo := func(localgit *localgit.LocalGit, org, repo string, init func() error) error {
if err := localgit.MakeFakeRepo(org, repo); err != nil {
return fmt.Errorf("couldn't create fake repo for %s/%s: %v", org, repo, err)
return fmt.Errorf("couldn't create fake repo for %s/%s: %w", org, repo, err)
}
// The test relies on the repository created by MakeFakeRepo generating
// the same history across calls, which can only happen if time remains
Expand Down Expand Up @@ -270,7 +270,7 @@ and the repository exists.
privateGitRepo: func() error {
filesToCommit := map[string][]byte{"test-file": []byte("TEST")}
if err := localgit.AddCommit(privateOrg, privateRepo, filesToCommit); err != nil {
return fmt.Errorf("couldn't add commit: %v", err)
return fmt.Errorf("couldn't add commit: %w", err)
}
return nil
},
Expand All @@ -288,7 +288,7 @@ and the repository exists.
"test-file3": []byte("TEST"),
}
if err := localgit.AddCommit(privateOrg, privateRepo, filesToCommit); err != nil {
return fmt.Errorf("couldn't add commit: %v", err)
return fmt.Errorf("couldn't add commit: %w", err)
}
return nil
},
Expand All @@ -306,7 +306,7 @@ and the repository exists.
"test-file3": []byte("TEST"),
}
if err := localgit.AddCommit(privateOrg, privateRepo, filesToCommit); err != nil {
return fmt.Errorf("couldn't add commit: %v", err)
return fmt.Errorf("couldn't add commit: %w", err)
}
return nil
},
Expand All @@ -317,7 +317,7 @@ and the repository exists.
"test-file6": []byte("TEST"),
}
if err := localgit.AddCommit(publicOrg, publicRepo, filesToCommit); err != nil {
return fmt.Errorf("couldn't add commit: %v", err)
return fmt.Errorf("couldn't add commit: %w", err)
}
return nil
},
Expand All @@ -331,14 +331,14 @@ and the repository exists.
privateGitRepo: func() error {
filesToCommit := map[string][]byte{"test-file": []byte("CONFLICT")}
if err := localgit.AddCommit(privateOrg, privateRepo, filesToCommit); err != nil {
return fmt.Errorf("couldn't add commit: %v", err)
return fmt.Errorf("couldn't add commit: %w", err)
}
return nil
},
publicGitRepo: func() error {
filesToCommit := map[string][]byte{"test-file": []byte("TEST")}
if err := localgit.AddCommit(publicOrg, publicRepo, filesToCommit); err != nil {
return fmt.Errorf("couldn't add commit: %v", err)
return fmt.Errorf("couldn't add commit: %w", err)
}
return nil
},
Expand All @@ -357,7 +357,7 @@ and the repository exists.
"test-file3": []byte("TEST"),
}
if err := localgit.AddCommit(privateOrg, privateRepo, filesToCommit); err != nil {
return fmt.Errorf("couldn't add commit: %v", err)
return fmt.Errorf("couldn't add commit: %w", err)
}
return nil
},
Expand All @@ -368,7 +368,7 @@ and the repository exists.
"test-file6": []byte("TEST"),
}
if err := localgit.AddCommit(publicOrg, publicRepo, filesToCommit); err != nil {
return fmt.Errorf("couldn't add commit: %v", err)
return fmt.Errorf("couldn't add commit: %w", err)
}
return nil
},
Expand Down
Loading