Skip to content

Commit

Permalink
🎁 E2E tests (knative-extensions#126)
Browse files Browse the repository at this point in the history
* Adding `presubmit-tests.sh` script

* Adding codecov

* E2E tests beginning

* Running integration tests from e2e runner

* Eventshub starting, sort of.

* E2E test is working

* Resolver for kn-plugin-event binary location

* Debugging the send error

* Using proper image

* Further dumping of events

* Make sure to call `environment.InitFlags` func

See also: knative-extensions/reconciler-test#268

* Upgrade knative.dev/reconciler-test

* Clean up the e2e test

* Test for sending to Knative service

* Use library logger

* Auto skip if short flag is used.
  • Loading branch information
cardil committed Feb 21, 2022
1 parent 323c889 commit f9b5357
Show file tree
Hide file tree
Showing 599 changed files with 64,167 additions and 1,036 deletions.
13 changes: 11 additions & 2 deletions cmd/kn-event-sender/main.go
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
package main

import (
"fmt"
"context"
"os"

"go.uber.org/zap"
"knative.dev/kn-plugin-event/pkg/cli/retcode"
"knative.dev/kn-plugin-event/pkg/configuration"
"knative.dev/pkg/logging"
)

// ExitFunc will be used to exit Go process in case of error.
var ExitFunc = os.Exit // nolint:gochecknoglobals

func main() {
logger := createLogger()
app := configuration.CreateIcs()
if err := app.SendFromEnv(); err != nil {
_, _ = fmt.Fprint(os.Stderr, err)
logger.Error(err)
ExitFunc(retcode.Calc(err))
}
}
Expand All @@ -24,3 +27,9 @@ func main() {
func TestMain() { //nolint:deadcode
main()
}

func createLogger() *zap.SugaredLogger {
return logging.
FromContext(context.TODO()).
With("env", os.Environ())
}
18 changes: 13 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,36 @@ module knative.dev/kn-plugin-event
go 1.16

require (
cloud.google.com/go v0.98.0 // indirect
github.com/cloudevents/sdk-go/v2 v2.4.1
github.com/ghodss/yaml v1.0.0
github.com/go-logr/logr v1.2.2 // indirect
github.com/google/uuid v1.3.0
github.com/kelseyhightower/envconfig v1.4.0
github.com/magefile/mage v1.11.0
github.com/openzipkin/zipkin-go v0.3.0 // indirect
github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2
github.com/pkg/errors v0.9.1
github.com/prometheus/common v0.32.1 // indirect
github.com/spf13/cobra v1.2.1
github.com/thediveo/enumflag v0.10.0
github.com/wavesoftware/go-ensure v1.0.0
github.com/wavesoftware/go-magetasks v0.6.0
go.uber.org/zap v1.19.1
golang.org/x/tools v0.1.8 // indirect
google.golang.org/grpc v1.42.0 // indirect
gopkg.in/yaml.v2 v2.4.0
gotest.tools/v3 v3.0.3
k8s.io/api v0.21.4
k8s.io/apimachinery v0.22.3
k8s.io/client-go v0.21.4
k8s.io/klog/v2 v2.40.1 // indirect
knative.dev/client v0.27.0
knative.dev/eventing v0.27.0
knative.dev/hack v0.0.0-20211104075903-0f69979bbb7d
knative.dev/networking v0.0.0-20211104064801-6871f98f7b4d
knative.dev/pkg v0.0.0-20211104080002-e7547eabc6ee
knative.dev/serving v0.27.0
knative.dev/eventing v0.27.2
knative.dev/hack v0.0.0-20211122163517-fe1340f21191
knative.dev/pkg v0.0.0-20211101212339-96c0204a70dc
knative.dev/reconciler-test v0.0.0-20211101214439-9839937c9b13
knative.dev/serving v0.27.1
sigs.k8s.io/yaml v1.3.0
)

Expand Down
65 changes: 41 additions & 24 deletions go.sum

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions hack/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,8 @@ import (

// For Mage stuff
_ "github.com/magefile/mage/mage"

// Test images
_ "knative.dev/eventing/test/test_images/wathola-forwarder"
_ "knative.dev/reconciler-test/cmd/eventshub"
)
Loading

0 comments on commit f9b5357

Please sign in to comment.