forked from knative/client
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[release-v0.24.0] Update spec file & kafka tests (knative#814)
* [release-v0.24.0] Update spec file version * [release-v0.24.0] Add kafka plugin tests
- Loading branch information
Showing
6 changed files
with
348 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
%global package_name openshift-serverless-clients | ||
%global product_name OpenShift Serverless | ||
%global golang_version 1.15 | ||
%global kn_version 0.23.2 | ||
%global kn_version 0.24.0 | ||
%global kn_release 1 | ||
%global kn_cli_version v%{kn_version} | ||
%global source_dir knative-client | ||
|
@@ -68,6 +68,9 @@ Obsoletes: %{package_name} < %{kn_version} | |
%{_datadir}/%{name}-redistributable/windows/kn-windows-amd64.exe | ||
|
||
%changelog | ||
* Mon Sep 13 2021 David Simansky <[email protected]> v0.24.0-1 | ||
- Bump kn release v0.24.0 | ||
|
||
* Mon Aug 2 2021 David Simansky <[email protected]> v0.23.2-1 | ||
- Bump kn release v0.23.2 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
// 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/v3/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" | ||
ceo = "type=foo" | ||
) | ||
|
||
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() | ||
|
||
//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", "cloudevent") | ||
|
||
t.Log("test kn-plugin-source-kafka list") | ||
e2eTest.knSourceKafkaList(t, r, "mykafka1") | ||
|
||
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, "--ce-override", ceo) | ||
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, cloudEvent string) { | ||
out := et.it.KnPlugin().Run("describe", sourceName) | ||
r.AssertNoError(out) | ||
assert.Check(t, util.ContainsAllIgnoreCase(out.Stdout, sourceName, sinkName, cloudEvent)) | ||
} | ||
|
||
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")) | ||
} | ||
|
||
func (et *e2eTest) knSourceKafkaList(t *testing.T, r *test.KnRunResultCollector, sourceName string) { | ||
out := et.it.KnPlugin().Run("list") | ||
r.AssertNoError(out) | ||
assert.Check(t, util.ContainsAll(out.Stdout, "NAME", "AGE", "SINK", "BOOTSTRAPSERVERS", sourceName)) | ||
} |
56 changes: 56 additions & 0 deletions
56
vendor/github.com/maximilien/kn-source-pkg/test/e2e/common.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
162 changes: 162 additions & 0 deletions
162
vendor/github.com/maximilien/kn-source-pkg/test/e2e/kn_plugin.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters