Skip to content

Commit

Permalink
Merge branch 'knative:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
yijie-04 authored Jan 13, 2024
2 parents b69cc29 + c7520cc commit 51befc7
Show file tree
Hide file tree
Showing 14 changed files with 182 additions and 59 deletions.
28 changes: 28 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,34 @@ to explicitly enable it.
ko apply -f test/config/sugar.yaml
```

## Running a Single Rekt Test with e2e-debug.sh

To run a single rekt test using the `e2e-debug.sh` script, follow these instructions:

1. Navigate to the project root directory.

2. Execute the following command in your terminal:

```bash
./hack/e2e-debug.sh <test_name> <test_dir>
```

Replace `<test_name>` with the name of the rekt test you want to run, and `<test_dir>` with the directory containing the test file.

**Example:**

```bash
./hack/e2e-debug.sh TestMyRektScenario test/rekt/scenarios
```

This will run the specified rekt test (`TestMyRektScenario` in this case) from the provided directory (`test/rekt/scenarios`).

**Note:** Ensure that you have the necessary dependencies and configurations set up before running the test.

3. The script will wait for Knative Eventing components to come up and then execute the specified test. If any failures occur during the test, relevant error messages will be displayed in the terminal.

**Important:** Make sure to provide a valid test name and test directory. The `<test_name>` parameter technically accepts a regex pattern, but in most cases, you can use the name of the test you want to run. If you wish, you can explore advanced use cases with regex patterns for more granular test selection.

## Iterating

As you make changes to the code-base, there are two special cases to be aware
Expand Down
2 changes: 0 additions & 2 deletions OWNERS_ALIASES
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,9 @@ aliases:
serving-reviewers:
- KauzClay
- jsanin-vmw
- kauana
- krsna-m
- retocode
- skonto
- xtreme-vikram-yadav
serving-triage:
- KauzClay
- retocode
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ require (
github.com/cloudevents/sdk-go/observability/opencensus/v2 v2.13.0
github.com/cloudevents/sdk-go/sql/v2 v2.13.0
github.com/cloudevents/sdk-go/v2 v2.13.0
github.com/coreos/go-oidc/v3 v3.6.0
github.com/go-jose/go-jose/v3 v3.0.0
github.com/coreos/go-oidc/v3 v3.9.0
github.com/go-jose/go-jose/v3 v3.0.1
github.com/golang/protobuf v1.5.3
github.com/google/go-cmp v0.6.0
github.com/google/gofuzz v1.2.0
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGX
github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4 h1:/inchEIKaYC1Akx+H+gqO04wryn5h75LSazbRlnya1k=
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk=
github.com/coreos/go-oidc/v3 v3.6.0 h1:AKVxfYw1Gmkn/w96z0DbT/B/xFnzTd3MkZvWLjF4n/o=
github.com/coreos/go-oidc/v3 v3.6.0/go.mod h1:ZpHUsHBucTUj6WOkrP4E20UPynbLZzhTQ1XKCXkxyPc=
github.com/coreos/go-oidc/v3 v3.9.0 h1:0J/ogVOd4y8P0f0xUh8l9t07xRP/d8tccvjHl2dcsSo=
github.com/coreos/go-oidc/v3 v3.9.0/go.mod h1:rTKz2PYwftcrtoCzV5g5kvfJoWcm0Mk8AF8y1iAQro4=
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
Expand Down Expand Up @@ -127,8 +127,8 @@ github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeME
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-jose/go-jose/v3 v3.0.0 h1:s6rrhirfEP/CGIoc6p+PZAeogN2SxKav6Wp7+dyMWVo=
github.com/go-jose/go-jose/v3 v3.0.0/go.mod h1:RNkWWRld676jZEYoV3+XK8L2ZnNSvIsxFMht0mSX+u8=
github.com/go-jose/go-jose/v3 v3.0.1 h1:pWmKFVtt+Jl0vBZTIpz/eAKwsm6LkIxDVVbFHKkchhA=
github.com/go-jose/go-jose/v3 v3.0.1/go.mod h1:RNkWWRld676jZEYoV3+XK8L2ZnNSvIsxFMht0mSX+u8=
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY=
Expand Down
9 changes: 8 additions & 1 deletion hack/update-cert-manager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@ function update_cert_manager() {
mkdir -p third_party/cert-manager

helm repo add jetstack https://charts.jetstack.io --force-update
kubectl create namespace --dry-run=client cert-manager -oyaml > third_party/cert-manager/00-namespace.yaml

cat > third_party/cert-manager/00-namespace.yaml <<EOF
apiVersion: v1
kind: Namespace
metadata:
name: cert-manager
EOF

helm template -n cert-manager cert-manager jetstack/cert-manager --create-namespace --version "${cert_manager_version}" --set installCRDs=true > third_party/cert-manager/01-cert-manager.yaml
helm template -n cert-manager cert-manager jetstack/trust-manager --create-namespace --version "${trust_manager_version}" --set installCRDs=true > third_party/cert-manager/02-trust-manager.yaml
}
Expand Down
86 changes: 79 additions & 7 deletions test/rekt/features/new_trigger_filters/feature.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,15 @@ type CloudEventsContext struct {
// broker implementations for testing.
func NewFiltersFeatureSet(installBroker InstallBrokerFunc) *feature.FeatureSet {
features := SingleDialectFilterFeatures(installBroker)
features = append(features, AllFilterFeature(installBroker), AnyFilterFeature(installBroker), MultipleTriggersAndSinksFeature(installBroker), MissingAttributesFeature(installBroker))
features = append(
features,
AllFilterFeature(installBroker),
AnyFilterFeature(installBroker),
MultipleTriggersAndSinksFeature(installBroker),
MissingAttributesFeature(installBroker),
FilterAttributeWithEmptyFiltersFeature(installBroker),
FiltersOverrideAttributeFilterFeature(installBroker),
)
return &feature.FeatureSet{
Name: "New Trigger Filters",
Features: features,
Expand Down Expand Up @@ -117,7 +125,7 @@ func SingleDialectFilterFeatures(installBroker InstallBrokerFunc) []*feature.Fea

for name, fs := range tests {
f := feature.NewFeatureNamed(name)
createNewFiltersFeature(f, eventContexts, fs.filters, installBroker)
createNewFiltersFeature(f, eventContexts, fs.filters, eventingv1.TriggerFilter{}, installBroker)
features = append(features, f)
}

Expand Down Expand Up @@ -184,7 +192,7 @@ func AnyFilterFeature(installBroker InstallBrokerFunc) *feature.Feature {
},
}

createNewFiltersFeature(f, eventContexts, filters, installBroker)
createNewFiltersFeature(f, eventContexts, filters, eventingv1.TriggerFilter{}, installBroker)

return f
}
Expand Down Expand Up @@ -240,7 +248,7 @@ func AllFilterFeature(installBroker InstallBrokerFunc) *feature.Feature {
},
}

createNewFiltersFeature(f, eventContexts, filters, installBroker)
createNewFiltersFeature(f, eventContexts, filters, eventingv1.TriggerFilter{}, installBroker)

return f
}
Expand Down Expand Up @@ -326,8 +334,8 @@ func MultipleTriggersAndSinksFeature(installBroker InstallBrokerFunc) *feature.F
return brokerName
}

createNewFiltersFeature(f, eventContextsFirstSink, filtersFirstTrigger, fakeInstallBroker)
createNewFiltersFeature(f, eventContextsSecondSink, filtersSecondTrigger, fakeInstallBroker)
createNewFiltersFeature(f, eventContextsFirstSink, filtersFirstTrigger, eventingv1.TriggerFilter{}, fakeInstallBroker)
createNewFiltersFeature(f, eventContextsSecondSink, filtersSecondTrigger, eventingv1.TriggerFilter{}, fakeInstallBroker)

return f
}
Expand Down Expand Up @@ -374,7 +382,71 @@ func MissingAttributesFeature(installBroker InstallBrokerFunc) *feature.Feature
},
}

createNewFiltersFeature(f, eventContexts, filters, installBroker)
createNewFiltersFeature(f, eventContexts, filters, eventingv1.TriggerFilter{}, installBroker)

return f
}

// Empty SubscriptionAPI Filters do not override Filter Attributes
func FilterAttributeWithEmptyFiltersFeature(installBroker InstallBrokerFunc) *feature.Feature {
f := feature.NewFeature()

eventContexts := []CloudEventsContext{
// This event matches the filter attribute
{
eventType: "filter.attribute.event.type",
shouldDeliver: true,
},
// This event matches no filter attribute
{
eventType: "some.other.type",
shouldDeliver: false,
},
}

filter := eventingv1.TriggerFilter{
Attributes: map[string]string{
"type": "filter.attribute.event.type",
},
}

createNewFiltersFeature(f, eventContexts, []eventingv1.SubscriptionsAPIFilter{}, filter, installBroker)

return f
}

// SubscriptionAPI filters override filter attributes
func FiltersOverrideAttributeFilterFeature(installBroker InstallBrokerFunc) *feature.Feature {
f := feature.NewFeature()

eventContexts := []CloudEventsContext{
// This event matches the filters in subscriptionAPI and does not match filter attribute.
{
eventType: "subscriptionapi.filters.override.event.type",
shouldDeliver: true,
},
// This event matches the filter attribute and does not match filters in subscriptionAPI.
{
eventType: "filter.check.event.type",
shouldDeliver: false,
},
}

filters := []eventingv1.SubscriptionsAPIFilter{
{
Exact: map[string]string{
"type": "subscriptionapi.filters.override.event.type",
},
},
}

filter := eventingv1.TriggerFilter{
Attributes: map[string]string{
"type": "filter.check.event.type",
},
}

createNewFiltersFeature(f, eventContexts, filters, filter, installBroker)

return f
}
3 changes: 2 additions & 1 deletion test/rekt/features/new_trigger_filters/filters.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
"knative.dev/eventing/test/rekt/resources/trigger"
)

func createNewFiltersFeature(f *feature.Feature, eventContexts []CloudEventsContext, filters []eventingv1.SubscriptionsAPIFilter, installBroker InstallBrokerFunc) {
func createNewFiltersFeature(f *feature.Feature, eventContexts []CloudEventsContext, filters []eventingv1.SubscriptionsAPIFilter, filter eventingv1.TriggerFilter, installBroker InstallBrokerFunc) {
subscriberName := feature.MakeRandomK8sName("subscriber")
triggerName := feature.MakeRandomK8sName("trigger")
brokerName := installBroker(f)
Expand All @@ -42,6 +42,7 @@ func createNewFiltersFeature(f *feature.Feature, eventContexts []CloudEventsCont
cfg := []manifest.CfgFn{
trigger.WithSubscriber(service.AsKReference(subscriberName), ""),
trigger.WithNewFilters(filters),
trigger.WithFilter(filter.Attributes),
}

f.Setup("Install trigger", trigger.Install(triggerName, brokerName, cfg...))
Expand Down
3 changes: 0 additions & 3 deletions third_party/cert-manager/00-namespace.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
creationTimestamp: null
name: cert-manager
spec: {}
status: {}
8 changes: 4 additions & 4 deletions vendor/github.com/coreos/go-oidc/v3/oidc/jwks.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 51befc7

Please sign in to comment.