Add function test CLI tests (#2871)

* Add function test CLI tests
* Add few more services to tests

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
This commit is contained in:
Sanket Sudake
2023-11-13 14:34:56 +05:30
committed by GitHub
parent 3fabf64b3c
commit 2e4825def0
8 changed files with 60 additions and 39 deletions
+12 -12
View File
@@ -122,20 +122,20 @@ func TestFissionCLI(t *testing.T) {
require.Equal(t, v1.ExecutorTypePoolmgr, testFunc.Spec.InvokeStrategy.ExecutionStrategy.ExecutorType)
})
// t.Run("test/poolmgr", func(t *testing.T) {
// _, err := cli.ExecCommand(f, ctx, "function", "test", "--name", testFuncName)
// require.NoError(t, err)
// })
t.Run("test/poolmgr", func(t *testing.T) {
_, err := cli.ExecCommand(f, ctx, "function", "test", "--name", testFuncName)
require.Error(t, err)
})
// t.Run("test/newdeploy", func(t *testing.T) {
// _, err := cli.ExecCommand(f, ctx, "function", "test", "--name", testFuncNd)
// require.NoError(t, err)
// })
t.Run("test/newdeploy", func(t *testing.T) {
_, err := cli.ExecCommand(f, ctx, "function", "test", "--name", testFuncNd)
require.Error(t, err)
})
// t.Run("test/container", func(t *testing.T) {
// _, err := cli.ExecCommand(f, ctx, "function", "test", "--name", testFuncCn)
// require.NoError(t, err)
// })
t.Run("test/container", func(t *testing.T) {
_, err := cli.ExecCommand(f, ctx, "function", "test", "--name", testFuncCn)
require.Error(t, err)
})
t.Run("delete/newdeploy", func(t *testing.T) {
_, err := cli.ExecCommand(f, ctx, "function", "delete", "--name", testFuncNd)
+23 -1
View File
@@ -8,8 +8,11 @@ import (
"github.com/fission/fission/pkg/buildermgr"
"github.com/fission/fission/pkg/executor"
eclient "github.com/fission/fission/pkg/executor/client"
"github.com/fission/fission/pkg/kubewatcher"
"github.com/fission/fission/pkg/mqtrigger"
"github.com/fission/fission/pkg/router"
"github.com/fission/fission/pkg/storagesvc"
"github.com/fission/fission/pkg/timer"
"github.com/fission/fission/pkg/utils"
"github.com/fission/fission/pkg/utils/manager"
"github.com/fission/fission/test/e2e/framework"
@@ -104,6 +107,25 @@ func StartServices(ctx context.Context, f *framework.Framework, mgr manager.Inte
f.ServiceInfo["router"] = framework.ServiceInfo{
Port: routerPort,
}
os.Setenv("FISSION_ROUTER_URL", fmt.Sprintf("http://localhost:%d", routerPort))
routerURL := fmt.Sprintf("http://localhost:%d", routerPort)
os.Setenv("FISSION_ROUTER_URL", routerURL)
err = timer.Start(ctx, f.ClientGen(), f.Logger(), mgr, routerURL)
if err != nil {
return fmt.Errorf("error starting timer: %v", err)
}
f.ServiceInfo["timer"] = framework.ServiceInfo{}
err = mqtrigger.StartScalerManager(ctx, f.ClientGen(), f.Logger(), mgr, routerURL)
if err != nil {
return fmt.Errorf("error starting mqt scaler manager: %v", err)
}
f.ServiceInfo["mqtrigger-keda"] = framework.ServiceInfo{}
err = kubewatcher.Start(ctx, f.ClientGen(), f.Logger(), mgr, routerURL)
if err != nil {
return fmt.Errorf("error starting kubewatcher: %v", err)
}
f.ServiceInfo["kubewatcher"] = framework.ServiceInfo{}
return nil
}