Skip to content

Commit

Permalink
Merge pull request #311 from fanzhangio/ci
Browse files Browse the repository at this point in the history
Speed up tests by caching deps
  • Loading branch information
k8s-ci-robot authored Jul 12, 2018
2 parents 01a605a + 7fed477 commit d9fd836
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
17 changes: 17 additions & 0 deletions common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,21 @@ function setup_envs {
export TEST_ASSET_KUBECTL=/tmp/kubebuilder/bin/kubectl
export TEST_ASSET_KUBE_APISERVER=/tmp/kubebuilder/bin/kube-apiserver
export TEST_ASSET_ETCD=/tmp/kubebuilder/bin/etcd
export TEST_DEP=/tmp/kubebuilder/init_project
}

function cache_dep {
header_text "caching inited projects"
if [ -d "$TEST_DEP" ]; then
rm -rf "$TEST_DEP"
fi
mkdir -p "$TEST_DEP"
cp -r $PWD/* $TEST_DEP
}

function dump_cache {
header_text "dump cached project and deps"
if [ -d "$TEST_DEP" ]; then
cp -r $TEST_DEP/* .
fi
}
15 changes: 9 additions & 6 deletions testv1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ function test_init_project {
header_text "performing init project"
kubebuilder init --project-version=v1 --domain example.com <<< "y"
make
cache_dep
}



function test_init_project_manual_dep_ensure {
header_text "performing init project w/o dep ensure"
kubebuilder init --project-version=v1 --domain example.com <<< "n"
Expand Down Expand Up @@ -101,27 +104,27 @@ prepare_testdir_under_gopath
test_init_project_manual_dep_ensure

prepare_testdir_under_gopath
test_init_project
dump_cache
test_create_api_controller

prepare_testdir_under_gopath
test_init_project
dump_cache
test_create_namespaced_api_controller

prepare_testdir_under_gopath
test_init_project
dump_cache
test_create_api_only

prepare_testdir_under_gopath
test_init_project
dump_cache
test_create_namespaced_api_only

prepare_testdir_under_gopath
test_init_project
dump_cache
test_create_coretype_controller

prepare_testdir_under_gopath
test_init_project
dump_cache
test_create_namespaced_coretype_controller

exit $rc

0 comments on commit d9fd836

Please sign in to comment.