From 3c11749f80030d68ef5882f72f9e1d3cd07cf9cb Mon Sep 17 00:00:00 2001
From: stefanprodan <stefan.prodan@gmail.com>
Date: Tue, 31 Mar 2020 12:45:46 +0300
Subject: [PATCH] loadtester: release v0.16.0 - update helm to 2.16.5 - update
 helmv3 to 3.1.2 - remove http server timeouts

---
 Dockerfile.loadtester            |  4 ++--
 charts/loadtester/Chart.yaml     |  4 ++--
 cmd/loadtester/main.go           |  2 +-
 kustomize/tester/deployment.yaml |  2 +-
 pkg/loadtester/server.go         | 15 ++++++---------
 5 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/Dockerfile.loadtester b/Dockerfile.loadtester
index 1ad4fb1c5..b35b4d2a4 100644
--- a/Dockerfile.loadtester
+++ b/Dockerfile.loadtester
@@ -5,12 +5,12 @@ RUN apk --no-cache add alpine-sdk perl curl
 RUN curl -sSLo hey "https://storage.googleapis.com/hey-release/hey_linux_amd64" && \
 chmod +x hey && mv hey /usr/local/bin/hey
 
-RUN HELM2_VERSION=2.16.3 && \
+RUN HELM2_VERSION=2.16.5 && \
 curl -sSL "https://get.helm.sh/helm-v${HELM2_VERSION}-linux-amd64.tar.gz" | tar xvz && \
 chmod +x linux-amd64/helm && mv linux-amd64/helm /usr/local/bin/helm && \
 chmod +x linux-amd64/tiller && mv linux-amd64/tiller /usr/local/bin/tiller
 
-RUN HELM3_VERSION=3.1.1 && \
+RUN HELM3_VERSION=3.1.2 && \
 curl -sSL "https://get.helm.sh/helm-v${HELM3_VERSION}-linux-amd64.tar.gz" | tar xvz && \
 chmod +x linux-amd64/helm && mv linux-amd64/helm /usr/local/bin/helmv3
 
diff --git a/charts/loadtester/Chart.yaml b/charts/loadtester/Chart.yaml
index 7fbfdb010..985d69e0f 100644
--- a/charts/loadtester/Chart.yaml
+++ b/charts/loadtester/Chart.yaml
@@ -1,7 +1,7 @@
 apiVersion: v1
 name: loadtester
-version: 0.15.0
-appVersion: 0.15.0
+version: 0.16.0
+appVersion: 0.16.0
 kubeVersion: ">=1.11.0-0"
 engine: gotpl
 description: Flagger's load testing services based on rakyll/hey and bojand/ghz that generates traffic during canary analysis when configured as a webhook.
diff --git a/cmd/loadtester/main.go b/cmd/loadtester/main.go
index 24b02dbc5..4ae99087d 100644
--- a/cmd/loadtester/main.go
+++ b/cmd/loadtester/main.go
@@ -11,7 +11,7 @@ import (
 	"go.uber.org/zap"
 )
 
-var VERSION = "0.15.0"
+var VERSION = "0.16.0"
 var (
 	logLevel          string
 	port              string
diff --git a/kustomize/tester/deployment.yaml b/kustomize/tester/deployment.yaml
index 51e2665d4..1826ec71d 100644
--- a/kustomize/tester/deployment.yaml
+++ b/kustomize/tester/deployment.yaml
@@ -18,7 +18,7 @@ spec:
     spec:
       containers:
         - name: loadtester
-          image: weaveworks/flagger-loadtester:0.15.0
+          image: weaveworks/flagger-loadtester:0.16.0
           imagePullPolicy: IfNotPresent
           ports:
             - name: http
diff --git a/pkg/loadtester/server.go b/pkg/loadtester/server.go
index 73443a8a5..89d7298ce 100644
--- a/pkg/loadtester/server.go
+++ b/pkg/loadtester/server.go
@@ -187,11 +187,8 @@ func ListenAndServe(port string, timeout time.Duration, logger *zap.SugaredLogge
 
 	mux.HandleFunc("/", HandleNewTask(logger, taskRunner))
 	srv := &http.Server{
-		Addr:         ":" + port,
-		Handler:      mux,
-		ReadTimeout:  5 * time.Second,
-		WriteTimeout: timeout,
-		IdleTimeout:  15 * time.Second,
+		Addr:    ":" + port,
+		Handler: mux,
 	}
 
 	// run server in background
@@ -250,11 +247,11 @@ func HandleNewTask(logger *zap.SugaredLogger, taskRunner TaskRunnerInterface) fu
 				rtnCmdOutput, err = strconv.ParseBool(rtn)
 			}
 
-			// run bats command (blocking task)
+			// run bash command (blocking task)
 			if typ == TaskTypeBash {
-				logger.With("canary", payload.Name).Infof("bats command %s", payload.Metadata["cmd"])
+				logger.With("canary", payload.Name).Infof("bash command %s", payload.Metadata["cmd"])
 
-				bats := BashTask{
+				bashTask := BashTask{
 					command:      payload.Metadata["cmd"],
 					logCmdOutput: true,
 					TaskBase: TaskBase{
@@ -266,7 +263,7 @@ func HandleNewTask(logger *zap.SugaredLogger, taskRunner TaskRunnerInterface) fu
 				ctx, cancel := context.WithTimeout(context.Background(), taskRunner.Timeout())
 				defer cancel()
 
-				result, err := bats.Run(ctx)
+				result, err := bashTask.Run(ctx)
 				if !result.ok {
 					w.WriteHeader(http.StatusInternalServerError)
 					w.Write([]byte(err.Error()))