Verify "source ping describe" in ping e2e test (#727)

This commit is contained in:
Ying Chun Guo 2020-03-11 15:32:29 +08:00 committed by GitHub
parent a69daf4f8f
commit 5ed62c801a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -160,7 +160,7 @@ type KnRunResult struct {
ErrorExpected bool
}
// RunKubectl runs "kk" in a given namespace
// RunKn runs "kn" in a given namespace
func RunKn(namespace string, args []string) KnRunResult {
if namespace != "" {
args = append(args, "--namespace", namespace)

View File

@ -57,6 +57,11 @@ func TestSourcePing(t *testing.T) {
out, err := test.getResourceFieldsWithJSONPath("pingsource", "testpingsource2", jpSinkRefNameInSpec)
assert.NilError(t, err)
assert.Equal(t, out, "testsvc1")
t.Log("verify Ping source description")
mymsg := "This is a message from Ping."
test.pingSourceCreate(t, r, "testpingsource3", "*/1 * * * *", mymsg, "svc:testsvc1")
test.verifyPingSourceDescribe(t, r, "testpingsource3", "*/1 * * * *", mymsg, "testsvc1")
}
func (test *e2eTest) pingSourceCreate(t *testing.T, r *KnRunResultCollector, sourceName string, schedule string, data string, sink string) {
@ -101,8 +106,8 @@ func (test *e2eTest) pingSourceUpdateResources(t *testing.T, r *KnRunResultColle
r.AssertNoError(out)
}
func (test *e2eTest) verifyPingSourceDescribe(t *testing.T, r *KnRunResultCollector, sourceName string, schedule string, data string, sink string, sa string, requestcpu string, requestmm string, limitcpu string, limitmm string) {
func (test *e2eTest) verifyPingSourceDescribe(t *testing.T, r *KnRunResultCollector, sourceName string, schedule string, data string, sink string) {
out := test.kn.Run("source", "ping", "describe", sourceName)
assert.Check(t, util.ContainsAllIgnoreCase(out.Stdout, sourceName, schedule, data, sink, sa, requestcpu, requestmm, limitcpu, limitmm))
assert.Check(t, util.ContainsAllIgnoreCase(out.Stdout, sourceName, schedule, data, sink))
r.AssertNoError(out)
}