From 4a200a222294dff6adf991e742470cbb3eba499e Mon Sep 17 00:00:00 2001 From: SataQiu Date: Thu, 4 Apr 2019 12:18:03 +0800 Subject: [PATCH] replace repeated values with a constant --- cmd/kubeadm/app/constants/constants.go | 2 ++ cmd/kubeadm/app/phases/upgrade/prepull_test.go | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/cmd/kubeadm/app/constants/constants.go b/cmd/kubeadm/app/constants/constants.go index 808b94380a7..748f342cb75 100644 --- a/cmd/kubeadm/app/constants/constants.go +++ b/cmd/kubeadm/app/constants/constants.go @@ -179,6 +179,8 @@ const ( UpdateNodeTimeout = 2 * time.Minute // TLSBootstrapTimeout specifies how long kubeadm should wait for the kubelet to perform the TLS Bootstrap TLSBootstrapTimeout = 2 * time.Minute + // PrepullImagesInParallelTimeout specifies how long kubeadm should wait for prepulling images in parallel before timing out + PrepullImagesInParallelTimeout = 10 * time.Second // DefaultControlPlaneTimeout specifies the default control plane (actually API Server) timeout for use by kubeadm DefaultControlPlaneTimeout = 4 * time.Minute diff --git a/cmd/kubeadm/app/phases/upgrade/prepull_test.go b/cmd/kubeadm/app/phases/upgrade/prepull_test.go index f52d2f074b0..b7d574c81f2 100644 --- a/cmd/kubeadm/app/phases/upgrade/prepull_test.go +++ b/cmd/kubeadm/app/phases/upgrade/prepull_test.go @@ -116,25 +116,25 @@ func TestPrepullImagesInParallel(t *testing.T) { { name: "should error out; create failed", p: NewFailedCreatePrepuller(), - timeout: 10 * time.Second, + timeout: constants.PrepullImagesInParallelTimeout, expectedErr: true, }, { name: "should error out; timeout exceeded", p: NewForeverWaitPrepuller(), - timeout: 10 * time.Second, + timeout: constants.PrepullImagesInParallelTimeout, expectedErr: true, }, { name: "should error out; delete failed", p: NewFailedDeletePrepuller(), - timeout: 10 * time.Second, + timeout: constants.PrepullImagesInParallelTimeout, expectedErr: true, }, { name: "should work just fine", p: NewGoodPrepuller(), - timeout: 10 * time.Second, + timeout: constants.PrepullImagesInParallelTimeout, expectedErr: false, }, }