Skip to content

Add utility to send events#49

Merged
google-prow-robot merged 2 commits into
knative:v0.1from
inlined:send-event-utility
Apr 25, 2018
Merged

Add utility to send events#49
google-prow-robot merged 2 commits into
knative:v0.1from
inlined:send-event-utility

Conversation

@inlined
Copy link
Copy Markdown
Contributor

@inlined inlined commented Apr 25, 2018

Adds a utility (meant to be used with go install) that will send a sample cloud event.

@google-prow-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: inlined

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-prow-robot google-prow-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Apr 25, 2018
@inlined
Copy link
Copy Markdown
Contributor Author

inlined commented Apr 25, 2018

/assign @eobrain

Comment thread cmd/sendevent/main.go Outdated

var untyped map[string]interface{}
if err := json.Unmarshal([]byte(data), &untyped); err != nil {
fmt.Println("Currenlty sendevent only supports JSON event data")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Spelling

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread cmd/sendevent/main.go
}

if ctx.Source == "" {
var err error
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't you just use := on the next line?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. ctx.Source already exists.

Comment thread cmd/sendevent/main.go Outdated
flag.Parse()

if flag.NArg() != 1 {
fmt.Println("Missing webhook address")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe print usage example. For example:

		fmt.Println("Missing webhook address.  For example:\n    go run cmd/sendevent/main.go http://httpbin.org/post")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added something in the same vein

Comment thread cmd/sendevent/main.go
flag.StringVar(&context.EventID, "event-id", "", "Event ID to use. Defaults to a UUID")
flag.StringVar(&context.EventType, "event-type", "google.events.action.demo", "The Event Type to use.")
flag.StringVar(&context.Source, "source", "", "Source URI to use. Defaults to the current machine's hostname")
flag.StringVar(&data, "data", `{"hello": "world!"}`, "Event data")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest naming the flag something that ends with "json", and specifying in the description it should be JSON.
(You could add flags for other formats later.)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I still don't really feel like I know how this tool is going to grow. I've also been considering adding a --file version of the data, and don't want to do a cross-product of {literal or by-file data} x {content-type}. I might do a content-type flag or just limit the tool to JSON.

@eobrain
Copy link
Copy Markdown
Contributor

eobrain commented Apr 25, 2018

/lgtm

@google-prow-robot google-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 25, 2018
@google-prow-robot google-prow-robot merged commit cfbad79 into knative:v0.1 Apr 25, 2018
dprotaso added a commit to dprotaso/eventing that referenced this pull request Sep 12, 2018
Includes the following changes
1e7c2e7 Update static_watcher.go
d688349 Include note about embedding the ManualWatcher in the InformedWatcher
767d6a5 Few changes to the configmap package
0122abd The test logger will now log the correct caller (knative#63)
e7a4b0d Dont call flag.parse in pkg/test (knative#62)
b213523 Update test-infra dependency (knative#61)
382a2bf Make kube_checks generic so that it can be used in serving (knative#58)
760afb6 cleanup (knative#57)
eedc0a9 Make verify-codegen.sh compatible with OS X (knative#54)
6eff182 Remove docker repo from e2e flags (knative#53)
4be5c07 Vendor the test-infra scripts (knative#52)
8c687df Update WaitForEndpointState to return response (knative#51)
8f6a3be Update knative/pkg/test (knative#50)
3ca4270 Add a logkey for the reconcile key. (knative#49)
62d2560 Add Istio DestinationRule and Policy into Istio apis and clients (knative#43)
f4a77d7 Add a common test clients file (knative#46)
450739d Add common test logging module (knative#45)
dprotaso added a commit to dprotaso/eventing that referenced this pull request Sep 12, 2018
Includes the following changes:
8fc80de Few changes to the configmap package (knative#59)
0122abd The test logger will now log the correct caller (knative#63)
e7a4b0d Dont call flag.parse in pkg/test (knative#62)
b213523 Update test-infra dependency (knative#61)
382a2bf Make kube_checks generic so that it can be used in serving (knative#58)
760afb6 cleanup (knative#57)
eedc0a9 Make verify-codegen.sh compatible with OS X (knative#54)
6eff182 Remove docker repo from e2e flags (knative#53)
4be5c07 Vendor the test-infra scripts (knative#52)
8c687df Update WaitForEndpointState to return response (knative#51)
8f6a3be Update knative/pkg/test (knative#50)
3ca4270 Add a logkey for the reconcile key. (knative#49)
62d2560 Add Istio DestinationRule and Policy into Istio apis and clients (knative#43)
f4a77d7 Add a common test clients file (knative#46)
450739d Add common test logging module (knative#45
knative-prow-robot pushed a commit that referenced this pull request Sep 17, 2018
* bump knative/pkg to 8fc80de

Includes the following changes:
8fc80de Few changes to the configmap package (#59)
0122abd The test logger will now log the correct caller (#63)
e7a4b0d Dont call flag.parse in pkg/test (#62)
b213523 Update test-infra dependency (#61)
382a2bf Make kube_checks generic so that it can be used in serving (#58)
760afb6 cleanup (#57)
eedc0a9 Make verify-codegen.sh compatible with OS X (#54)
6eff182 Remove docker repo from e2e flags (#53)
4be5c07 Vendor the test-infra scripts (#52)
8c687df Update WaitForEndpointState to return response (#51)
8f6a3be Update knative/pkg/test (#50)
3ca4270 Add a logkey for the reconcile key. (#49)
62d2560 Add Istio DestinationRule and Policy into Istio apis and clients (#43)
f4a77d7 Add a common test clients file (#46)
450739d Add common test logging module (#45

* Use updated methods that indicate that the configmap.Watcher is using an informer
matzew pushed a commit to matzew/eventing that referenced this pull request Apr 17, 2019
…0.5.0

Run Origin's conformance test suite via specific target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants