move to go1.24 (#21114)

This commit is contained in:
Harshavardhana
2025-04-09 07:28:39 -07:00
committed by GitHub
parent a6258668a6
commit 2b34e5b9ae
74 changed files with 434 additions and 458 deletions

View File

@@ -18,7 +18,6 @@
package event
import (
"context"
"encoding/xml"
"reflect"
"strings"
@@ -252,9 +251,9 @@ func TestQueueValidate(t *testing.T) {
panic(err)
}
targetList1 := NewTargetList(context.Background())
targetList1 := NewTargetList(t.Context())
targetList2 := NewTargetList(context.Background())
targetList2 := NewTargetList(t.Context())
if err := targetList2.Add(&ExampleTarget{TargetID{"1", "webhook"}, false, false}); err != nil {
panic(err)
}
@@ -596,9 +595,9 @@ func TestConfigValidate(t *testing.T) {
panic(err)
}
targetList1 := NewTargetList(context.Background())
targetList1 := NewTargetList(t.Context())
targetList2 := NewTargetList(context.Background())
targetList2 := NewTargetList(t.Context())
if err := targetList2.Add(&ExampleTarget{TargetID{"1", "webhook"}, false, false}); err != nil {
panic(err)
}
@@ -928,9 +927,9 @@ func TestParseConfig(t *testing.T) {
</NotificationConfiguration>
`)
targetList1 := NewTargetList(context.Background())
targetList1 := NewTargetList(t.Context())
targetList2 := NewTargetList(context.Background())
targetList2 := NewTargetList(t.Context())
if err := targetList2.Add(&ExampleTarget{TargetID{"1", "webhook"}, false, false}); err != nil {
panic(err)
}

View File

@@ -18,7 +18,6 @@
package event
import (
"context"
"crypto/rand"
"errors"
"reflect"
@@ -86,14 +85,14 @@ func (target ExampleTarget) FlushQueueStore() error {
}
func TestTargetListAdd(t *testing.T) {
targetListCase1 := NewTargetList(context.Background())
targetListCase1 := NewTargetList(t.Context())
targetListCase2 := NewTargetList(context.Background())
targetListCase2 := NewTargetList(t.Context())
if err := targetListCase2.Add(&ExampleTarget{TargetID{"2", "testcase"}, false, false}); err != nil {
panic(err)
}
targetListCase3 := NewTargetList(context.Background())
targetListCase3 := NewTargetList(t.Context())
if err := targetListCase3.Add(&ExampleTarget{TargetID{"3", "testcase"}, false, false}); err != nil {
panic(err)
}
@@ -141,14 +140,14 @@ func TestTargetListAdd(t *testing.T) {
}
func TestTargetListExists(t *testing.T) {
targetListCase1 := NewTargetList(context.Background())
targetListCase1 := NewTargetList(t.Context())
targetListCase2 := NewTargetList(context.Background())
targetListCase2 := NewTargetList(t.Context())
if err := targetListCase2.Add(&ExampleTarget{TargetID{"2", "testcase"}, false, false}); err != nil {
panic(err)
}
targetListCase3 := NewTargetList(context.Background())
targetListCase3 := NewTargetList(t.Context())
if err := targetListCase3.Add(&ExampleTarget{TargetID{"3", "testcase"}, false, false}); err != nil {
panic(err)
}
@@ -173,14 +172,14 @@ func TestTargetListExists(t *testing.T) {
}
func TestTargetListList(t *testing.T) {
targetListCase1 := NewTargetList(context.Background())
targetListCase1 := NewTargetList(t.Context())
targetListCase2 := NewTargetList(context.Background())
targetListCase2 := NewTargetList(t.Context())
if err := targetListCase2.Add(&ExampleTarget{TargetID{"2", "testcase"}, false, false}); err != nil {
panic(err)
}
targetListCase3 := NewTargetList(context.Background())
targetListCase3 := NewTargetList(t.Context())
if err := targetListCase3.Add(&ExampleTarget{TargetID{"3", "testcase"}, false, false}); err != nil {
panic(err)
}
@@ -220,7 +219,7 @@ func TestTargetListList(t *testing.T) {
}
func TestNewTargetList(t *testing.T) {
if result := NewTargetList(context.Background()); result == nil {
if result := NewTargetList(t.Context()); result == nil {
t.Fatalf("test: result: expected: <non-nil>, got: <nil>")
}
}