Skip to content

Commit

Permalink
[release-v0.19.1] Update kn-plugin-source-kafka to v0.19.0 (knative#590)
Browse files Browse the repository at this point in the history
* Update kn-plugin-source-kafka to v0.19.0

* Enable Kafka for E2E tests

* Update vendor dir
  • Loading branch information
dsimansk authored Jan 26, 2021
1 parent c91e2e0 commit 0c3f545
Show file tree
Hide file tree
Showing 122 changed files with 12,032 additions and 34 deletions.
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ go 1.14
require (
github.com/boson-project/func v0.11.0
github.com/google/go-cmp v0.5.2
github.com/maximilien/kn-source-pkg v0.5.0
github.com/mitchellh/go-homedir v1.1.0
github.com/pkg/errors v0.9.1
github.com/spf13/cobra v1.0.1-0.20201006035406-b97b5ead31f7
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.7.0
golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0
golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897
gotest.tools v2.2.0+incompatible
k8s.io/api v0.18.8
k8s.io/apimachinery v0.19.1
Expand All @@ -19,6 +20,7 @@ require (
k8s.io/code-generator v0.18.8
knative.dev/eventing v0.19.0
knative.dev/hack v0.0.0-20201103151104-3d5abc3a0075
knative.dev/kn-plugin-source-kafka v0.19.0
knative.dev/networking v0.0.0-20201103163404-b9f80f4537af
knative.dev/pkg v0.0.0-20201103163404-5514ab0c1fdf
knative.dev/serving v0.19.0
Expand Down
756 changes: 756 additions & 0 deletions go.sum

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions openshift/e2e-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -208,21 +208,21 @@ install_serverless_operator_branch() {
cat olm-catalog/serverless-operator/manifests/serverless-operator.clusterserviceversion.yaml

# Install all components Serving,Eventing,Strimzi and Kafka
SCALE_UP=6 make install || failed=1
SCALE_UP=6 make install-all || failed=1
subheader "Successfully installed serverless operator."

# header "Applying Strimzi Topic CR"
# cat <<-EOF | oc apply -n kafka -f - || failed=1
#apiVersion: kafka.strimzi.io/v1beta1
#kind: KafkaTopic
#metadata:
# name: test-topic
# labels:
# strimzi.io/cluster: my-cluster
#spec:
# partitions: 100
# replicas: 1
#EOF
header "Applying Strimzi Topic CR"
cat <<-EOF | oc apply -n kafka -f - || failed=1
apiVersion: kafka.strimzi.io/v1beta1
kind: KafkaTopic
metadata:
name: test-topic
labels:
strimzi.io/cluster: my-cluster
spec:
partitions: 100
replicas: 1
EOF

popd
return $failed
Expand Down
1 change: 1 addition & 0 deletions pkg/kn/root/plugin_register.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package root
import (
// Add #plugins# import here. Don't remove this line, it triggers an automatic replacement.
_ "github.com/boson-project/func/plugin"
_ "knative.dev/kn-plugin-source-kafka/plugin"
)

// RegisterInlinePlugins is an empty function which however forces the
Expand Down
113 changes: 113 additions & 0 deletions test/e2e/source_kafka_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
// 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

// http://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.

// +build e2e
// +build !serving

package e2e

import (
"os"
"path/filepath"
"testing"

testcommon "github.com/maximilien/kn-source-pkg/test/e2e"
"gotest.tools/assert"
"knative.dev/client/lib/test"
"knative.dev/client/pkg/util"
)

const (
kafkaBootstrapUrl = "my-cluster-kafka-bootstrap.kafka.svc:9092"
kafkaClusterName = "my-cluster"
kafkaClusterNamespace = "kafka"
kafkaTopic = "test-topic"
)

type e2eTest struct {
it *testcommon.E2ETest
}

func newE2ETest(t *testing.T) *e2eTest {
currentDir, err := os.Getwd()
if err != nil {
return nil
}

it, err := testcommon.NewE2ETest("kn-source-kafka", filepath.Join(currentDir, "../.."), false)
if err != nil {
return nil
}

e2eTest := &e2eTest{
it: it,
}
return e2eTest
}

func TestSourceKafka(t *testing.T) {
t.Parallel()

e2eTest := newE2ETest(t)
assert.Assert(t, e2eTest != nil)
defer func() {
assert.NilError(t, e2eTest.it.KnTest().Teardown())
}()

r := test.NewKnRunResultCollector(t, e2eTest.it.KnTest())
defer r.DumpIfFailed()
// Don't install the plugin as it's already inlined in kn binary
//err := e2eTest.it.KnPlugin().Install()
//assert.NilError(t, err)

serviceCreate(r, "sinksvc")

t.Log("test kn-plugin-source-kafka create source-name")
e2eTest.knSourceKafkaCreate(t, r, "mykafka1", "sinksvc")

t.Log("test kn-plugin-source-kafka describe source-name")
e2eTest.knSourceKafkaDescribe(t, r, "mykafka1", "sinksvc")

t.Log("test kn-plugin-source-kafka delete source-name")
e2eTest.knSourceKafkaDelete(t, r, "mykafka1")

//err = e2eTest.it.KnPlugin().Uninstall()
//assert.NilError(t, err)
}

// Private

func (et *e2eTest) knSourceKafkaCreate(t *testing.T, r *test.KnRunResultCollector, sourceName, sinkName string) {
out := et.it.KnPlugin().Run("create", sourceName, "--servers", kafkaBootstrapUrl, "--topics", kafkaTopic, "--consumergroup", "test-consumer-group", "--sink", sinkName)
r.AssertNoError(out)
assert.Check(t, util.ContainsAllIgnoreCase(out.Stdout, "create", sourceName))
}

func (et *e2eTest) knSourceKafkaDelete(t *testing.T, r *test.KnRunResultCollector, sourceName string) {
out := et.it.KnPlugin().Run("delete", sourceName)
r.AssertNoError(out)
assert.Check(t, util.ContainsAllIgnoreCase(out.Stdout, "delete", sourceName))
}

func (et *e2eTest) knSourceKafkaDescribe(t *testing.T, r *test.KnRunResultCollector, sourceName, sinkName string) {
out := et.it.KnPlugin().Run("describe", sourceName)
r.AssertNoError(out)
assert.Check(t, util.ContainsAllIgnoreCase(out.Stdout, sourceName, sinkName))
}

func serviceCreate(r *test.KnRunResultCollector, serviceName string) {
out := r.KnTest().Kn().Run("service", "create", serviceName, "--image", "gcr.io/knative-samples/helloworld-go")
r.AssertNoError(out)
assert.Check(r.T(), util.ContainsAllIgnoreCase(out.Stdout, "service", serviceName, "creating", "namespace", r.KnTest().Kn().Namespace(), "ready"))
}
20 changes: 20 additions & 0 deletions vendor/github.com/apex/log/History.md

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

19 changes: 19 additions & 0 deletions vendor/github.com/apex/log/context.go

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

9 changes: 7 additions & 2 deletions vendor/github.com/apex/log/go.mod

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

22 changes: 20 additions & 2 deletions vendor/github.com/apex/log/go.sum

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

Loading

0 comments on commit 0c3f545

Please sign in to comment.