Skip to content

Commit

Permalink
upgrade to latest dependencies (#268)
Browse files Browse the repository at this point in the history
bumping knative.dev/eventing dca8b0a...8f35d42:
  > 8f35d42 last control plane test for channel (# 5182)
  > 2d4951e redo smoketests, move one broker test (# 5187)
  > 5aacf4f Channel Data Plane Conformance Template (# 5183)
  > 6c632d1 add post 022 job to remove pingsource finalizer (# 5008)
  > ae36e5b upgrade to latest dependencies (# 5156)
  > ab0b9b0 Update common github actions (# 5186)

Signed-off-by: Knative Automation <[email protected]>
  • Loading branch information
knative-automation authored Apr 6, 2021
1 parent ca7bfc5 commit 523393f
Show file tree
Hide file tree
Showing 11 changed files with 233 additions and 128 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ require (
k8s.io/client-go v0.20.5
k8s.io/code-generator v0.20.5
k8s.io/kube-openapi v0.0.0-20201113171705-d219536bb9fd
knative.dev/eventing v0.21.1-0.20210330142021-dca8b0acf039
knative.dev/eventing v0.22.0
knative.dev/hack v0.0.0-20210325223819-b6ab329907d3
knative.dev/pkg v0.0.0-20210331065221-952fdd90dbb0
knative.dev/reconciler-test v0.0.0-20210331073522-b09f3669345a
Expand Down
9 changes: 4 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1435,17 +1435,16 @@ k8s.io/utils v0.0.0-20200729134348-d5654de09c73/go.mod h1:jPW/WVKK9YHAvNhRxK0md/
k8s.io/utils v0.0.0-20201110183641-67b214c5f920/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
k8s.io/utils v0.0.0-20210111153108-fddb29f9d009 h1:0T5IaWHO3sJTEmCP6mUlBvMukxPKUQWqiI/YuiBNMiQ=
k8s.io/utils v0.0.0-20210111153108-fddb29f9d009/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
knative.dev/eventing v0.21.1-0.20210330142021-dca8b0acf039 h1:skDjBvseFTDncrI6ZF5Vxu9dP9innYrZictqXgqtsaU=
knative.dev/eventing v0.21.1-0.20210330142021-dca8b0acf039/go.mod h1:UE4xmtZ/fZWmbFOLL9u1WuBxxnTm9GmGQceuKram4Kg=
knative.dev/hack v0.0.0-20210317214554-58edbdc42966/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
knative.dev/eventing v0.22.0 h1:esDaddfSmiVhLKDnUCVVunSdNeHklVEz0fsqs3NupuQ=
knative.dev/eventing v0.22.0/go.mod h1:LOG7bh0eZQkbYANcnORwke6Yy6aUu62o8GeByaOFfRQ=
knative.dev/hack v0.0.0-20210325223819-b6ab329907d3 h1:km0Rrh0T9/wA2pivQm1hqSPVwgNgGCHC2WNn3GakZmE=
knative.dev/hack v0.0.0-20210325223819-b6ab329907d3/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
knative.dev/hack/schema v0.0.0-20210325223819-b6ab329907d3/go.mod h1:ffjwmdcrH5vN3mPhO8RrF2KfNnbHeCE2C60A+2cv3U0=
knative.dev/pkg v0.0.0-20210318052054-dfeeb1817679/go.mod h1:o1aTlbc+h60DP9P6nd/WmP99Ny9Ls3U/JIjL4xMgqpw=
knative.dev/pkg v0.0.0-20210329065222-9d92ea16c0d3/go.mod h1:PD5g8hUCXq6iR3tILjmZeJBvQfXGnHMPKryq54qHJhg=
knative.dev/pkg v0.0.0-20210331062321-6317ec6066f4/go.mod h1:PD5g8hUCXq6iR3tILjmZeJBvQfXGnHMPKryq54qHJhg=
knative.dev/pkg v0.0.0-20210331065221-952fdd90dbb0 h1:z05hcB4br0qz7JdwIoUSTXLTF+7ThuJ+R6NFfXd1Y4Q=
knative.dev/pkg v0.0.0-20210331065221-952fdd90dbb0/go.mod h1:PD5g8hUCXq6iR3tILjmZeJBvQfXGnHMPKryq54qHJhg=
knative.dev/reconciler-test v0.0.0-20210329193624-ea6f47034b61/go.mod h1:QSd2hWDDwFh+9AHOkiECsj2ZY2DGJBKnj6aT6LITBuw=
knative.dev/reconciler-test v0.0.0-20210329214021-2a67496462a4/go.mod h1:qLfJMHc0i9ENTSet/SUp/FcQm4QVfNTX8ZC//aVQN0M=
knative.dev/reconciler-test v0.0.0-20210331073522-b09f3669345a h1:lT3F7ppaQfBxvJvD++B1s6nGk3x/scYN404+qPLMKm4=
knative.dev/reconciler-test v0.0.0-20210331073522-b09f3669345a/go.mod h1:/+nBvBQ+/CJxGjpPzgKPLQc0feF9dzhcVFfhcTDtNyo=
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func ControlPlaneBroker(brokerName string) *feature.Feature {

f.Stable("Conformance").
Should("Broker objects SHOULD include a Ready condition in their status",
knconf.KResourceHasReadyInConditions(brokerresources.Gvr(), brokerName)).
knconf.KResourceHasReadyInConditions(brokerresources.GVR(), brokerName)).
Should("The Broker SHOULD indicate Ready=True when its ingress is available to receive events.",
readyBrokerHasIngressAvailable).
Should("While a Broker is Ready, it SHOULD be a valid Addressable and its `status.address.url` field SHOULD indicate the address of its ingress.",
Expand Down
108 changes: 20 additions & 88 deletions vendor/knative.dev/eventing/test/rekt/features/broker/data_plane.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,13 @@ package broker

import (
"context"
"errors"

"github.com/google/uuid"

. "github.com/cloudevents/sdk-go/v2/test"
"knative.dev/eventing/test/rekt/features/knconf"
"knative.dev/eventing/test/rekt/resources/broker"
"knative.dev/reconciler-test/pkg/eventshub"
"knative.dev/reconciler-test/pkg/feature"
"knative.dev/reconciler-test/pkg/state"
eventshubmain "knative.dev/reconciler-test/pkg/test_images/eventshub"
)

func DataPlaneConformance(brokerName string) *feature.FeatureSet {
Expand All @@ -41,11 +38,6 @@ func DataPlaneConformance(brokerName string) *feature.FeatureSet {
}
}

type EventInfoCombined struct {
sent eventshubmain.EventInfo
response eventshubmain.EventInfo
}

func DataPlaneIngress(brokerName string) *feature.Feature {
f := feature.NewFeatureNamed("Ingress")

Expand Down Expand Up @@ -161,41 +153,8 @@ func todo(ctx context.Context, t feature.T) {
}

func brokerAcceptsCEVersions(ctx context.Context, t feature.T) {
brokerName := state.GetStringOrFail(ctx, t, "brokerName")

u, err := broker.Address(ctx, brokerName)
if err != nil || u == nil {
t.Error("failed to get the address of the broker", brokerName, err)
}

opts := []eventshub.EventsHubOption{eventshub.StartSenderToResource(broker.Gvr(), brokerName)}

uuids := map[string]string{
uuid.New().String(): "1.0",
uuid.New().String(): "0.3",
}
for uuid, version := range uuids {
// We need to use a different source name, otherwise, it will try to update
// the pod, which is immutable.
source := feature.MakeRandomK8sName("source")
event := FullEvent()
event.SetID(uuid)
event.SetSpecVersion(version)
opts = append(opts, eventshub.InputEvent(event))

eventshub.Install(source, opts...)(ctx, t)
store := eventshub.StoreFromContext(ctx, source)
// We are looking for two events, one of them is the sent event and the other
// is Response, so correlate them first. We want to make sure the event was sent and that the
// response was what was expected.
events := correlate(store.AssertAtLeast(2, sentEventMatcher(uuid)))
for _, e := range events {
// Make sure HTTP response code is 2XX
if e.response.StatusCode < 200 || e.response.StatusCode > 299 {
t.Errorf("Expected statuscode 2XX for sequence %d got %d", e.response.Sequence, e.response.StatusCode)
}
}
}
name := state.GetStringOrFail(ctx, t, "brokerName")
knconf.AcceptsCEVersions(ctx, t, broker.GVR(), name)
}

func brokerRejectsUnknownCEVersion(ctx context.Context, t feature.T) {
Expand All @@ -204,16 +163,16 @@ func brokerRejectsUnknownCEVersion(ctx context.Context, t feature.T) {
uuids := map[string]string{
uuid.New().String(): "19.0",
}
for uuid, version := range uuids {
for id, version := range uuids {
// We need to use a different source name, otherwise, it will try to update
// the pod, which is immutable.
source := feature.MakeRandomK8sName("source")
eventshub.Install(source,
eventshub.StartSenderToResource(broker.Gvr(), brokerName),
eventshub.StartSenderToResource(broker.GVR(), brokerName),
eventshub.InputHeader("ce-specversion", version),
eventshub.InputHeader("ce-type", "sometype"),
eventshub.InputHeader("ce-source", "400.request.sender.test.knative.dev"),
eventshub.InputHeader("ce-id", uuid),
eventshub.InputHeader("ce-id", id),
eventshub.InputBody("{}"),
)(ctx, t)

Expand All @@ -223,11 +182,11 @@ func brokerRejectsUnknownCEVersion(ctx context.Context, t feature.T) {
// response was what was expected.
// Note: We pass in "" for the match ID because when we construct the headers manually
// above, they do not get stuff into the sent/response SentId fields.
events := correlate(store.AssertAtLeast(2, sentEventMatcher("")))
events := knconf.Correlate(store.AssertAtLeast(2, knconf.SentEventMatcher("")))
for _, e := range events {
// Make sure HTTP response code is 4XX
if e.response.StatusCode < 400 || e.response.StatusCode > 499 {
t.Errorf("Expected statuscode 4XX for sequence %d got %d", e.response.Sequence, e.response.StatusCode)
if e.Response.StatusCode < 400 || e.Response.StatusCode > 499 {
t.Errorf("Expected statuscode 4XX for sequence %d got %d", e.Response.Sequence, e.Response.StatusCode)
}
}
}
Expand All @@ -239,16 +198,16 @@ func brokerRejectsGetRequest(ctx context.Context, t feature.T) {
uuids := map[string]string{
uuid.New().String(): "1.0",
}
for uuid, version := range uuids {
for id, version := range uuids {
// We need to use a different source name, otherwise, it will try to update
// the pod, which is immutable.
source := feature.MakeRandomK8sName("source")
eventshub.Install(source,
eventshub.StartSenderToResource(broker.Gvr(), brokerName),
eventshub.StartSenderToResource(broker.GVR(), brokerName),
eventshub.InputHeader("ce-specversion", version),
eventshub.InputHeader("ce-type", "sometype"),
eventshub.InputHeader("ce-source", "400.request.sender.test.knative.dev"),
eventshub.InputHeader("ce-id", uuid),
eventshub.InputHeader("ce-id", id),
eventshub.InputBody("{}"),
eventshub.InputMethod("GET"),
)(ctx, t)
Expand All @@ -259,11 +218,11 @@ func brokerRejectsGetRequest(ctx context.Context, t feature.T) {
// response was what was expected.
// Note: We pass in "" for the match ID because when we construct the headers manually
// above, they do not get stuff into the sent/response SentId fields.
events := correlate(store.AssertAtLeast(2, sentEventMatcher("")))
events := knconf.Correlate(store.AssertAtLeast(2, knconf.SentEventMatcher("")))
for _, e := range events {
// Make sure HTTP response code is 405
if e.response.StatusCode != 405 {
t.Errorf("Expected statuscode 405 for sequence %d got %d", e.response.Sequence, e.response.StatusCode)
if e.Response.StatusCode != 405 {
t.Errorf("Expected statuscode 405 for sequence %d got %d", e.Response.Sequence, e.Response.StatusCode)
}
}
}
Expand Down Expand Up @@ -293,7 +252,7 @@ func brokerRejectsMalformedCE(ctx context.Context, t feature.T) {
t.Logf("Adding Header Value: %q => %q", k2, v2)
}
}
options = append(options, eventshub.StartSenderToResource(broker.Gvr(), brokerName))
options = append(options, eventshub.StartSenderToResource(broker.GVR(), brokerName))
options = append(options, eventshub.InputBody("{}"))
// We need to use a different source name, otherwise, it will try to update
// the pod, which is immutable.
Expand All @@ -306,40 +265,13 @@ func brokerRejectsMalformedCE(ctx context.Context, t feature.T) {
// response was what was expected.
// Note: We pass in "" for the match ID because when we construct the headers manually
// above, they do not get stuff into the sent/response SentId fields.
events := correlate(store.AssertAtLeast(2, sentEventMatcher("")))
events := knconf.Correlate(store.AssertAtLeast(2, knconf.SentEventMatcher("")))
for _, e := range events {
// Make sure HTTP response code is 4XX
if e.response.StatusCode < 400 || e.response.StatusCode > 499 {
t.Errorf("Expected statuscode 4XX with missing required field %q for sequence %d got %d", k, e.response.Sequence, e.response.StatusCode)
t.Logf("Sent event was: %s\nresponse: %s\n", e.sent.String(), e.response.String())
}
}
}
}

func sentEventMatcher(uuid string) func(eventshubmain.EventInfo) error {
return func(ei eventshubmain.EventInfo) error {
if (ei.Kind == eventshubmain.EventSent || ei.Kind == eventshubmain.EventResponse) && ei.SentId == uuid {
return nil
}
return errors.New("no match")
}
}

// correlate takes in an array of mixed Sent / Response events (matched with sentEventMatcher for example)
// and correlates them based on the sequence into a pair.
func correlate(in []eventshubmain.EventInfo) []EventInfoCombined {
var out []EventInfoCombined
// not too many events, this will suffice...
for i, e := range in {
if e.Kind == eventshubmain.EventSent {
looking := e.Sequence
for j := i + 1; j <= len(in)-1; j++ {
if in[j].Kind == eventshubmain.EventResponse && in[j].Sequence == looking {
out = append(out, EventInfoCombined{sent: e, response: in[j]})
}
if e.Response.StatusCode < 400 || e.Response.StatusCode > 499 {
t.Errorf("Expected statuscode 4XX with missing required field %q for sequence %d got %d", k, e.Response.Sequence, e.Response.StatusCode)
t.Logf("Sent event was: %s\nresponse: %s\n", e.Sent.String(), e.Response.String())
}
}
}
return out
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func brokerIngressConformanceFeature(brokerClass string, version string, enc clo

f.Setup("install source", eventshub.Install(
sourceName,
eventshub.StartSenderToResource(broker.Gvr(), brokerName),
eventshub.StartSenderToResource(broker.GVR(), brokerName),
eventshub.InputEventWithEncoding(event, enc),
))

Expand Down Expand Up @@ -95,7 +95,7 @@ func brokerIngressConformanceBadEvent(brokerClass string) *feature.Feature {
f.Setup("broker is addressable", broker.IsAddressable(brokerName))

f.Setup("install source", eventshub.Install(sourceName,
eventshub.StartSenderToResource(broker.Gvr(), brokerName),
eventshub.StartSenderToResource(broker.GVR(), brokerName),
eventshub.InputHeader("ce-specversion", "9000.1"),
eventshub.InputHeader("ce-type", "sometype"),
eventshub.InputHeader("ce-source", "400.request.sender.test.knative.dev"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ func TriggerGoesReady(name, brokerName string) *feature.Feature {
f.Setup(fmt.Sprintf("install trigger %q", name), trigger.Install(name, brokerName, cfg...))

// Wait for a ready broker.
f.Requirement("broker is ready", broker.IsReady(brokerName))
f.Requirement("Broker is ready", broker.IsReady(brokerName))
f.Requirement("Trigger is ready", trigger.IsReady(name))

f.Stable("trigger").
Must("be ready", trigger.IsReady(name))
f.Stable("trigger")

return f
}
Expand All @@ -60,8 +60,9 @@ func GoesReady(name string, cfg ...manifest.CfgFn) *feature.Feature {

f.Setup(fmt.Sprintf("install broker %q", name), broker.Install(name, cfg...))

f.Requirement("Broker is ready", broker.IsReady(name))

f.Stable("broker").
Must("be ready", broker.IsReady(name)).
Must("be addressable", broker.IsAddressable(name))

return f
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,48 @@ func HasReadyInConditions(_ context.Context, t feature.T, status duckv1.Status)
t.Errorf(`does not have "Ready" condition, has: [%s]`, strings.Join(found, ","))
}

func KResourceHasObservedGeneration(gvr schema.GroupVersionResource, name string) feature.StepFn {
return func(ctx context.Context, t feature.T) {
env := environment.FromContext(ctx)
ri := dynamicclient.Get(ctx).Resource(gvr).Namespace(env.Namespace())

get := func() (*duckv1.KResource, error) {
obj, err := ri.Get(ctx, name, metav1.GetOptions{})
if err != nil {
return nil, err
}
kr := new(duckv1.KResource)
if err = runtime.DefaultUnstructuredConverter.FromUnstructured(obj.Object, kr); err != nil {
return nil, err
}
return kr, nil
}

var kr *duckv1.KResource
var err error

interval, timeout := environment.PollTimingsFromContext(ctx)
err = wait.PollImmediate(interval, timeout, func() (bool, error) {
kr, err = get()
if err != nil {
// break out if not a "not found" error.
if !apierrors.IsNotFound(err) {
return false, err
}
// Keep polling
return false, nil
}
if kr.Status.ObservedGeneration != 0 {
return true, nil
}
return false, nil
})
if err != nil {
t.Errorf("unable to get a reconciled resource (status.observedGeneration != 0)")
}
}
}

func KResourceHasReadyInConditions(gvr schema.GroupVersionResource, name string) feature.StepFn {
return func(ctx context.Context, t feature.T) {
env := environment.FromContext(ctx)
Expand Down
Loading

0 comments on commit 523393f

Please sign in to comment.