You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ts...@apache.org on 2022/10/07 03:48:12 UTC

[camel-k] 10/13: (e2e): Increases the download dependency timeout

This is an automated email from the ASF dual-hosted git repository.

tsato pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit 9257d478cda83900f2cae9bae9deca12b63135a2
Author: phantomjinx <p....@phantomjinx.co.uk>
AuthorDate: Mon Oct 3 16:43:44 2022 +0100

    (e2e): Increases the download dependency timeout
    
    * The default timeout for download timeouts was so quick as to make the
      test prone to failure. Increasing this timeout allows for more reliable
      tests.
---
 pkg/cmd/run_support.go | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/pkg/cmd/run_support.go b/pkg/cmd/run_support.go
index a25ca31b3..e929a67f3 100644
--- a/pkg/cmd/run_support.go
+++ b/pkg/cmd/run_support.go
@@ -28,6 +28,7 @@ import (
 	"path/filepath"
 	"reflect"
 	"strings"
+	"time"
 
 	v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
 	"github.com/apache/camel-k/pkg/client"
@@ -176,7 +177,10 @@ func fromMapToProperties(data interface{}, toString func(reflect.Value) string,
 
 // downloadDependency downloads the file located at the given URL into a temporary folder and returns the local path to the generated temporary file.
 func downloadDependency(ctx context.Context, url url.URL) (string, error) {
-	req, err := http.NewRequestWithContext(ctx, http.MethodGet, url.String(), nil)
+	tctx, cancel := context.WithTimeout(ctx, 3*time.Second)
+	defer cancel()
+
+	req, err := http.NewRequestWithContext(tctx, http.MethodGet, url.String(), nil)
 	if err != nil {
 		return "", err
 	}