prepare integration test

This commit is contained in:
liuwei
2020-05-01 15:03:13 +08:00
parent 64f13d6664
commit 6dc650cd53
2 changed files with 9 additions and 3 deletions

View File

@@ -6,14 +6,15 @@ K8S_VERSION ?=1.16.4
KB_TOOLS_ARCHIVE_NAME :=kubebuilder-tools-$(K8S_VERSION)-$(GOHOSTOS)-$(GOHOSTARCH).tar.gz
KB_TOOLS_ARCHIVE_PATH := $(TEST_TMP)/$(KB_TOOLS_ARCHIVE_NAME)
# download the kubebuilder-tools to get kube-apiserver binaries from it
ensure-kubebuilder-tools:
ifeq "" "$(wildcard $(KUBEBUILDER_ASSETS))"
$(info Downloading kubebuilder-tools into '$(KUBEBUILDER_ASSETS)')
$(info Downloading kube-apiserver into '$(KUBEBUILDER_ASSETS)')
mkdir -p '$(KUBEBUILDER_ASSETS)'
curl -s -f -L https://storage.googleapis.com/kubebuilder-tools/$(KB_TOOLS_ARCHIVE_NAME) -o '$(KB_TOOLS_ARCHIVE_PATH)'
tar -C '$(KUBEBUILDER_ASSETS)' --strip-components=2 -zvxf '$(KB_TOOLS_ARCHIVE_PATH)'
else
$(info Using existing kubebuilder-tools from "$(KUBEBUILDER_ASSETS)")
$(info Using existing kube-apiserver from "$(KUBEBUILDER_ASSETS)")
endif
.PHONY: ensure-kubebuilder-tools

View File

@@ -23,7 +23,11 @@ var k8sClient client.Client
func TestIntegration(t *testing.T) {
RegisterFailHandler(Fail)
// TODO add test cases
// TODO test cases
// - spoke registration agent creates CSR, hub authorizes, spoke agent creates hub kubeconfig and connects back to hub for successful join
// - spoke registration agent recovery from invalid bootstrap kubeconfig
// - spoke registration agent recovery from invalid hub kubeconfig
// - spoke registration rotate its certificate after its certificate is expired
RunSpecsWithDefaultAndCustomReporters(t, "Integration Suite", []Reporter{printer.NewlineReporter{}})
}
@@ -32,6 +36,7 @@ var _ = BeforeSuite(func(done Done) {
By("bootstrapping test environment")
// install cluster CRD and start a local kube-apiserver
testEnv = &envtest.Environment{
CRDDirectoryPaths: []string{
filepath.Join("..", "..", "vendor", "github.com", "open-cluster-management", "api", "cluster", "v1"),