From 957ca06dbeffeab989359edba871e125c2cb7739 Mon Sep 17 00:00:00 2001 From: Jingfang Liu Date: Tue, 22 May 2018 15:46:30 -0700 Subject: [PATCH] Enable test for existing projects in travis --- .travis.yml | 3 ++- samples/internal/test/e2e/kubebuildertest.go | 4 ++++ .../memcached-api-server/test/hack/install.yaml | 2 +- test_existing_projects.sh | 17 +++++++++++++++++ 4 files changed, 24 insertions(+), 2 deletions(-) create mode 100755 test_existing_projects.sh diff --git a/.travis.yml b/.travis.yml index deadfcd647d..09710b8f8a1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,7 +22,8 @@ install: - script: - TRACE=1 ./test.sh +- TRACE=1 ./test.sh +- ./test_existing_projects.sh # TBD. Suppressing for now. notifications: diff --git a/samples/internal/test/e2e/kubebuildertest.go b/samples/internal/test/e2e/kubebuildertest.go index 4997bea3e33..226af0253b6 100644 --- a/samples/internal/test/e2e/kubebuildertest.go +++ b/samples/internal/test/e2e/kubebuildertest.go @@ -19,6 +19,10 @@ func NewKubebuilderTest(dir, binDir string) *KubebuilderTest { os.Setenv("TEST_ASSET_KUBECTL", strings.Join([]string{binDir, "kubectl"}, "/")) os.Setenv("TEST_ASSET_KUBE_APISERVER", strings.Join([]string{binDir, "kube-apiserver"}, "/")) os.Setenv("TEST_ASSET_ETCD", strings.Join([]string{binDir, "etcd"}, "/")) + cmd := exec.Command("command", "-v", "kubebuilder") + if err := kt.runCommand(cmd); err != nil { + os.Setenv("PATH",strings.Join([]string{binDir, os.Getenv("PATH")}, ":")) + } return &kt } diff --git a/samples/memcached-api-server/test/hack/install.yaml b/samples/memcached-api-server/test/hack/install.yaml index 311e18c4e52..8acb7473639 100644 --- a/samples/memcached-api-server/test/hack/install.yaml +++ b/samples/memcached-api-server/test/hack/install.yaml @@ -4,7 +4,7 @@ metadata: creationTimestamp: null labels: api: "" - kubebuilder.k8s.io: master + kubebuilder.k8s.io: unknown name: memcacheds.myapps.memcached.example.com spec: group: myapps.memcached.example.com diff --git a/test_existing_projects.sh b/test_existing_projects.sh new file mode 100755 index 00000000000..46d36f1bfcc --- /dev/null +++ b/test_existing_projects.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +# Copyright 2018 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. + +go test -v ./samples/memcached-api-server