Skip to content

Commit

Permalink
Merge pull request #261 from feiskyer/critest
Browse files Browse the repository at this point in the history
critest: remove dependency of source code
  • Loading branch information
Random-Liu authored Mar 15, 2018
2 parents b15605a + 6cb2585 commit f94688c
Show file tree
Hide file tree
Showing 13 changed files with 110 additions and 324 deletions.
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ ifndef GOPATH
endif

critest: check-gopath
$(GO) install \
$(PROJECT)/cmd/critest
$(GO) test -c \
$(PROJECT)/cmd/critest \
-o $(GOBINDIR)/bin/critest

crictl: check-gopath
$(GO) install \
Expand Down
38 changes: 0 additions & 38 deletions cmd/critest/benchmark.go

This file was deleted.

69 changes: 69 additions & 0 deletions cmd/critest/cri_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
Copyright 2017 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 main

import (
"flag"
"fmt"
"os"
"path"
"testing"

"github.com/onsi/ginkgo"
"github.com/onsi/ginkgo/reporters"
"github.com/onsi/gomega"

"github.com/kubernetes-incubator/cri-tools/pkg/framework"

_ "github.com/kubernetes-incubator/cri-tools/pkg/benchmark"
_ "github.com/kubernetes-incubator/cri-tools/pkg/validate"
)

var (
isBenchMark = flag.Bool("benchmark", false, "Run benchmarks instead of validation tests")
)

func init() {
framework.RegisterFlags()
}

// runTestSuite runs cri validation tests and benchmark tests.
func runTestSuite(t *testing.T) {
gomega.RegisterFailHandler(ginkgo.Fail)

if *isBenchMark {
flag.Set("ginkgo.focus", "benchmark")
} else {
// Skip benchamark measurements for validation tests.
flag.Set("ginkgo.skipMeasurements", "true")
}

reporter := []ginkgo.Reporter{}
if framework.TestContext.ReportDir != "" {
if err := os.MkdirAll(framework.TestContext.ReportDir, 0755); err != nil {
t.Errorf("Failed creating report directory: %v", err)
}

reporter = append(reporter, reporters.NewJUnitReporter(path.Join(framework.TestContext.ReportDir, fmt.Sprintf("junit_%v.xml", framework.TestContext.ReportPrefix))))
}

ginkgo.RunSpecsWithDefaultAndCustomReporters(t, "CRI validation", reporter)
}

func TestCRISuite(t *testing.T) {
runTestSuite(t)
}
75 changes: 0 additions & 75 deletions cmd/critest/main.go

This file was deleted.

137 changes: 0 additions & 137 deletions cmd/critest/util.go

This file was deleted.

30 changes: 0 additions & 30 deletions cmd/critest/validation.go

This file was deleted.

Loading

0 comments on commit f94688c

Please sign in to comment.