From 8994b23ac116981b9c4e2257f3302aea0c53d5c7 Mon Sep 17 00:00:00 2001 From: Stavros Kontopoulos Date: Wed, 1 Nov 2023 14:23:17 +0200 Subject: [PATCH] remove dead code and other fixes --- pkg/activator/net/throttler_test.go | 8 ++++---- pkg/http/handler/timeout_test.go | 1 - pkg/reconciler/revision/background_test.go | 2 +- pkg/reconciler/route/traffic/rollout.go | 4 ++-- pkg/reconciler/route/traffic/rollout_test.go | 2 -- test/conformance.go | 2 -- 6 files changed, 7 insertions(+), 12 deletions(-) diff --git a/pkg/activator/net/throttler_test.go b/pkg/activator/net/throttler_test.go index 5a28aa5c3c99..16df2f2c4630 100644 --- a/pkg/activator/net/throttler_test.go +++ b/pkg/activator/net/throttler_test.go @@ -741,10 +741,10 @@ func TestActivatorsIndexUpdate(t *testing.T) { }() possibleDests := sets.NewString("128.0.0.1:1234", "128.0.0.2:1234", "128.0.0.23:1234") - updateCh <- (revisionDestsUpdate{ + updateCh <- revisionDestsUpdate{ Rev: revID, Dests: possibleDests, - }) + } // Add activator endpoint with 2 activators. publicEp := &corev1.Endpoints{ @@ -837,10 +837,10 @@ func TestMultipleActivators(t *testing.T) { revID := types.NamespacedName{Namespace: testNamespace, Name: testRevision} possibleDests := sets.NewString("128.0.0.1:1234", "128.0.0.2:1234", "128.0.0.23:1234") - updateCh <- (revisionDestsUpdate{ + updateCh <- revisionDestsUpdate{ Rev: revID, Dests: possibleDests, - }) + } // Add activator endpoint with 2 activators. publicEp := &corev1.Endpoints{ diff --git a/pkg/http/handler/timeout_test.go b/pkg/http/handler/timeout_test.go index c9ac8c49c1a1..b388e94d5ddd 100644 --- a/pkg/http/handler/timeout_test.go +++ b/pkg/http/handler/timeout_test.go @@ -334,7 +334,6 @@ func TestIdleTimeoutHandler(t *testing.T) { func TestTimeoutHandler(t *testing.T) { const ( - noTimeout = 0 * time.Millisecond immediateTimeout = 1 * time.Millisecond shortTimeout = 100 * time.Millisecond longTimeout = 1 * time.Minute diff --git a/pkg/reconciler/revision/background_test.go b/pkg/reconciler/revision/background_test.go index 08078cb56ffa..3e6d048fad8e 100644 --- a/pkg/reconciler/revision/background_test.go +++ b/pkg/reconciler/revision/background_test.go @@ -243,7 +243,7 @@ func TestRateLimitPerItem(t *testing.T) { latency := time.Since(start) // no delay on first resolve - expected := (time.Duration(math.Pow(2, float64(i-1))) * baseDelay) + expected := time.Duration(math.Pow(2, float64(i-1))) * baseDelay if latency < expected { t.Fatalf("latency = %s, want at least %s", latency, expected) } diff --git a/pkg/reconciler/route/traffic/rollout.go b/pkg/reconciler/route/traffic/rollout.go index 3a19a2ae64a9..5e5e49b3c5f2 100644 --- a/pkg/reconciler/route/traffic/rollout.go +++ b/pkg/reconciler/route/traffic/rollout.go @@ -280,12 +280,12 @@ func adjustPercentage(goal int, cr *ConfigurationRollout, logger *zap.SugaredLog cr.Revisions = nil // No traffic, no rollout. case diff > 0: logger.Infof("Traffic for config %s increased by %d%%, assigning the difference to the latest revision", - cr.ConfigurationName) + cr.ConfigurationName, diff) cr.Revisions[len(cr.Revisions)-1].Percent += diff case diff < 0: diff = -diff // To make logic more natural. logger.Infof("Traffic for config %s decreased by %d%%, removing the difference from the oldest revision(s)", - cr.ConfigurationName) + cr.ConfigurationName, diff) i := 0 for diff > 0 && i < len(cr.Revisions) { if cr.Revisions[i].Percent > diff { diff --git a/pkg/reconciler/route/traffic/rollout_test.go b/pkg/reconciler/route/traffic/rollout_test.go index 64490b9d0378..ebb0a6d08bdc 100644 --- a/pkg/reconciler/route/traffic/rollout_test.go +++ b/pkg/reconciler/route/traffic/rollout_test.go @@ -1011,9 +1011,7 @@ func TestObserveReady(t *testing.T) { const ( now = 200620092020 + 1982 oldenDays = 198219841988 - oldenStep = float64(now-oldenDays) / float64(time.Second) ancientDays = 14921812 - ancientStep = float64(now-ancientDays) / float64(time.Second) duration = 120. ) ro := Rollout{ diff --git a/test/conformance.go b/test/conformance.go index df8a605eac83..ff31fd4d49f1 100644 --- a/test/conformance.go +++ b/test/conformance.go @@ -45,7 +45,6 @@ const ( InvalidHelloWorld = "invalidhelloworld" // Not a real image PizzaPlanet1 = "pizzaplanetv1" PizzaPlanet2 = "pizzaplanetv2" - Protocols = "protocols" Readiness = "readiness" Runtime = "runtime" ServingContainer = "servingcontainer" @@ -53,7 +52,6 @@ const ( SingleThreadedImage = "singlethreaded" Timeout = "timeout" Volumes = "volumes" - WorkingDir = "workingdir" SlowStart = "slowstart" // Constants for test image output.