Update Go version to 1.24 (#3167)
* Update Go version to 1.24 * Update golangci-lint version * Add envtest to tool * Add dashboard linter as a tool * Uset t.Cleanup --------- Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
This commit is contained in:
@@ -37,7 +37,7 @@ const (
|
||||
func TestRefreshFuncPods(t *testing.T) {
|
||||
os.Setenv("DEBUG_ENV", "true")
|
||||
mgr := manager.New()
|
||||
defer mgr.Wait()
|
||||
t.Cleanup(mgr.Wait)
|
||||
logger := loggerfactory.GetLogger()
|
||||
kubernetesClient := fake.NewSimpleClientset()
|
||||
fissionClient := fClient.NewSimpleClientset()
|
||||
@@ -50,8 +50,7 @@ func TestRefreshFuncPods(t *testing.T) {
|
||||
}
|
||||
ndmInformerFactory := utils.GetInformerFactoryByExecutor(kubernetesClient, executorLabel, time.Minute*30)
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
ctx := t.Context()
|
||||
|
||||
fetcherConfig, err := fetcherConfig.MakeFetcherConfig("/userfunc")
|
||||
if err != nil {
|
||||
|
||||
@@ -16,7 +16,6 @@ limitations under the License.
|
||||
package poolmgr
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -39,9 +38,8 @@ import (
|
||||
|
||||
func TestPoolPodControllerPodCleanup(t *testing.T) {
|
||||
mgr := manager.New()
|
||||
defer mgr.Wait()
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
t.Cleanup(mgr.Wait)
|
||||
ctx := t.Context()
|
||||
logger := loggerfactory.GetLogger()
|
||||
kubernetesClient := fake.NewSimpleClientset()
|
||||
fissionClient := fClient.NewSimpleClientset()
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package fscache
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -157,8 +156,7 @@ func TestFunctionServiceNewCache(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
ctx := t.Context()
|
||||
|
||||
fsc.AddFunc(ctx, *fsvc, 10, fn.GetRetainPods())
|
||||
concurrency := 10
|
||||
|
||||
@@ -24,8 +24,7 @@ func checkErr(err error) {
|
||||
}
|
||||
|
||||
func TestPoolCache(t *testing.T) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
ctx := t.Context()
|
||||
logger := loggerfactory.GetLogger()
|
||||
concurrency := 5
|
||||
requestsPerPod := 2
|
||||
|
||||
@@ -16,7 +16,6 @@ limitations under the License.
|
||||
package hpa
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
@@ -58,8 +57,7 @@ func TestHpaOps(t *testing.T) {
|
||||
t.Errorf("Expected instanceID to be %v, got %v", instanceID, hpaops.instanceID)
|
||||
}
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
ctx := t.Context()
|
||||
|
||||
deployLabels := map[string]string{
|
||||
"test-label": "test-label-value",
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package mqtrigger
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"sort"
|
||||
@@ -40,8 +39,7 @@ func Test_toEnvVar(t *testing.T) {
|
||||
}
|
||||
|
||||
func Test_getEnvVarlist(t *testing.T) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
ctx := t.Context()
|
||||
// Kafka Test with Valid Secret
|
||||
pollingInterval := int32(30)
|
||||
cooldownPeriod := int32(300)
|
||||
@@ -373,8 +371,7 @@ func Test_checkAndUpdateTriggerFields(t *testing.T) {
|
||||
}
|
||||
|
||||
func Test_getAuthTriggerSpec(t *testing.T) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
ctx := t.Context()
|
||||
// Valid - with Secret
|
||||
pollingInterval := int32(30)
|
||||
cooldownPeriod := int32(300)
|
||||
|
||||
@@ -17,7 +17,6 @@ limitations under the License.
|
||||
package plugin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
@@ -58,8 +57,7 @@ func TestFind(t *testing.T) {
|
||||
}
|
||||
Prefix = ""
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
ctx := t.Context()
|
||||
|
||||
found, err := Find(ctx, md.Name)
|
||||
os.RemoveAll(testDir)
|
||||
|
||||
@@ -62,10 +62,9 @@ func GetRouterWithAuth() *mux.Router {
|
||||
func TestRouterAuth(t *testing.T) {
|
||||
|
||||
mgr := manager.New()
|
||||
defer mgr.Wait()
|
||||
t.Cleanup(mgr.Wait)
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
ctx := t.Context()
|
||||
teardown := setup(t)
|
||||
defer teardown(t)
|
||||
logger := loggerfactory.GetLogger()
|
||||
|
||||
@@ -69,7 +69,7 @@ func spamServer(quit chan bool) {
|
||||
|
||||
func TestMutableMux(t *testing.T) {
|
||||
mgr := manager.New()
|
||||
defer mgr.Wait()
|
||||
t.Cleanup(mgr.Wait)
|
||||
|
||||
// make a simple mutable router
|
||||
log.Print("Create mutable router")
|
||||
@@ -82,8 +82,7 @@ func TestMutableMux(t *testing.T) {
|
||||
panicIf(err)
|
||||
|
||||
mr := newMutableRouter(logger, muxRouter)
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
ctx := t.Context()
|
||||
|
||||
// start http server
|
||||
mgr.Add(ctx, func(ctx context.Context) {
|
||||
|
||||
@@ -18,7 +18,6 @@ package client
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
@@ -88,7 +87,7 @@ func TestS3StorageService(t *testing.T) {
|
||||
var minioClient *minio.Client
|
||||
|
||||
mgr := manager.New()
|
||||
defer mgr.Wait()
|
||||
t.Cleanup(mgr.Wait)
|
||||
|
||||
// Start minio docker container
|
||||
pool, err := dockertest.NewPool("")
|
||||
@@ -141,8 +140,7 @@ func TestS3StorageService(t *testing.T) {
|
||||
os.Setenv("STORAGE_S3_REGION", minioRegion)
|
||||
|
||||
storage := storagesvc.NewS3Storage()
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
ctx := t.Context()
|
||||
_ = storagesvc.Start(ctx, crd.NewClientGenerator(), logger, storage, mgr, port)
|
||||
|
||||
time.Sleep(time.Second)
|
||||
@@ -210,7 +208,7 @@ func TestLocalStorageService(t *testing.T) {
|
||||
port := 8082
|
||||
|
||||
mgr := manager.New()
|
||||
defer mgr.Wait()
|
||||
t.Cleanup(mgr.Wait)
|
||||
|
||||
config := zap.NewDevelopmentConfig()
|
||||
config.EncoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
|
||||
@@ -221,8 +219,7 @@ func TestLocalStorageService(t *testing.T) {
|
||||
localPath := fmt.Sprintf("/tmp/%v", testID)
|
||||
_ = os.Mkdir(localPath, os.ModePerm)
|
||||
storage := storagesvc.NewLocalStorage(localPath)
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
ctx := t.Context()
|
||||
os.Setenv("METRICS_ADDR", "8083")
|
||||
_ = storagesvc.Start(ctx, crd.NewClientGenerator(), logger, storage, mgr, port)
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package tracker
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"log"
|
||||
@@ -14,8 +13,7 @@ import (
|
||||
)
|
||||
|
||||
func TestTracker(t *testing.T) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
ctx := t.Context()
|
||||
t.Run("NewTracker", func(test *testing.T) {
|
||||
for _, test := range []struct {
|
||||
name string
|
||||
|
||||
@@ -17,10 +17,9 @@ import (
|
||||
|
||||
func TestStartServer(t *testing.T) {
|
||||
mgr := manager.New()
|
||||
defer mgr.Wait()
|
||||
t.Cleanup(mgr.Wait)
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
ctx := t.Context()
|
||||
logger := loggerfactory.GetLogger()
|
||||
m := mux.NewRouter()
|
||||
m.Handle("/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package otel
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"reflect"
|
||||
@@ -62,8 +61,7 @@ func TestGetTraceExporter(t *testing.T) {
|
||||
t.Errorf("Expected OTEL_EXPORTER_OTLP_INSECURE to be set, got %s", OtelInsecureEnvVar)
|
||||
}
|
||||
logger := loggerfactory.GetLogger()
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
ctx := t.Context()
|
||||
tests := []struct {
|
||||
oltpEndpoint string
|
||||
oltpInsecure string
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"regexp"
|
||||
"testing"
|
||||
@@ -15,9 +14,8 @@ import (
|
||||
|
||||
func TestServiceAccountCheck(t *testing.T) {
|
||||
mgr := manager.New()
|
||||
defer mgr.Wait()
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
t.Cleanup(mgr.Wait)
|
||||
ctx := t.Context()
|
||||
kubernetesClient := fake.NewSimpleClientset()
|
||||
logger := loggerfactory.GetLogger()
|
||||
os.Setenv(ENV_CREATE_SA, "true")
|
||||
|
||||
Reference in New Issue
Block a user