Skip to content

Commit

Permalink
Fixes #1350 Remove human-readable format from timer period computatio…
Browse files Browse the repository at this point in the history
…n in cron trait, more tests
  • Loading branch information
oscerd committed Mar 17, 2020
1 parent a47410d commit d513b8d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 30 deletions.
24 changes: 12 additions & 12 deletions deploy/resources.go

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

22 changes: 11 additions & 11 deletions pkg/metadata/metadata_uri_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ func TestGroovy1(t *testing.T) {
DataSpec: v1.DataSpec{
Name: "test",
Content: `
from( "timer:tick")
.setBody().constant("aa")
.to ('log:info?skipBodyLineSeparator=false').to(
'http://url' )
from("uri:2")
.setBody().constant("aa")
.to('uri:3')
Expand All @@ -133,7 +133,7 @@ func TestGroovy2(t *testing.T) {
source := v1.SourceSpec{
DataSpec: v1.DataSpec{
Name: "test",
Content: `
Content: `
rest().get("/")
.to ('log:info?skipBodyLineSeparator=false').to( 'http://url' )
.toD('dyn:1')
Expand Down Expand Up @@ -166,7 +166,7 @@ func TestXml1(t *testing.T) {
Content: `
<routes>
<route id="hello">
<from uri="timer:hello?period=3s"/>
<from uri="timer:hello?period=3000"/>
<setBody>
<constant>Hello World!!!</constant>
</setBody>
Expand All @@ -185,7 +185,7 @@ func TestXml1(t *testing.T) {

metadata := Extract(catalog, source)

assert.Contains(t, metadata.FromURIs, "timer:hello?period=3s")
assert.Contains(t, metadata.FromURIs, "timer:hello?period=3000")
assert.Len(t, metadata.FromURIs, 1)
assert.Contains(t, metadata.ToURIs, "log:info")
assert.Contains(t, metadata.ToURIs, "log:info2")
Expand All @@ -198,12 +198,12 @@ func TestKotlin1(t *testing.T) {
DataSpec: v1.DataSpec{
Name: "test",
Content: `
from( "timer:tick")
.setBody().constant("aa")
.to ("log:info?skipBodyLineSeparator=false").to(
"http://url" )
from("uri:2")
.setBody().constant("aa")
.to("uri:3")
Expand Down Expand Up @@ -235,11 +235,11 @@ func TestJavascript1(t *testing.T) {
DataSpec: v1.DataSpec{
Name: "test",
Content: `
rest().get("/")
.to ('log:info?skipBodyLineSeparator=false').to( 'http://url' )
.toD("uri:2")
.toF("uri:%s", "3")
.toF("uri:%s", "3")
`,
},
Language: v1.LanguageJavaScript,
Expand All @@ -263,13 +263,13 @@ const yaml = `
uri: "timer:tick"
steps:
- to: "log:info1"
- to:
- to:
uri: "log:info2"
- split:
tokenizer: 't'
steps:
- to: "log:info3"
`

func TestJYaml(t *testing.T) {
Expand Down
14 changes: 7 additions & 7 deletions pkg/util/uri/uri_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,31 +49,31 @@ func TestQueryParameter(t *testing.T) {
component: "knative",
},
{
uri: "timer:tick?delay=123&period=3s",
uri: "timer:tick?delay=123&period=3000",
param: "period",
expected: "3s",
expected: "3000",
component: "timer",
},
{
uri: "timer:tick?period=3s&delay=4s",
uri: "timer:tick?period=3000&delay=4000",
param: "period",
expected: "3s",
expected: "3000",
component: "timer",
},
{
uri: "timer:tick?delay=123&period=3s",
uri: "timer:tick?delay=123&period=3000",
param: ".*",
expected: "",
component: "timer",
},
{
uri: "timer:tick?delay=123&period=3s",
uri: "timer:tick?delay=123&period=3000",
param: ".",
expected: "",
component: "timer",
},
{
uri: "tick&delay=123&period=3s",
uri: "tick&delay=123&period=3000",
param: "delay",
expected: "",
component: "",
Expand Down

0 comments on commit d513b8d

Please sign in to comment.