From 0fbeca0a56ed03fea640de5c8f2463c011c35bdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Cihan=20Karag=C3=BCc=C3=BCk?= Date: Tue, 23 Jul 2024 12:19:49 +0300 Subject: [PATCH 1/3] integration tests added --- .../reconciler/eventmesh/integration_test.go | 68 +++++++ go.mod | 2 +- .../v2/internal/httprule/BUILD.bazel | 35 ++++ .../grpc-gateway/v2/runtime/BUILD.bazel | 97 ++++++++++ .../grpc-gateway/v2/utilities/BUILD.bazel | 31 +++ .../k8s.io/apimachinery/pkg/api/errors/OWNERS | 17 ++ .../k8s.io/apimachinery/pkg/api/meta/OWNERS | 14 ++ .../apimachinery/pkg/api/resource/OWNERS | 11 ++ .../apimachinery/pkg/apis/meta/v1/OWNERS | 16 ++ .../apimachinery/pkg/util/mergepatch/OWNERS | 6 + .../pkg/util/strategicpatch/OWNERS | 9 + .../third_party/forked/golang/json/OWNERS | 6 + vendor/k8s.io/client-go/openapi/OWNERS | 4 + .../pkg/apis/clientauthentication/OWNERS | 8 + vendor/k8s.io/client-go/rest/OWNERS | 14 ++ vendor/k8s.io/client-go/tools/auth/OWNERS | 8 + vendor/k8s.io/client-go/tools/cache/OWNERS | 28 +++ .../client-go/tools/leaderelection/OWNERS | 11 ++ vendor/k8s.io/client-go/tools/metrics/OWNERS | 5 + vendor/k8s.io/client-go/tools/record/OWNERS | 6 + vendor/k8s.io/client-go/transport/OWNERS | 8 + vendor/k8s.io/client-go/util/cert/OWNERS | 8 + vendor/k8s.io/client-go/util/keyutil/OWNERS | 6 + vendor/k8s.io/client-go/util/retry/OWNERS | 4 + vendor/k8s.io/code-generator/OWNERS | 15 ++ .../code-generator/cmd/client-gen/OWNERS | 10 + .../code-generator/cmd/go-to-protobuf/OWNERS | 6 + vendor/k8s.io/klog/OWNERS | 19 ++ vendor/k8s.io/klog/v2/OWNERS | 14 ++ .../kube-openapi/pkg/generators/rules/OWNERS | 4 + .../k8s.io/kube-openapi/pkg/util/proto/OWNERS | 2 + vendor/k8s.io/utils/pointer/OWNERS | 10 + vendor/knative.dev/eventing/hack/OWNERS | 10 + vendor/knative.dev/hack/OWNERS | 8 + vendor/knative.dev/hack/OWNERS_ALIASES | 183 ++++++++++++++++++ vendor/knative.dev/pkg/apis/OWNERS | 15 ++ vendor/knative.dev/pkg/apis/duck/OWNERS | 8 + vendor/knative.dev/pkg/controller/OWNERS | 7 + vendor/knative.dev/pkg/hack/OWNERS | 10 + vendor/knative.dev/pkg/reconciler/OWNERS | 7 + vendor/knative.dev/pkg/resolver/OWNERS | 8 + .../pkg/eventshub/assert/doc.go | 20 ++ .../eventshub/assert/event_info_matchers.go | 133 +++++++++++++ .../pkg/eventshub/assert/step.go | 156 +++++++++++++++ vendor/modules.txt | 1 + vendor/sigs.k8s.io/json/OWNERS | 6 + vendor/sigs.k8s.io/yaml/OWNERS | 23 +++ vendor/sigs.k8s.io/yaml/goyaml.v2/OWNERS | 24 +++ 48 files changed, 1120 insertions(+), 1 deletion(-) create mode 100644 backends/pkg/reconciler/eventmesh/integration_test.go create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule/BUILD.bazel create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/BUILD.bazel create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/v2/utilities/BUILD.bazel create mode 100644 vendor/k8s.io/apimachinery/pkg/api/errors/OWNERS create mode 100644 vendor/k8s.io/apimachinery/pkg/api/meta/OWNERS create mode 100644 vendor/k8s.io/apimachinery/pkg/api/resource/OWNERS create mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/OWNERS create mode 100644 vendor/k8s.io/apimachinery/pkg/util/mergepatch/OWNERS create mode 100644 vendor/k8s.io/apimachinery/pkg/util/strategicpatch/OWNERS create mode 100644 vendor/k8s.io/apimachinery/third_party/forked/golang/json/OWNERS create mode 100644 vendor/k8s.io/client-go/openapi/OWNERS create mode 100644 vendor/k8s.io/client-go/pkg/apis/clientauthentication/OWNERS create mode 100644 vendor/k8s.io/client-go/rest/OWNERS create mode 100644 vendor/k8s.io/client-go/tools/auth/OWNERS create mode 100644 vendor/k8s.io/client-go/tools/cache/OWNERS create mode 100644 vendor/k8s.io/client-go/tools/leaderelection/OWNERS create mode 100644 vendor/k8s.io/client-go/tools/metrics/OWNERS create mode 100644 vendor/k8s.io/client-go/tools/record/OWNERS create mode 100644 vendor/k8s.io/client-go/transport/OWNERS create mode 100644 vendor/k8s.io/client-go/util/cert/OWNERS create mode 100644 vendor/k8s.io/client-go/util/keyutil/OWNERS create mode 100644 vendor/k8s.io/client-go/util/retry/OWNERS create mode 100644 vendor/k8s.io/code-generator/OWNERS create mode 100644 vendor/k8s.io/code-generator/cmd/client-gen/OWNERS create mode 100644 vendor/k8s.io/code-generator/cmd/go-to-protobuf/OWNERS create mode 100644 vendor/k8s.io/klog/OWNERS create mode 100644 vendor/k8s.io/klog/v2/OWNERS create mode 100644 vendor/k8s.io/kube-openapi/pkg/generators/rules/OWNERS create mode 100644 vendor/k8s.io/kube-openapi/pkg/util/proto/OWNERS create mode 100644 vendor/k8s.io/utils/pointer/OWNERS create mode 100644 vendor/knative.dev/eventing/hack/OWNERS create mode 100644 vendor/knative.dev/hack/OWNERS create mode 100644 vendor/knative.dev/hack/OWNERS_ALIASES create mode 100644 vendor/knative.dev/pkg/apis/OWNERS create mode 100644 vendor/knative.dev/pkg/apis/duck/OWNERS create mode 100644 vendor/knative.dev/pkg/controller/OWNERS create mode 100644 vendor/knative.dev/pkg/hack/OWNERS create mode 100644 vendor/knative.dev/pkg/reconciler/OWNERS create mode 100644 vendor/knative.dev/pkg/resolver/OWNERS create mode 100644 vendor/knative.dev/reconciler-test/pkg/eventshub/assert/doc.go create mode 100644 vendor/knative.dev/reconciler-test/pkg/eventshub/assert/event_info_matchers.go create mode 100644 vendor/knative.dev/reconciler-test/pkg/eventshub/assert/step.go create mode 100644 vendor/sigs.k8s.io/json/OWNERS create mode 100644 vendor/sigs.k8s.io/yaml/OWNERS create mode 100644 vendor/sigs.k8s.io/yaml/goyaml.v2/OWNERS diff --git a/backends/pkg/reconciler/eventmesh/integration_test.go b/backends/pkg/reconciler/eventmesh/integration_test.go new file mode 100644 index 00000000..054ae796 --- /dev/null +++ b/backends/pkg/reconciler/eventmesh/integration_test.go @@ -0,0 +1,68 @@ +package eventmesh + +import ( + "context" + "testing" + + authenticationv1 "k8s.io/api/authentication/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + kubeclient "knative.dev/pkg/client/injection/kube/client" + "knative.dev/reconciler-test/pkg/environment" + "knative.dev/reconciler-test/pkg/eventshub" + "knative.dev/reconciler-test/pkg/eventshub/assert" + "knative.dev/reconciler-test/pkg/feature" +) + +var global environment.GlobalEnvironment + +func TestIntegration(t *testing.T) { + t.Parallel() + + ctx, env := global.Environment(environment.Managed(t)) + env.Test(ctx, t, TesAuth()) +} + +func TesAuth() *feature.Feature { + f := feature.NewFeature() + + authenticatedClientName := feature.MakeRandomK8sName("authenticated-client") + unauthenticatedClientName := feature.MakeRandomK8sName("unauthenticated-client") + + SAName := "sa" + SANamespace := "default" + + f.Setup("request with authenticated client", func(ctx context.Context, t feature.T) { + tr := &authenticationv1.TokenRequest{ + // TODO: fill up + } + tr, err := kubeclient.Get(ctx). + CoreV1(). + ServiceAccounts(SANamespace). + CreateToken(ctx, SAName, tr, metav1.CreateOptions{}) + if err != nil { + t.Fatal("Failed to create token for SA", err) + } + eventshub.Install(authenticatedClientName, + eventshub.StartSenderURL("TODO_backstage_backend_url"), + eventshub.InputHeader("Authorization", "Bearer "+tr.Status.Token), + eventshub.InputMethod("GET"), + )(ctx, t) + }) + + f.Setup("request with unauthenticated client", eventshub.Install( + unauthenticatedClientName, + eventshub.StartSenderURL("localhost:8080"), + eventshub.InputMethod("GET")), + ) + + f.Assert("assert response with authenticated client", assert.OnStore(authenticatedClientName). + Match(assert.MatchKind(eventshub.EventResponse)). + Match(assert.MatchStatusCode(202)). + AtLeast(1)) + f.Assert("assert response with unauthenticated client", assert.OnStore(unauthenticatedClientName). + Match(assert.MatchKind(eventshub.EventResponse)). + Match(assert.MatchStatusCode(401)). + AtLeast(1)) + + return f +} diff --git a/go.mod b/go.mod index 0acd69b2..25f2f9d7 100644 --- a/go.mod +++ b/go.mod @@ -13,6 +13,7 @@ require ( knative.dev/eventing v0.39.1 knative.dev/hack v0.0.0-20231122182901-eb352426ecc1 knative.dev/pkg v0.0.0-20231204120332-9386ad6703ee + knative.dev/reconciler-test v0.0.0-20231024072442-5fb93a792b99 ) require ( @@ -103,7 +104,6 @@ require ( k8s.io/klog/v2 v2.90.1 // indirect k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f // indirect k8s.io/utils v0.0.0-20230209194617-a36077c30491 // indirect - knative.dev/reconciler-test v0.0.0-20231024072442-5fb93a792b99 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect sigs.k8s.io/yaml v1.4.0 // indirect diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule/BUILD.bazel b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule/BUILD.bazel new file mode 100644 index 00000000..f694f3c0 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule/BUILD.bazel @@ -0,0 +1,35 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +package(default_visibility = ["//visibility:public"]) + +go_library( + name = "httprule", + srcs = [ + "compile.go", + "parse.go", + "types.go", + ], + importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule", + deps = ["//utilities"], +) + +go_test( + name = "httprule_test", + size = "small", + srcs = [ + "compile_test.go", + "parse_test.go", + "types_test.go", + ], + embed = [":httprule"], + deps = [ + "//utilities", + "@com_github_golang_glog//:glog", + ], +) + +alias( + name = "go_default_library", + actual = ":httprule", + visibility = ["//:__subpackages__"], +) diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/BUILD.bazel b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/BUILD.bazel new file mode 100644 index 00000000..b5140a3c --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/BUILD.bazel @@ -0,0 +1,97 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +package(default_visibility = ["//visibility:public"]) + +go_library( + name = "runtime", + srcs = [ + "context.go", + "convert.go", + "doc.go", + "errors.go", + "fieldmask.go", + "handler.go", + "marshal_httpbodyproto.go", + "marshal_json.go", + "marshal_jsonpb.go", + "marshal_proto.go", + "marshaler.go", + "marshaler_registry.go", + "mux.go", + "pattern.go", + "proto2_convert.go", + "query.go", + ], + importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/runtime", + deps = [ + "//internal/httprule", + "//utilities", + "@go_googleapis//google/api:httpbody_go_proto", + "@io_bazel_rules_go//proto/wkt:field_mask_go_proto", + "@org_golang_google_grpc//codes", + "@org_golang_google_grpc//grpclog", + "@org_golang_google_grpc//health/grpc_health_v1", + "@org_golang_google_grpc//metadata", + "@org_golang_google_grpc//status", + "@org_golang_google_protobuf//encoding/protojson", + "@org_golang_google_protobuf//proto", + "@org_golang_google_protobuf//reflect/protoreflect", + "@org_golang_google_protobuf//reflect/protoregistry", + "@org_golang_google_protobuf//types/known/durationpb", + "@org_golang_google_protobuf//types/known/structpb", + "@org_golang_google_protobuf//types/known/timestamppb", + "@org_golang_google_protobuf//types/known/wrapperspb", + ], +) + +go_test( + name = "runtime_test", + size = "small", + srcs = [ + "context_test.go", + "convert_test.go", + "errors_test.go", + "fieldmask_test.go", + "handler_test.go", + "marshal_httpbodyproto_test.go", + "marshal_json_test.go", + "marshal_jsonpb_test.go", + "marshal_proto_test.go", + "marshaler_registry_test.go", + "mux_internal_test.go", + "mux_test.go", + "pattern_test.go", + "query_fuzz_test.go", + "query_test.go", + ], + embed = [":runtime"], + deps = [ + "//runtime/internal/examplepb", + "//utilities", + "@com_github_google_go_cmp//cmp", + "@com_github_google_go_cmp//cmp/cmpopts", + "@go_googleapis//google/api:httpbody_go_proto", + "@go_googleapis//google/rpc:errdetails_go_proto", + "@go_googleapis//google/rpc:status_go_proto", + "@io_bazel_rules_go//proto/wkt:field_mask_go_proto", + "@org_golang_google_grpc//:go_default_library", + "@org_golang_google_grpc//codes", + "@org_golang_google_grpc//health/grpc_health_v1", + "@org_golang_google_grpc//metadata", + "@org_golang_google_grpc//status", + "@org_golang_google_protobuf//encoding/protojson", + "@org_golang_google_protobuf//proto", + "@org_golang_google_protobuf//testing/protocmp", + "@org_golang_google_protobuf//types/known/durationpb", + "@org_golang_google_protobuf//types/known/emptypb", + "@org_golang_google_protobuf//types/known/structpb", + "@org_golang_google_protobuf//types/known/timestamppb", + "@org_golang_google_protobuf//types/known/wrapperspb", + ], +) + +alias( + name = "go_default_library", + actual = ":runtime", + visibility = ["//visibility:public"], +) diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/utilities/BUILD.bazel b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/utilities/BUILD.bazel new file mode 100644 index 00000000..b8940946 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/utilities/BUILD.bazel @@ -0,0 +1,31 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +package(default_visibility = ["//visibility:public"]) + +go_library( + name = "utilities", + srcs = [ + "doc.go", + "pattern.go", + "readerfactory.go", + "string_array_flag.go", + "trie.go", + ], + importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/utilities", +) + +go_test( + name = "utilities_test", + size = "small", + srcs = [ + "string_array_flag_test.go", + "trie_test.go", + ], + deps = [":utilities"], +) + +alias( + name = "go_default_library", + actual = ":utilities", + visibility = ["//visibility:public"], +) diff --git a/vendor/k8s.io/apimachinery/pkg/api/errors/OWNERS b/vendor/k8s.io/apimachinery/pkg/api/errors/OWNERS new file mode 100644 index 00000000..155648ac --- /dev/null +++ b/vendor/k8s.io/apimachinery/pkg/api/errors/OWNERS @@ -0,0 +1,17 @@ +# See the OWNERS docs at https://go.k8s.io/owners + +reviewers: + - thockin + - lavalamp + - smarterclayton + - wojtek-t + - deads2k + - derekwaynecarr + - caesarxuchao + - mikedanese + - liggitt + - saad-ali + - janetkuo + - tallclair + - dims + - cjcullen diff --git a/vendor/k8s.io/apimachinery/pkg/api/meta/OWNERS b/vendor/k8s.io/apimachinery/pkg/api/meta/OWNERS new file mode 100644 index 00000000..1e1330ff --- /dev/null +++ b/vendor/k8s.io/apimachinery/pkg/api/meta/OWNERS @@ -0,0 +1,14 @@ +# See the OWNERS docs at https://go.k8s.io/owners + +reviewers: + - thockin + - smarterclayton + - wojtek-t + - deads2k + - derekwaynecarr + - caesarxuchao + - mikedanese + - liggitt + - janetkuo + - ncdc + - dims diff --git a/vendor/k8s.io/apimachinery/pkg/api/resource/OWNERS b/vendor/k8s.io/apimachinery/pkg/api/resource/OWNERS new file mode 100644 index 00000000..d1c9f530 --- /dev/null +++ b/vendor/k8s.io/apimachinery/pkg/api/resource/OWNERS @@ -0,0 +1,11 @@ +# See the OWNERS docs at https://go.k8s.io/owners + +reviewers: + - thockin + - lavalamp + - smarterclayton + - wojtek-t + - derekwaynecarr + - mikedanese + - saad-ali + - janetkuo diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/OWNERS b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/OWNERS new file mode 100644 index 00000000..e7e5c152 --- /dev/null +++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/OWNERS @@ -0,0 +1,16 @@ +# See the OWNERS docs at https://go.k8s.io/owners + +reviewers: + - thockin + - smarterclayton + - wojtek-t + - deads2k + - caesarxuchao + - liggitt + - sttts + - luxas + - janetkuo + - justinsb + - ncdc + - soltysh + - dims diff --git a/vendor/k8s.io/apimachinery/pkg/util/mergepatch/OWNERS b/vendor/k8s.io/apimachinery/pkg/util/mergepatch/OWNERS new file mode 100644 index 00000000..349bc69d --- /dev/null +++ b/vendor/k8s.io/apimachinery/pkg/util/mergepatch/OWNERS @@ -0,0 +1,6 @@ +# See the OWNERS docs at https://go.k8s.io/owners + +approvers: + - pwittrock +reviewers: + - apelisse diff --git a/vendor/k8s.io/apimachinery/pkg/util/strategicpatch/OWNERS b/vendor/k8s.io/apimachinery/pkg/util/strategicpatch/OWNERS new file mode 100644 index 00000000..73244449 --- /dev/null +++ b/vendor/k8s.io/apimachinery/pkg/util/strategicpatch/OWNERS @@ -0,0 +1,9 @@ +# See the OWNERS docs at https://go.k8s.io/owners + +approvers: + - apelisse + - pwittrock +reviewers: + - apelisse +emeritus_approvers: + - mengqiy diff --git a/vendor/k8s.io/apimachinery/third_party/forked/golang/json/OWNERS b/vendor/k8s.io/apimachinery/third_party/forked/golang/json/OWNERS new file mode 100644 index 00000000..349bc69d --- /dev/null +++ b/vendor/k8s.io/apimachinery/third_party/forked/golang/json/OWNERS @@ -0,0 +1,6 @@ +# See the OWNERS docs at https://go.k8s.io/owners + +approvers: + - pwittrock +reviewers: + - apelisse diff --git a/vendor/k8s.io/client-go/openapi/OWNERS b/vendor/k8s.io/client-go/openapi/OWNERS new file mode 100644 index 00000000..e6100942 --- /dev/null +++ b/vendor/k8s.io/client-go/openapi/OWNERS @@ -0,0 +1,4 @@ +# See the OWNERS docs at https://go.k8s.io/owners + +approvers: + - apelisse diff --git a/vendor/k8s.io/client-go/pkg/apis/clientauthentication/OWNERS b/vendor/k8s.io/client-go/pkg/apis/clientauthentication/OWNERS new file mode 100644 index 00000000..4dfbb98a --- /dev/null +++ b/vendor/k8s.io/client-go/pkg/apis/clientauthentication/OWNERS @@ -0,0 +1,8 @@ +# See the OWNERS docs at https://go.k8s.io/owners + +# approval on api packages bubbles to api-approvers +reviewers: + - sig-auth-authenticators-approvers + - sig-auth-authenticators-reviewers +labels: + - sig/auth diff --git a/vendor/k8s.io/client-go/rest/OWNERS b/vendor/k8s.io/client-go/rest/OWNERS new file mode 100644 index 00000000..7b23294c --- /dev/null +++ b/vendor/k8s.io/client-go/rest/OWNERS @@ -0,0 +1,14 @@ +# See the OWNERS docs at https://go.k8s.io/owners + +reviewers: + - thockin + - smarterclayton + - caesarxuchao + - wojtek-t + - deads2k + - liggitt + - sttts + - luxas + - dims + - cjcullen + - lojies diff --git a/vendor/k8s.io/client-go/tools/auth/OWNERS b/vendor/k8s.io/client-go/tools/auth/OWNERS new file mode 100644 index 00000000..c4ea6463 --- /dev/null +++ b/vendor/k8s.io/client-go/tools/auth/OWNERS @@ -0,0 +1,8 @@ +# See the OWNERS docs at https://go.k8s.io/owners + +approvers: + - sig-auth-authenticators-approvers +reviewers: + - sig-auth-authenticators-reviewers +labels: + - sig/auth diff --git a/vendor/k8s.io/client-go/tools/cache/OWNERS b/vendor/k8s.io/client-go/tools/cache/OWNERS new file mode 100644 index 00000000..726205b3 --- /dev/null +++ b/vendor/k8s.io/client-go/tools/cache/OWNERS @@ -0,0 +1,28 @@ +# See the OWNERS docs at https://go.k8s.io/owners + +approvers: + - thockin + - lavalamp + - smarterclayton + - wojtek-t + - deads2k + - caesarxuchao + - liggitt + - ncdc +reviewers: + - thockin + - lavalamp + - smarterclayton + - wojtek-t + - deads2k + - derekwaynecarr + - caesarxuchao + - mikedanese + - liggitt + - janetkuo + - justinsb + - soltysh + - jsafrane + - dims + - ingvagabund + - ncdc diff --git a/vendor/k8s.io/client-go/tools/leaderelection/OWNERS b/vendor/k8s.io/client-go/tools/leaderelection/OWNERS new file mode 100644 index 00000000..908bdacd --- /dev/null +++ b/vendor/k8s.io/client-go/tools/leaderelection/OWNERS @@ -0,0 +1,11 @@ +# See the OWNERS docs at https://go.k8s.io/owners + +approvers: + - mikedanese +reviewers: + - wojtek-t + - deads2k + - mikedanese + - ingvagabund +emeritus_approvers: + - timothysc diff --git a/vendor/k8s.io/client-go/tools/metrics/OWNERS b/vendor/k8s.io/client-go/tools/metrics/OWNERS new file mode 100644 index 00000000..2c9488a5 --- /dev/null +++ b/vendor/k8s.io/client-go/tools/metrics/OWNERS @@ -0,0 +1,5 @@ +# See the OWNERS docs at https://go.k8s.io/owners + +reviewers: + - wojtek-t + - jayunit100 diff --git a/vendor/k8s.io/client-go/tools/record/OWNERS b/vendor/k8s.io/client-go/tools/record/OWNERS new file mode 100644 index 00000000..8105c4fe --- /dev/null +++ b/vendor/k8s.io/client-go/tools/record/OWNERS @@ -0,0 +1,6 @@ +# See the OWNERS docs at https://go.k8s.io/owners + +reviewers: + - sig-instrumentation-reviewers +approvers: + - sig-instrumentation-approvers diff --git a/vendor/k8s.io/client-go/transport/OWNERS b/vendor/k8s.io/client-go/transport/OWNERS new file mode 100644 index 00000000..34adee5e --- /dev/null +++ b/vendor/k8s.io/client-go/transport/OWNERS @@ -0,0 +1,8 @@ +# See the OWNERS docs at https://go.k8s.io/owners + +reviewers: + - smarterclayton + - wojtek-t + - deads2k + - liggitt + - caesarxuchao diff --git a/vendor/k8s.io/client-go/util/cert/OWNERS b/vendor/k8s.io/client-go/util/cert/OWNERS new file mode 100644 index 00000000..3c3b94c5 --- /dev/null +++ b/vendor/k8s.io/client-go/util/cert/OWNERS @@ -0,0 +1,8 @@ +# See the OWNERS docs at https://go.k8s.io/owners + +approvers: + - sig-auth-certificates-approvers +reviewers: + - sig-auth-certificates-reviewers +labels: + - sig/auth diff --git a/vendor/k8s.io/client-go/util/keyutil/OWNERS b/vendor/k8s.io/client-go/util/keyutil/OWNERS new file mode 100644 index 00000000..e6d229d5 --- /dev/null +++ b/vendor/k8s.io/client-go/util/keyutil/OWNERS @@ -0,0 +1,6 @@ +approvers: + - sig-auth-certificates-approvers +reviewers: + - sig-auth-certificates-reviewers +labels: + - sig/auth diff --git a/vendor/k8s.io/client-go/util/retry/OWNERS b/vendor/k8s.io/client-go/util/retry/OWNERS new file mode 100644 index 00000000..75736b5a --- /dev/null +++ b/vendor/k8s.io/client-go/util/retry/OWNERS @@ -0,0 +1,4 @@ +# See the OWNERS docs at https://go.k8s.io/owners + +reviewers: + - caesarxuchao diff --git a/vendor/k8s.io/code-generator/OWNERS b/vendor/k8s.io/code-generator/OWNERS new file mode 100644 index 00000000..05162820 --- /dev/null +++ b/vendor/k8s.io/code-generator/OWNERS @@ -0,0 +1,15 @@ +# See the OWNERS docs at https://go.k8s.io/owners + +approvers: + - deads2k + - lavalamp + - wojtek-t + - sttts +reviewers: + - deads2k + - lavalamp + - wojtek-t + - sttts +labels: + - sig/api-machinery + - area/code-generation diff --git a/vendor/k8s.io/code-generator/cmd/client-gen/OWNERS b/vendor/k8s.io/code-generator/cmd/client-gen/OWNERS new file mode 100644 index 00000000..0170a84e --- /dev/null +++ b/vendor/k8s.io/code-generator/cmd/client-gen/OWNERS @@ -0,0 +1,10 @@ +# See the OWNERS docs at https://go.k8s.io/owners + +approvers: + - lavalamp + - wojtek-t + - caesarxuchao +reviewers: + - lavalamp + - wojtek-t + - caesarxuchao diff --git a/vendor/k8s.io/code-generator/cmd/go-to-protobuf/OWNERS b/vendor/k8s.io/code-generator/cmd/go-to-protobuf/OWNERS new file mode 100644 index 00000000..af7e2ec4 --- /dev/null +++ b/vendor/k8s.io/code-generator/cmd/go-to-protobuf/OWNERS @@ -0,0 +1,6 @@ +# See the OWNERS docs at https://go.k8s.io/owners + +approvers: + - smarterclayton +reviewers: + - smarterclayton diff --git a/vendor/k8s.io/klog/OWNERS b/vendor/k8s.io/klog/OWNERS new file mode 100644 index 00000000..380e514f --- /dev/null +++ b/vendor/k8s.io/klog/OWNERS @@ -0,0 +1,19 @@ +# See the OWNERS docs at https://go.k8s.io/owners +reviewers: + - jayunit100 + - hoegaarden + - andyxning + - neolit123 + - pohly + - yagonobre + - vincepri + - detiber +approvers: + - dims + - thockin + - justinsb + - tallclair + - piosz + - brancz + - DirectXMan12 + - lavalamp diff --git a/vendor/k8s.io/klog/v2/OWNERS b/vendor/k8s.io/klog/v2/OWNERS new file mode 100644 index 00000000..a2fe8f35 --- /dev/null +++ b/vendor/k8s.io/klog/v2/OWNERS @@ -0,0 +1,14 @@ +# See the OWNERS docs at https://go.k8s.io/owners +reviewers: + - harshanarayana + - pohly +approvers: + - dims + - thockin + - serathius +emeritus_approvers: + - brancz + - justinsb + - lavalamp + - piosz + - tallclair diff --git a/vendor/k8s.io/kube-openapi/pkg/generators/rules/OWNERS b/vendor/k8s.io/kube-openapi/pkg/generators/rules/OWNERS new file mode 100644 index 00000000..235bc545 --- /dev/null +++ b/vendor/k8s.io/kube-openapi/pkg/generators/rules/OWNERS @@ -0,0 +1,4 @@ +reviewers: +- roycaihw +approvers: +- roycaihw diff --git a/vendor/k8s.io/kube-openapi/pkg/util/proto/OWNERS b/vendor/k8s.io/kube-openapi/pkg/util/proto/OWNERS new file mode 100644 index 00000000..9621a6a3 --- /dev/null +++ b/vendor/k8s.io/kube-openapi/pkg/util/proto/OWNERS @@ -0,0 +1,2 @@ +approvers: +- apelisse diff --git a/vendor/k8s.io/utils/pointer/OWNERS b/vendor/k8s.io/utils/pointer/OWNERS new file mode 100644 index 00000000..0d639275 --- /dev/null +++ b/vendor/k8s.io/utils/pointer/OWNERS @@ -0,0 +1,10 @@ +# See the OWNERS docs at https://go.k8s.io/owners + +approvers: +- apelisse +- stewart-yu +- thockin +reviewers: +- apelisse +- stewart-yu +- thockin diff --git a/vendor/knative.dev/eventing/hack/OWNERS b/vendor/knative.dev/eventing/hack/OWNERS new file mode 100644 index 00000000..65aa9e7b --- /dev/null +++ b/vendor/knative.dev/eventing/hack/OWNERS @@ -0,0 +1,10 @@ +# The OWNERS file is used by prow to automatically merge approved PRs. + +approvers: +- productivity-writers + +reviewers: +- productivity-reviewers + +labels: +- area/test-and-release diff --git a/vendor/knative.dev/hack/OWNERS b/vendor/knative.dev/hack/OWNERS new file mode 100644 index 00000000..4d20bf8c --- /dev/null +++ b/vendor/knative.dev/hack/OWNERS @@ -0,0 +1,8 @@ +approvers: + - technical-oversight-committee + - productivity-writers + - knative-release-leads + +reviewers: + - productivity-writers + - productivity-reviewers diff --git a/vendor/knative.dev/hack/OWNERS_ALIASES b/vendor/knative.dev/hack/OWNERS_ALIASES new file mode 100644 index 00000000..808fdf52 --- /dev/null +++ b/vendor/knative.dev/hack/OWNERS_ALIASES @@ -0,0 +1,183 @@ +# This file is auto-generated from peribolos. +# Do not modify this file, instead modify peribolos/knative.yaml + +aliases: + client-reviewers: + - itsmurugappan + client-wg-leads: + - dsimansk + - navidshaikh + - rhuss + client-writers: + - dsimansk + - maximilien + - navidshaikh + - rhuss + - vyasgun + conformance-task-force-leads: + - salaboy + conformance-writers: + - salaboy + docs-reviewers: + - nainaz + - nak3 + - pmbanugo + - retocode + - skonto + - snneji + docs-wg-leads: + - snneji + docs-writers: + - csantanapr + - nak3 + - retocode + - skonto + - snneji + eventing-reviewers: + - Leo6Leo + - aslom + - cali0707 + - creydr + eventing-triage: + - lberk + eventing-wg-leads: + - pierDipi + eventing-writers: + - aliok + - creydr + - lberk + - lionelvillard + - matzew + - odacremolbap + - pierDipi + func-reviewers: + - gauron99 + - jrangelramos + - nainaz + func-writers: + - jrangelramos + - lance + - lkingland + - matejvasek + - salaboy + functions-wg-leads: + - lkingland + - salaboy + knative-admin: + - Cali0707 + - ReToCode + - creydr + - csantanapr + - davidhadas + - dprotaso + - dsimansk + - knative-automation + - knative-prow-releaser-robot + - knative-prow-robot + - knative-prow-updater-robot + - knative-test-reporter-robot + - kvmware + - lance + - mchmarny + - nainaz + - pierDipi + - psschwei + - puerco + - salaboy + - skonto + - smoser-ibm + - upodroid + - xtreme-sameer-vohra + knative-release-leads: + - Cali0707 + - ReToCode + - creydr + - dsimansk + - pierDipi + - skonto + knative-robots: + - knative-automation + - knative-prow-releaser-robot + - knative-prow-robot + - knative-prow-updater-robot + - knative-test-reporter-robot + operations-reviewers: + - aliok + - houshengbo + - matzew + - maximilien + operations-wg-leads: + - houshengbo + operations-writers: + - aliok + - houshengbo + - matzew + - maximilien + productivity-leads: + - kvmware + - upodroid + productivity-reviewers: + - evankanderson + - mgencur + productivity-wg-leads: + - kvmware + - upodroid + productivity-writers: + - cardil + - kvmware + - upodroid + security-wg-leads: + - davidhadas + - evankanderson + security-writers: + - davidhadas + - evankanderson + serving-approvers: + - nak3 + - psschwei + - skonto + serving-reviewers: + - KauzClay + - jsanin-vmw + - kauana + - kvmware + - retocode + - skonto + - xtreme-vikram-yadav + serving-triage: + - KauzClay + - retocode + - skonto + serving-wg-leads: + - dprotaso + serving-writers: + - dprotaso + - nak3 + - psschwei + - skonto + steering-committee: + - csantanapr + - lance + - nainaz + - puerco + - salaboy + technical-oversight-committee: + - davidhadas + - dprotaso + - dsimansk + - kvmware + - psschwei + trademark-committee: + - mchmarny + - smoser-ibm + - xtreme-sameer-vohra + ux-wg-leads: + - cali0707 + - leo6leo + - mmejia02 + - zainabhusain227 + ux-writers: + - cali0707 + - leo6leo + - mmejia02 + - zainabhusain227 diff --git a/vendor/knative.dev/pkg/apis/OWNERS b/vendor/knative.dev/pkg/apis/OWNERS new file mode 100644 index 00000000..13014203 --- /dev/null +++ b/vendor/knative.dev/pkg/apis/OWNERS @@ -0,0 +1,15 @@ +# The OWNERS file is used by prow to automatically merge approved PRs. + +approvers: +- technical-oversight-committee +- serving-wg-leads +- eventing-wg-leads + +reviewers: +- serving-writers +- eventing-writers +- eventing-reviewers +- serving-reviewers + +options: + no_parent_owners: true diff --git a/vendor/knative.dev/pkg/apis/duck/OWNERS b/vendor/knative.dev/pkg/apis/duck/OWNERS new file mode 100644 index 00000000..af1eb05d --- /dev/null +++ b/vendor/knative.dev/pkg/apis/duck/OWNERS @@ -0,0 +1,8 @@ +# The OWNERS file is used by prow to automatically merge approved PRs. + +approvers: +- eventing-wg-leads + +reviewers: +- eventing-reviewers +- eventing-writers diff --git a/vendor/knative.dev/pkg/controller/OWNERS b/vendor/knative.dev/pkg/controller/OWNERS new file mode 100644 index 00000000..64660c9e --- /dev/null +++ b/vendor/knative.dev/pkg/controller/OWNERS @@ -0,0 +1,7 @@ +# The OWNERS file is used by prow to automatically merge approved PRs. + +approvers: +- serving-writers + +reviewers: +- serving-reviewers diff --git a/vendor/knative.dev/pkg/hack/OWNERS b/vendor/knative.dev/pkg/hack/OWNERS new file mode 100644 index 00000000..65aa9e7b --- /dev/null +++ b/vendor/knative.dev/pkg/hack/OWNERS @@ -0,0 +1,10 @@ +# The OWNERS file is used by prow to automatically merge approved PRs. + +approvers: +- productivity-writers + +reviewers: +- productivity-reviewers + +labels: +- area/test-and-release diff --git a/vendor/knative.dev/pkg/reconciler/OWNERS b/vendor/knative.dev/pkg/reconciler/OWNERS new file mode 100644 index 00000000..136197a3 --- /dev/null +++ b/vendor/knative.dev/pkg/reconciler/OWNERS @@ -0,0 +1,7 @@ +# The OWNERS file is used by prow to automatically merge approved PRs. + +approvers: +- serving-writers + +reviewers: +- serving-writers diff --git a/vendor/knative.dev/pkg/resolver/OWNERS b/vendor/knative.dev/pkg/resolver/OWNERS new file mode 100644 index 00000000..b5e9581f --- /dev/null +++ b/vendor/knative.dev/pkg/resolver/OWNERS @@ -0,0 +1,8 @@ +# The OWNERS file is used by prow to automatically merge approved PRs. + +approvers: +- eventing-writers + +reviewers: +- eventing-reviewers + diff --git a/vendor/knative.dev/reconciler-test/pkg/eventshub/assert/doc.go b/vendor/knative.dev/reconciler-test/pkg/eventshub/assert/doc.go new file mode 100644 index 00000000..1f285282 --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/eventshub/assert/doc.go @@ -0,0 +1,20 @@ +/* +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 + + https://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. +*/ + +/* +assert contains the necessary matchers and steps to perform assertions on eventshub contents +*/ +package assert diff --git a/vendor/knative.dev/reconciler-test/pkg/eventshub/assert/event_info_matchers.go b/vendor/knative.dev/reconciler-test/pkg/eventshub/assert/event_info_matchers.go new file mode 100644 index 00000000..be484d1f --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/eventshub/assert/event_info_matchers.go @@ -0,0 +1,133 @@ +/* +Copyright 2020 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 + + https://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 assert + +import ( + "fmt" + "strings" + + cloudevents "github.com/cloudevents/sdk-go/v2" + cetest "github.com/cloudevents/sdk-go/v2/test" + + "knative.dev/reconciler-test/pkg/eventshub" +) + +// Matcher that never fails +func Any() eventshub.EventInfoMatcher { + return func(ei eventshub.EventInfo) error { + return nil + } +} + +// Matcher that fails if there is an error in the EventInfo +func NoError() eventshub.EventInfoMatcher { + return func(ei eventshub.EventInfo) error { + if ei.Error != "" { + return fmt.Errorf("not expecting an error in event info: %s", ei.Error) + } + return nil + } +} + +// Convert a matcher that checks valid messages to a function +// that checks EventInfo structures, returning an error for any that don't +// contain valid events. +func MatchEvent(evf ...cetest.EventMatcher) eventshub.EventInfoMatcher { + return func(ei eventshub.EventInfo) error { + if ei.Event == nil { + return fmt.Errorf("Saw nil event") + } else { + return cetest.AllOf(evf...)(*ei.Event) + } + } +} + +// Convert a matcher that checks valid messages to a function +// that checks EventInfo structures, returning an error for any that don't +// contain valid events. +func HasAdditionalHeader(key, value string) eventshub.EventInfoMatcher { + key = strings.ToLower(key) + return func(ei eventshub.EventInfo) error { + for k, v := range ei.HTTPHeaders { + if strings.ToLower(k) == key && v[0] == value { + return nil + } + } + return fmt.Errorf("cannot find header '%s' = '%s' between the headers", key, value) + } +} + +// Reexport kinds here to simplify the usage +const ( + EventReceived = eventshub.EventReceived + EventRejected = eventshub.EventRejected + + EventSent = eventshub.EventSent + EventResponse = eventshub.EventResponse +) + +// MatchKind matches the kind of EventInfo +func MatchKind(kind eventshub.EventKind) eventshub.EventInfoMatcher { + return func(info eventshub.EventInfo) error { + if kind != info.Kind { + return fmt.Errorf("event kind don't match. Expected: '%s', Actual: '%s'", kind, info.Kind) + } + return nil + } +} + +func OneOf(matchers ...eventshub.EventInfoMatcher) eventshub.EventInfoMatcher { + return func(info eventshub.EventInfo) error { + var lastErr error + for _, m := range matchers { + err := m(info) + if err == nil { + return nil + } + lastErr = err + } + return lastErr + } +} + +// MatchStatusCode matches the status code of EventInfo +func MatchStatusCode(statusCode int) eventshub.EventInfoMatcher { + return func(info eventshub.EventInfo) error { + if info.StatusCode != statusCode { + return fmt.Errorf("event status code don't match. Expected: '%d', Actual: '%d'", statusCode, info.StatusCode) + } + return nil + } +} + +// MatchHeartBeatsImageMessage matches that the data field of the event, in the format of the heartbeats image, contains the following msg field +func MatchHeartBeatsImageMessage(expectedMsg string) cetest.EventMatcher { + return cetest.AllOf( + cetest.HasDataContentType(cloudevents.ApplicationJSON), + func(have cloudevents.Event) error { + var m map[string]interface{} + err := have.DataAs(&m) + if err != nil { + return fmt.Errorf("cannot parse heartbeats message %s", err.Error()) + } + if m["msg"].(string) != expectedMsg { + return fmt.Errorf("heartbeats message don't match. Expected: '%s', Actual: '%s'", expectedMsg, m["msg"].(string)) + } + return nil + }, + ) +} diff --git a/vendor/knative.dev/reconciler-test/pkg/eventshub/assert/step.go b/vendor/knative.dev/reconciler-test/pkg/eventshub/assert/step.go new file mode 100644 index 00000000..2bbff311 --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/eventshub/assert/step.go @@ -0,0 +1,156 @@ +package assert + +import ( + "context" + "encoding/json" + "fmt" + + cetest "github.com/cloudevents/sdk-go/v2/test" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + kubeclient "knative.dev/pkg/client/injection/kube/client" + + "knative.dev/reconciler-test/pkg/eventshub" + "knative.dev/reconciler-test/pkg/feature" +) + +type MatchAssertionBuilder struct { + storeName string + matchers []eventshub.EventInfoMatcherCtx +} + +// OnStore creates an assertion builder starting from the name of the store +func OnStore(name string) MatchAssertionBuilder { + return MatchAssertionBuilder{ + storeName: name, + matchers: nil, + } +} + +// Match adds the provided matchers in this builder +func (m MatchAssertionBuilder) Match(matchers ...eventshub.EventInfoMatcher) MatchAssertionBuilder { + for _, matcher := range matchers { + m.matchers = append(m.matchers, matcher.WithContext()) + } + return m +} + +// MatchWithContext adds the provided matchers in this builder +func (m MatchAssertionBuilder) MatchWithContext(matchers ...eventshub.EventInfoMatcherCtx) MatchAssertionBuilder { + m.matchers = append(m.matchers, matchers...) + return m +} + +// MatchPeerCertificates adds the provided matchers in this builder +func (m MatchAssertionBuilder) MatchPeerCertificatesReceived(matchers ...eventshub.EventInfoMatcherCtx) MatchAssertionBuilder { + m.matchers = append(m.matchers, MatchKind(eventshub.PeerCertificatesReceived).WithContext()) + m.matchers = append(m.matchers, matchers...) + return m +} + +// MatchReceivedEvent is a shortcut for Match(MatchKind(eventshub.EventReceived), MatchEvent(matchers...)) +func (m MatchAssertionBuilder) MatchReceivedEvent(matchers ...cetest.EventMatcher) MatchAssertionBuilder { + m.matchers = append(m.matchers, MatchKind(eventshub.EventReceived).WithContext()) + m.matchers = append(m.matchers, MatchEvent(matchers...).WithContext()) + return m +} + +// MatchRejectedEvent is a shortcut for Match(MatchKind(eventshub.EventRejected), MatchEvent(matchers...)) +func (m MatchAssertionBuilder) MatchRejectedEvent(matchers ...cetest.EventMatcher) MatchAssertionBuilder { + m.matchers = append(m.matchers, MatchKind(eventshub.EventRejected).WithContext()) + m.matchers = append(m.matchers, MatchEvent(matchers...).WithContext()) + return m +} + +// MatchSentEvent is a shortcut for Match(MatchKind(eventshub.EventSent), MatchEvent(matchers...)) +func (m MatchAssertionBuilder) MatchSentEvent(matchers ...cetest.EventMatcher) MatchAssertionBuilder { + m.matchers = append(m.matchers, MatchKind(eventshub.EventSent).WithContext()) + m.matchers = append(m.matchers, MatchEvent(matchers...).WithContext()) + return m +} + +// MatchResponseEvent is a shortcut for Match(MatchKind(eventshub.EventResponse), MatchEvent(matchers...)) +func (m MatchAssertionBuilder) MatchResponseEvent(matchers ...cetest.EventMatcher) MatchAssertionBuilder { + m.matchers = append(m.matchers, MatchKind(eventshub.EventResponse).WithContext()) + m.matchers = append(m.matchers, MatchEvent(matchers...).WithContext()) + return m +} + +// MatchEvent is a shortcut for Match(MatchEvent(), OneOf(MatchKind(eventshub.EventReceived), MatchKind(eventshub.EventSent))) +func (m MatchAssertionBuilder) MatchEvent(matchers ...cetest.EventMatcher) MatchAssertionBuilder { + m.matchers = append(m.matchers, OneOf( + MatchKind(eventshub.EventReceived), + MatchKind(eventshub.EventSent), + ).WithContext()) + m.matchers = append(m.matchers, MatchEvent(matchers...).WithContext()) + return m +} + +// AtLeast builds the assertion feature.StepFn +// OnStore(store).Match(matchers).AtLeast(min) is equivalent to StoreFromContext(ctx, store).AssertAtLeast(min, matchers) +func (m MatchAssertionBuilder) AtLeast(min int) feature.StepFn { + return func(ctx context.Context, t feature.T) { + eventshub.StoreFromContext(ctx, m.storeName).AssertAtLeast(ctx, t, min, toFixedContextMatchers(ctx, m.matchers)...) + } +} + +// InRange builds the assertion feature.StepFn +// OnStore(store).Match(matchers).InRange(min, max) is equivalent to StoreFromContext(ctx, store).AssertInRange(min, max, matchers) +func (m MatchAssertionBuilder) InRange(min int, max int) feature.StepFn { + return func(ctx context.Context, t feature.T) { + eventshub.StoreFromContext(ctx, m.storeName).AssertInRange(ctx, t, min, max, toFixedContextMatchers(ctx, m.matchers)...) + } +} + +// Exact builds the assertion feature.StepFn +// OnStore(store).Match(matchers).Exact(n) is equivalent to StoreFromContext(ctx, store).AssertExact(n, matchers) +func (m MatchAssertionBuilder) Exact(n int) feature.StepFn { + return func(ctx context.Context, t feature.T) { + eventshub.StoreFromContext(ctx, m.storeName).AssertExact(ctx, t, n, toFixedContextMatchers(ctx, m.matchers)...) + } +} + +// Not builds the assertion feature.StepFn +// OnStore(store).Match(matchers).Not() is equivalent to StoreFromContext(ctx, store).AssertNot(matchers) +func (m MatchAssertionBuilder) Not() feature.StepFn { + return func(ctx context.Context, t feature.T) { + eventshub.StoreFromContext(ctx, m.storeName).AssertNot(t, toFixedContextMatchers(ctx, m.matchers)...) + } +} + +func toFixedContextMatchers(ctx context.Context, matchers []eventshub.EventInfoMatcherCtx) []eventshub.EventInfoMatcher { + out := make([]eventshub.EventInfoMatcher, 0, len(matchers)) + for _, matcher := range matchers { + out = append(out, matcher.WithContext(ctx)) + } + return out +} + +func MatchPeerCertificatesFromSecret(namespace, name string, key string) eventshub.EventInfoMatcherCtx { + return func(ctx context.Context, info eventshub.EventInfo) error { + secret, err := kubeclient.Get(ctx).CoreV1(). + Secrets(namespace). + Get(ctx, name, metav1.GetOptions{}) + + if err != nil { + return fmt.Errorf("failed to get secret: %w", err) + } + + value, ok := secret.Data[key] + if !ok { + return fmt.Errorf("failed to get value from secret %s/%s for key %s", secret.Namespace, secret.Name, key) + } + + if info.Connection == nil || info.Connection.TLS == nil { + return fmt.Errorf("failed to match peer certificates, connection is not TLS") + } + + for _, cert := range info.Connection.TLS.PemPeerCertificates { + if cert == string(value) { + return nil + } + } + + bytes, _ := json.MarshalIndent(info.Connection.TLS.PemPeerCertificates, "", " ") + return fmt.Errorf("failed to find peer certificate with value\n%s\nin:\n%s", string(value), string(bytes)) + } +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 6695f562..59b036b6 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1122,6 +1122,7 @@ knative.dev/pkg/tracker knative.dev/reconciler-test/cmd/eventshub knative.dev/reconciler-test/pkg/environment knative.dev/reconciler-test/pkg/eventshub +knative.dev/reconciler-test/pkg/eventshub/assert knative.dev/reconciler-test/pkg/eventshub/dropevents knative.dev/reconciler-test/pkg/eventshub/dropevents/dropeventsfibonacci knative.dev/reconciler-test/pkg/eventshub/dropevents/dropeventsfirst diff --git a/vendor/sigs.k8s.io/json/OWNERS b/vendor/sigs.k8s.io/json/OWNERS new file mode 100644 index 00000000..0fadafbd --- /dev/null +++ b/vendor/sigs.k8s.io/json/OWNERS @@ -0,0 +1,6 @@ +# See the OWNERS docs at https://go.k8s.io/owners + +approvers: + - deads2k + - lavalamp + - liggitt diff --git a/vendor/sigs.k8s.io/yaml/OWNERS b/vendor/sigs.k8s.io/yaml/OWNERS new file mode 100644 index 00000000..003a149e --- /dev/null +++ b/vendor/sigs.k8s.io/yaml/OWNERS @@ -0,0 +1,23 @@ +# See the OWNERS docs at https://go.k8s.io/owners + +approvers: +- dims +- jpbetz +- smarterclayton +- deads2k +- sttts +- liggitt +reviewers: +- dims +- thockin +- jpbetz +- smarterclayton +- wojtek-t +- deads2k +- derekwaynecarr +- mikedanese +- liggitt +- sttts +- tallclair +labels: +- sig/api-machinery diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/OWNERS b/vendor/sigs.k8s.io/yaml/goyaml.v2/OWNERS new file mode 100644 index 00000000..73be0a3a --- /dev/null +++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/OWNERS @@ -0,0 +1,24 @@ +# See the OWNERS docs at https://go.k8s.io/owners + +approvers: +- dims +- jpbetz +- smarterclayton +- deads2k +- sttts +- liggitt +- natasha41575 +- knverey +reviewers: +- dims +- thockin +- jpbetz +- smarterclayton +- deads2k +- derekwaynecarr +- mikedanese +- liggitt +- sttts +- tallclair +labels: +- sig/api-machinery From 33d2c80f2bbfe99b3caf90e38efb3ea858fb3839 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Cihan=20Karag=C3=BCc=C3=BCk?= Date: Tue, 23 Jul 2024 16:25:14 +0300 Subject: [PATCH 2/3] integration test package is changed --- .../reconciler/eventmesh => tests/e2e}/integration_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) rename backends/{pkg/reconciler/eventmesh => tests/e2e}/integration_test.go (97%) diff --git a/backends/pkg/reconciler/eventmesh/integration_test.go b/backends/tests/e2e/integration_test.go similarity index 97% rename from backends/pkg/reconciler/eventmesh/integration_test.go rename to backends/tests/e2e/integration_test.go index 054ae796..783e0d04 100644 --- a/backends/pkg/reconciler/eventmesh/integration_test.go +++ b/backends/tests/e2e/integration_test.go @@ -1,4 +1,7 @@ -package eventmesh +//go:build e2e +// +build e2e + +package e2e import ( "context" From d80434f80cf2b44e223b26d1578eeb639e2e2aee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Cihan=20Karag=C3=BCc=C3=BCk?= Date: Tue, 23 Jul 2024 17:28:03 +0300 Subject: [PATCH 3/3] testmain added --- backends/tests/e2e/integration_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/backends/tests/e2e/integration_test.go b/backends/tests/e2e/integration_test.go index 783e0d04..9ca9964e 100644 --- a/backends/tests/e2e/integration_test.go +++ b/backends/tests/e2e/integration_test.go @@ -5,6 +5,7 @@ package e2e import ( "context" + "os" "testing" authenticationv1 "k8s.io/api/authentication/v1" @@ -18,6 +19,13 @@ import ( var global environment.GlobalEnvironment +func TestMain(m *testing.M) { + global = environment.NewStandardGlobalEnvironment() + + // Run the tests. + os.Exit(m.Run()) +} + func TestIntegration(t *testing.T) { t.Parallel()