Skip to content

Commit f94688c

Browse files
authored
Merge pull request #261 from feiskyer/critest
critest: remove dependency of source code
2 parents b15605a + 6cb2585 commit f94688c

File tree

13 files changed

+110
-324
lines changed

13 files changed

+110
-324
lines changed

Makefile

+3-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@ ifndef GOPATH
4444
endif
4545

4646
critest: check-gopath
47-
$(GO) install \
48-
$(PROJECT)/cmd/critest
47+
$(GO) test -c \
48+
$(PROJECT)/cmd/critest \
49+
-o $(GOBINDIR)/bin/critest
4950

5051
crictl: check-gopath
5152
$(GO) install \

cmd/critest/benchmark.go

-38
This file was deleted.

cmd/critest/cri_test.go

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/*
2+
Copyright 2017 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package main
18+
19+
import (
20+
"flag"
21+
"fmt"
22+
"os"
23+
"path"
24+
"testing"
25+
26+
"github.com/onsi/ginkgo"
27+
"github.com/onsi/ginkgo/reporters"
28+
"github.com/onsi/gomega"
29+
30+
"github.com/kubernetes-incubator/cri-tools/pkg/framework"
31+
32+
_ "github.com/kubernetes-incubator/cri-tools/pkg/benchmark"
33+
_ "github.com/kubernetes-incubator/cri-tools/pkg/validate"
34+
)
35+
36+
var (
37+
isBenchMark = flag.Bool("benchmark", false, "Run benchmarks instead of validation tests")
38+
)
39+
40+
func init() {
41+
framework.RegisterFlags()
42+
}
43+
44+
// runTestSuite runs cri validation tests and benchmark tests.
45+
func runTestSuite(t *testing.T) {
46+
gomega.RegisterFailHandler(ginkgo.Fail)
47+
48+
if *isBenchMark {
49+
flag.Set("ginkgo.focus", "benchmark")
50+
} else {
51+
// Skip benchamark measurements for validation tests.
52+
flag.Set("ginkgo.skipMeasurements", "true")
53+
}
54+
55+
reporter := []ginkgo.Reporter{}
56+
if framework.TestContext.ReportDir != "" {
57+
if err := os.MkdirAll(framework.TestContext.ReportDir, 0755); err != nil {
58+
t.Errorf("Failed creating report directory: %v", err)
59+
}
60+
61+
reporter = append(reporter, reporters.NewJUnitReporter(path.Join(framework.TestContext.ReportDir, fmt.Sprintf("junit_%v.xml", framework.TestContext.ReportPrefix))))
62+
}
63+
64+
ginkgo.RunSpecsWithDefaultAndCustomReporters(t, "CRI validation", reporter)
65+
}
66+
67+
func TestCRISuite(t *testing.T) {
68+
runTestSuite(t)
69+
}

cmd/critest/main.go

-75
This file was deleted.

cmd/critest/util.go

-137
This file was deleted.

cmd/critest/validation.go

-30
This file was deleted.

0 commit comments

Comments
 (0)