Skip to content

Commit 975a898

Browse files
authored
Merge pull request kubernetes-retired#289 from m-messiah/enable-virtualcluster-test
🐛 Add virtualcluster tests to CI
2 parents fdfc021 + bbe7d6a commit 975a898

File tree

6 files changed

+216
-208
lines changed

6 files changed

+216
-208
lines changed

scripts/ci-test.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,10 @@ source ./scripts/fetch_ext_bins.sh && \
2727
setup_envs && \
2828

2929
cd "${REPO_ROOT}" && \
30-
make generate test
30+
make generate test
31+
32+
echo "==================="
33+
echo "Test virtualcluster"
34+
35+
cd "${REPO_ROOT}/virtualcluster/" && \
36+
make test

scripts/fetch_ext_bins.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,4 +108,5 @@ function setup_envs {
108108
export TEST_ASSET_KUBECTL=/tmp/kubebuilder/bin/kubectl
109109
export TEST_ASSET_KUBE_APISERVER=/tmp/kubebuilder/bin/kube-apiserver
110110
export TEST_ASSET_ETCD=/tmp/kubebuilder/bin/etcd
111+
export KUBEBUILDER_ASSETS=/tmp/kubebuilder/bin/
111112
}

virtualcluster/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ DOCKER_REG ?= ${or ${VC_DOCKER_REGISTRY},"virtualcluster"}
2121
IMG ?= ${DOCKER_REG}/manager-amd64 ${DOCKER_REG}/vn-agent-amd64 ${DOCKER_REG}/syncer-amd64
2222

2323
# TEST_FLAGS used as flags of go test.
24-
TEST_FLAGS ?= -v --race
24+
TEST_FLAGS ?= -v
2525

2626
# COVERAGE_PACKAGES is the coverage we care about.
2727
COVERAGE_PACKAGES=$(shell go list ./... | \
@@ -33,6 +33,8 @@ COVERAGE_PACKAGES=$(shell go list ./... | \
3333
# CRD_OPTIONS ?= "crd:trivialVersions=true"
3434
CRD_OPTIONS ?= "crd:trivialVersions=true,maxDescLen=0"
3535

36+
export KUBEBUILDER_ASSETS=/tmp/kubebuilder/bin/
37+
3638
# Build code.
3739
#
3840
# Args:

virtualcluster/pkg/controller/controllers/suite_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,13 @@ func TestAPIs(t *testing.T) {
5555
[]Reporter{printer.NewlineReporter{}})
5656
}
5757

58-
var _ = BeforeSuite(func(done Done) {
58+
var _ = BeforeSuite(func() {
5959
logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true)))
6060

6161
By("bootstrapping test environment")
6262
testEnv = &envtest.Environment{
63-
CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "config", "crd")},
63+
CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "config", "crd")},
64+
ErrorIfCRDPathMissing: true,
6465
}
6566

6667
var err error
@@ -101,8 +102,6 @@ var _ = BeforeSuite(func(done Done) {
101102

102103
cli = mgr.GetClient()
103104
Expect(cli).ToNot(BeNil())
104-
105-
close(done)
106105
}, 60)
107106

108107
var _ = AfterSuite(func() {

0 commit comments

Comments
 (0)