Skip to content

Commit

Permalink
Add config test to mergelists
Browse files Browse the repository at this point in the history
  • Loading branch information
chases2 committed Mar 19, 2021
1 parent 1c4047d commit c8cef9b
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 7 deletions.
1 change: 1 addition & 0 deletions config/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ filegroup(
"//config/prow-staging:all-srcs",
"//config/tests/jobs:all-srcs",
"//config/tests/lint:all-srcs",
"//config/tests/mergelists:all-srcs",
"//config/tests/testgrids:all-srcs",
],
tags = ["automanaged"],
Expand Down
5 changes: 0 additions & 5 deletions config/testgrids/kubevirt/default.yaml

This file was deleted.

26 changes: 26 additions & 0 deletions config/tests/mergelists/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package(default_visibility = ["//visibility:public"])

load("@io_bazel_rules_go//go:def.bzl", "go_test")

go_test(
name = "go_default_test",
srcs = ["mergelist_test.go"],
args = ["-list='$(locations //config/mergelists)'"],
data = ["//config/mergelists"],
rundir = ".",
deps = ["@com_github_googlecloudplatform_testgrid//pkg/merger:go_default_library"],
)

filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)

filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)
46 changes: 46 additions & 0 deletions config/tests/mergelists/mergelist_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
Copyright 2021 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package mergelist_test

import (
"flag"
"io/ioutil"
"strings"
"testing"

"github.com/GoogleCloudPlatform/testgrid/pkg/merger"
)

var lists = flag.String("list", "", "Space-delimited list of mergelists to test")

func TestMergelist(t *testing.T) {
files := strings.Split(*lists, " ")

for _, filename := range files {
t.Run(filename, func(t *testing.T) {
file, err := ioutil.ReadFile(filename)
if err != nil {
t.Errorf("Can't read file: %v", err)
}

_, err = merger.ParseAndCheck(file)
if err != nil {
t.Error(err)
}
})
}
}
2 changes: 1 addition & 1 deletion prow/spyglass/lenses/junit/lens.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func (lens Lens) getJvd(artifacts []api.Artifact) JVD {
resultChan <- result
return
}
var suites junit.Suites
var suites *junit.Suites
suites, result.err = junit.Parse(contents)
if result.err != nil {
logrus.WithError(result.err).WithField("artifact", artifact.CanonicalLink()).Info("Error parsing junit file.")
Expand Down
2 changes: 1 addition & 1 deletion testgrid/cmd/configurator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ func write(ctx context.Context, client *storage.Client, path string, bytes []byt
func doOneshot(ctx context.Context, client *storage.Client, opt options, prowConfigAgent *prowConfig.Agent) error {

// Read Data Sources: Default, YAML configs, Prow Annotations
c, err := yamlcfg.ReadConfig(opt.inputs, opt.defaultYAML)
c, err := yamlcfg.ReadConfig(opt.inputs, opt.defaultYAML, false)
if err != nil {
return fmt.Errorf("could not read testgrid config: %v", err)
}
Expand Down

0 comments on commit c8cef9b

Please sign in to comment.