Add method and subpath flags to timetrigger object for triggering a function (#3017)
* Update timetrigger crd and add method and subpath fields in spec. Update fission-cli to accept user input for method and subpath fields. Update publisher package to utilize these fields for triggering a function. Update timer controller to use method and subpath fields for publishing a request. Add a new test TestPublisherSubpath in pulisher package. Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io> * Use kubebuilder default annotation. Update test for fission-cli timetrigger create, update command to support method and subpath flags. Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io> --------- Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>
This commit is contained in:
@@ -282,6 +282,8 @@ func TestFissionCLI(t *testing.T) {
|
||||
require.Equal(t, "test-tt", tt.Name)
|
||||
require.Equal(t, "test-func", tt.Spec.FunctionReference.Name)
|
||||
require.Equal(t, "@every 1m", tt.Spec.Cron)
|
||||
require.Equal(t, "POST", tt.Spec.Method)
|
||||
require.Equal(t, "/", tt.Spec.Subpath)
|
||||
})
|
||||
|
||||
t.Run("list", func(t *testing.T) {
|
||||
@@ -295,7 +297,7 @@ func TestFissionCLI(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("update", func(t *testing.T) {
|
||||
_, err := cli.ExecCommand(f, ctx, "timetrigger", "update", "--name", "test-tt", "--cron", "@every 2m")
|
||||
_, err := cli.ExecCommand(f, ctx, "timetrigger", "update", "--name", "test-tt", "--cron", "@every 2m", "--method", "GET", "--subpath", "/api/v1/fetch")
|
||||
require.NoError(t, err)
|
||||
|
||||
tt, err := fissionClient.CoreV1().TimeTriggers(metav1.NamespaceDefault).Get(ctx, "test-tt", metav1.GetOptions{})
|
||||
@@ -304,6 +306,8 @@ func TestFissionCLI(t *testing.T) {
|
||||
require.Equal(t, "test-tt", tt.Name)
|
||||
require.Equal(t, "test-func", tt.Spec.FunctionReference.Name)
|
||||
require.Equal(t, "@every 2m", tt.Spec.Cron)
|
||||
require.Equal(t, "GET", tt.Spec.Method)
|
||||
require.Equal(t, "/api/v1/fetch", tt.Spec.Subpath)
|
||||
})
|
||||
|
||||
t.Run("delete", func(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user