diff --git a/go.mod b/go.mod index 789c7ca49c..e2ca4051e9 100644 --- a/go.mod +++ b/go.mod @@ -25,10 +25,10 @@ require ( k8s.io/apimachinery v0.27.6 k8s.io/client-go v0.27.6 k8s.io/utils v0.0.0-20230209194617-a36077c30491 - knative.dev/eventing v0.39.1-0.20231103063133-d978f3c993fd + knative.dev/eventing v0.39.1-0.20231106141706-62e797b257bb knative.dev/hack v0.0.0-20231102183416-0d99b7ee9d63 - knative.dev/pkg v0.0.0-20231106073528-acf0a2d2dea9 - knative.dev/reconciler-test v0.0.0-20231103063332-212f3db95925 + knative.dev/pkg v0.0.0-20231107094615-5c9b7a8d8265 + knative.dev/reconciler-test v0.0.0-20231107120858-d2429fb0b545 sigs.k8s.io/yaml v1.4.0 ) diff --git a/go.sum b/go.sum index 41fc47eb46..3f79e64ddf 100644 --- a/go.sum +++ b/go.sum @@ -935,14 +935,14 @@ k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f h1:2kWPakN3i/k81b0gvD5C5F k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f/go.mod h1:byini6yhqGC14c3ebc/QwanvYwhuMWF6yz2F8uwW8eg= k8s.io/utils v0.0.0-20230209194617-a36077c30491 h1:r0BAOLElQnnFhE/ApUsg3iHdVYYPBjNSSOMowRZxxsY= k8s.io/utils v0.0.0-20230209194617-a36077c30491/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -knative.dev/eventing v0.39.1-0.20231103063133-d978f3c993fd h1:TqqEeyk73nRY4excMiV3+gt8v9+0eWFnG6B7jzD3Ma4= -knative.dev/eventing v0.39.1-0.20231103063133-d978f3c993fd/go.mod h1:CR1AGu7mtm9w3JdRpdrolMmoYtOeP4vb0jPUMOi0r6U= +knative.dev/eventing v0.39.1-0.20231106141706-62e797b257bb h1:cqDvaK7znWzq/UbObhAX8FSWzriZHPBi2QT/xIg1iGo= +knative.dev/eventing v0.39.1-0.20231106141706-62e797b257bb/go.mod h1:2+O6/8BM8o1mMUeaZgAh78u3dAQ0zbbf1Tlt2QEa2zs= knative.dev/hack v0.0.0-20231102183416-0d99b7ee9d63 h1:QNbIbsep8jreNCXj3EFrsw0RtsrmMZw7yxYyUG5AILs= knative.dev/hack v0.0.0-20231102183416-0d99b7ee9d63/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q= -knative.dev/pkg v0.0.0-20231106073528-acf0a2d2dea9 h1:9JQb0ETlOXxtXb6zeJuvjcdsI5BQ83Rv1PEzIzC8B8U= -knative.dev/pkg v0.0.0-20231106073528-acf0a2d2dea9/go.mod h1:jCNm6Y66ArM8uDqpHwRwW7LuMFn79Q3KIn5L1R/WfI4= -knative.dev/reconciler-test v0.0.0-20231103063332-212f3db95925 h1:Iz7vRfFWMK2nu1znle0uXHg5bRPwCTAVFVwKir0tBl0= -knative.dev/reconciler-test v0.0.0-20231103063332-212f3db95925/go.mod h1:Ok0TfApVs8qkbytYq70Q7aetM21J3L41x9c3HKI/U1I= +knative.dev/pkg v0.0.0-20231107094615-5c9b7a8d8265 h1:wFDUSmvSQF48tUCIUIFKMOxq9jpV+vXf5l+RZYxYyt4= +knative.dev/pkg v0.0.0-20231107094615-5c9b7a8d8265/go.mod h1:P3m1Mg/FJjmr9oFHfWcoUbJLSlBi/hgwakobPxyqrZ4= +knative.dev/reconciler-test v0.0.0-20231107120858-d2429fb0b545 h1:0F0E77IbX5XxCxZ19Gopygwy+b6pVktrYAzMcFnVhK4= +knative.dev/reconciler-test v0.0.0-20231107120858-d2429fb0b545/go.mod h1:R7GebYEQbys4NXZJa0EzYx6+Hw3LZduuDkvp8FdBPU8= pgregory.net/rapid v0.3.3/go.mod h1:UYpPVyjFHzYBGHIxLFoupi8vwk6rXNzRY9OMvVxFIOU= pgregory.net/rapid v1.1.0 h1:CMa0sjHSru3puNx+J0MIAuiiEV4N0qj8/cMWGBBCsjw= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= diff --git a/vendor/knative.dev/reconciler-test/pkg/environment/timings.go b/vendor/knative.dev/reconciler-test/pkg/environment/timings.go index aac96e8281..bf4409b06c 100644 --- a/vendor/knative.dev/reconciler-test/pkg/environment/timings.go +++ b/vendor/knative.dev/reconciler-test/pkg/environment/timings.go @@ -19,37 +19,26 @@ package environment import ( "context" "time" + + "knative.dev/reconciler-test/pkg/state" ) +// this has been moved to state pkg to break cycle between environment and feature package, +// keeping the consts here for backwards API compatibility const ( DefaultPollInterval = 3 * time.Second DefaultPollTimeout = 2 * time.Minute ) -type timingsKey struct{} -type timingsType struct { - interval time.Duration - timeout time.Duration -} - -// PollTimingsFromContext will get the previously set poll timing from context, -// or return the defaults if not found. -// - values from from context. -// - defaults. +// ContextWithPollTimings returns a context with poll timings set func ContextWithPollTimings(ctx context.Context, interval, timeout time.Duration) context.Context { - return context.WithValue(ctx, timingsKey{}, timingsType{ - interval: interval, - timeout: timeout, - }) + return state.ContextWithPollTimings(ctx, interval, timeout) } // PollTimingsFromContext will get the previously set poll timing from context, // or return the defaults if not found. -// - values from from context. +// - values from context. // - defaults. func PollTimingsFromContext(ctx context.Context) (time.Duration, time.Duration) { - if t, ok := ctx.Value(timingsKey{}).(timingsType); ok { - return t.interval, t.timeout - } - return DefaultPollInterval, DefaultPollTimeout + return state.PollTimingsFromContext(ctx) } diff --git a/vendor/knative.dev/reconciler-test/pkg/feature/feature.go b/vendor/knative.dev/reconciler-test/pkg/feature/feature.go index 4113bc3d0d..0d454c5172 100644 --- a/vendor/knative.dev/reconciler-test/pkg/feature/feature.go +++ b/vendor/knative.dev/reconciler-test/pkg/feature/feature.go @@ -23,7 +23,6 @@ import ( "runtime" "strings" "sync" - "time" corev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" @@ -32,7 +31,6 @@ import ( "k8s.io/apimachinery/pkg/util/wait" "knative.dev/pkg/apis" "knative.dev/pkg/injection/clients/dynamicclient" - "knative.dev/reconciler-test/pkg/state" ) @@ -229,7 +227,8 @@ func DeleteResources(ctx context.Context, t T, refs []corev1.ObjectReference) er var lastResource corev1.ObjectReference // One still present resource - err := wait.Poll(time.Second, 4*time.Minute, func() (bool, error) { + interval, timeout := state.PollTimingsFromContext(ctx) + err := wait.Poll(interval, timeout, func() (bool, error) { for _, ref := range refs { gv, err := schema.ParseGroupVersion(ref.APIVersion) if err != nil { diff --git a/vendor/knative.dev/reconciler-test/pkg/state/timings.go b/vendor/knative.dev/reconciler-test/pkg/state/timings.go new file mode 100644 index 0000000000..88a3dc1e6d --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/state/timings.go @@ -0,0 +1,52 @@ +/* +Copyright 2021 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package state + +import ( + "context" + "time" +) + +const ( + DefaultPollInterval = 3 * time.Second + DefaultPollTimeout = 2 * time.Minute +) + +type timingsKey struct{} +type timingsType struct { + interval time.Duration + timeout time.Duration +} + +// ContextWithPollTimings returns a context with poll timings set +func ContextWithPollTimings(ctx context.Context, interval, timeout time.Duration) context.Context { + return context.WithValue(ctx, timingsKey{}, timingsType{ + interval: interval, + timeout: timeout, + }) +} + +// PollTimingsFromContext will get the previously set poll timing from context, +// or return the defaults if not found. +// - values from context. +// - defaults. +func PollTimingsFromContext(ctx context.Context) (time.Duration, time.Duration) { + if t, ok := ctx.Value(timingsKey{}).(timingsType); ok { + return t.interval, t.timeout + } + return DefaultPollInterval, DefaultPollTimeout +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 3a39df4273..47cf2446a9 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1284,7 +1284,7 @@ k8s.io/utils/net k8s.io/utils/pointer k8s.io/utils/strings/slices k8s.io/utils/trace -# knative.dev/eventing v0.39.1-0.20231103063133-d978f3c993fd +# knative.dev/eventing v0.39.1-0.20231106141706-62e797b257bb ## explicit; go 1.19 knative.dev/eventing/cmd/heartbeats knative.dev/eventing/pkg/adapter/v2 @@ -1399,7 +1399,7 @@ knative.dev/eventing/test/upgrade/prober/wathola/sender ## explicit; go 1.18 knative.dev/hack knative.dev/hack/shell -# knative.dev/pkg v0.0.0-20231106073528-acf0a2d2dea9 +# knative.dev/pkg v0.0.0-20231107094615-5c9b7a8d8265 ## explicit; go 1.18 knative.dev/pkg/apiextensions/storageversion knative.dev/pkg/apiextensions/storageversion/cmd/migrate @@ -1497,7 +1497,7 @@ knative.dev/pkg/webhook/resourcesemantics knative.dev/pkg/webhook/resourcesemantics/conversion knative.dev/pkg/webhook/resourcesemantics/defaulting knative.dev/pkg/webhook/resourcesemantics/validation -# knative.dev/reconciler-test v0.0.0-20231103063332-212f3db95925 +# knative.dev/reconciler-test v0.0.0-20231107120858-d2429fb0b545 ## explicit; go 1.20 knative.dev/reconciler-test/cmd/eventshub knative.dev/reconciler-test/pkg/environment