test.go 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. package plugin
  2. func TestPlugin(pluginPath string) {
  3. // // get invoke_type and invoke_action
  4. // invoke_type := access_types.PluginAccessType(invoke_type_str)
  5. // if !invoke_type.IsValid() {
  6. // log.Error("invalid invoke type: %s", invoke_type_str)
  7. // return
  8. // }
  9. // invoke_action := access_types.PluginAccessAction(invoke_action_str)
  10. // if !invoke_action.IsValid() {
  11. // log.Error("invalid invoke action: %s", invoke_action_str)
  12. // return
  13. // }
  14. // // init routine pool
  15. // routine.InitPool(1024)
  16. // // clean working directory when test finished
  17. // defer os.RemoveAll("./working")
  18. // // init testing config
  19. // config := &app.Config{
  20. // PluginWorkingPath: "./working/cwd",
  21. // PluginStoragePath: "./working/storage",
  22. // PluginMediaCachePath: "./working/media_cache",
  23. // ProcessCachingPath: "./working/subprocesses",
  24. // Platform: app.PLATFORM_LOCAL,
  25. // }
  26. // config.SetDefault()
  27. // // init oss
  28. // oss := local.NewLocalStorage("./storage")
  29. // // init plugin manager
  30. // plugin_manager := plugin_manager.InitGlobalManager(oss, config)
  31. // response, err := plugin_manager.TestPlugin(package_path_str, inputs, invoke_type, invoke_action, timeout)
  32. // if err != nil {
  33. // log.Error("failed to test plugin, package_path: %s, error: %v", package_path_str, err)
  34. // return
  35. // }
  36. // for response.Next() {
  37. // item, err := response.Read()
  38. // if err != nil {
  39. // log.Error("failed to read response item, error: %v", err)
  40. // return
  41. // }
  42. // log.Info("%v", parser.MarshalJson(item))
  43. // }
  44. // },
  45. // }
  46. }