diff --git a/README.md b/README.md index dadbcc6..58db478 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,6 @@ [![Codacy Badge](https://app.codacy.com/project/badge/Coverage/3f16717cd6f841118006f12c346e9341)](https://app.codacy.com/gh/LinuxSuRen/api-testing/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade) ![GitHub All Releases](https://img.shields.io/github/downloads/linuxsuren/api-testing/total) ![Docker Pulls](https://img.shields.io/docker/pulls/linuxsuren/api-testing) -![](https://sloc.xyz/github/linuxsuren/api-testing) [![LinuxSuRen/open-source-best-practice](https://img.shields.io/static/v1?label=OSBP&message=%E5%BC%80%E6%BA%90%E6%9C%80%E4%BD%B3%E5%AE%9E%E8%B7%B5&color=blue)](https://github.com/LinuxSuRen/open-source-best-practice) This is a API testing tool. diff --git a/cmd/function.go b/cmd/function.go index d5f220c..48216c7 100644 --- a/cmd/function.go +++ b/cmd/function.go @@ -13,8 +13,8 @@ import ( "runtime" "strings" - "github.com/antonmedv/expr/builtin" "github.com/cucumber/godog" + "github.com/expr-lang/expr/builtin" "github.com/linuxsuren/api-testing/pkg/render" "github.com/spf13/cobra" ) diff --git a/cmd/run.go b/cmd/run.go index e448007..4eafef0 100644 --- a/cmd/run.go +++ b/cmd/run.go @@ -194,7 +194,7 @@ func (o *runOption) startMonitor() (err error) { execer := fakeruntime.NewDefaultExecerWithContext(o.context) go func(socketURL, plugin string) { - if err = execer.RunCommandWithIO(plugin, "", os.Stdout, os.Stderr, "server", "--socket", socketURL); err != nil { + if err = execer.RunCommandWithIO(plugin, "", os.Stdout, os.Stderr, nil, "server", "--socket", socketURL); err != nil { log.Printf("failed to start %s, error: %v", socketURL, err) } }(sockFile, monitorBin) diff --git a/cmd/server.go b/cmd/server.go index dd65760..cb6c8f2 100644 --- a/cmd/server.go +++ b/cmd/server.go @@ -207,6 +207,7 @@ func (o *serverOption) runE(cmd *cobra.Command, args []string) (err error) { } storeExtMgr := server.NewStoreExtManager(o.execer) + defer storeExtMgr.StopAll() remoteServer := server.NewRemoteServer(loader, remote.NewGRPCloaderFromStore(), secretServer, storeExtMgr, o.configDir) kinds, storeKindsErr := remoteServer.GetStoreKinds(ctx, nil) @@ -219,7 +220,7 @@ func (o *serverOption) runE(cmd *cobra.Command, args []string) (err error) { } clean := make(chan os.Signal, 1) - signal.Notify(clean, os.Interrupt, syscall.SIGINT, syscall.SIGTERM) + signal.Notify(clean, syscall.SIGINT, syscall.SIGTERM, syscall.SIGHUP, syscall.SIGQUIT) s := o.gRPCServer go func() { @@ -233,9 +234,9 @@ func (o *serverOption) runE(cmd *cobra.Command, args []string) (err error) { go func() { <-clean + log.Println("stopping the server") _ = lis.Close() _ = o.httpServer.Shutdown(ctx) - _ = storeExtMgr.StopAll() }() mux := runtime.NewServeMux(runtime.WithMetadata(server.MetadataStoreFunc)) diff --git a/cmd/service.go b/cmd/service.go index 6a12288..0a621a9 100644 --- a/cmd/service.go +++ b/cmd/service.go @@ -324,9 +324,9 @@ func (s *podmanService) Install() (output string, err error) { func (s *podmanService) Start() (output string, err error) { if s.exist() { - err = s.Execer.RunCommandWithIO(s.client, "", s.stdOut, s.errOut, "start", s.name) + err = s.Execer.RunCommandWithIO(s.client, "", s.stdOut, s.errOut, nil, "start", s.name) } else { - err = s.Execer.RunCommandWithIO(s.client, "", s.stdOut, s.errOut, s.getStartArgs()...) + err = s.Execer.RunCommandWithIO(s.client, "", s.stdOut, s.errOut, nil, s.getStartArgs()...) if err == nil { output, err = s.installService() } diff --git a/console/atest-ui/src/views/SecretManager.vue b/console/atest-ui/src/views/SecretManager.vue index cb14812..c6a858c 100644 --- a/console/atest-ui/src/views/SecretManager.vue +++ b/console/atest-ui/src/views/SecretManager.vue @@ -22,12 +22,12 @@ interface Secret { Value: string } -function loadStores() { +function loadSecrets() { API.GetSecrets((e) => { secrets.value = e.data }, UIAPI.ErrorTip) } -loadStores() +loadSecrets() function deleteSecret(name: string) { API.DeleteSecret(name, () => { @@ -35,7 +35,7 @@ function deleteSecret(name: string) { message: 'Deleted.', type: 'success' }) - loadStores() + loadSecrets() }, UIAPI.ErrorTip) } @@ -59,10 +59,10 @@ const rules = reactive>({ }) const submitForm = async (formEl: FormInstance | undefined) => { if (!formEl) return - await formEl.validate((valid: boolean, fields) => { + await formEl.validate((valid: boolean) => { if (valid) { UIAPI.CreateOrUpdateSecret(secret.value, createAction.value, () => { - loadStores() + loadSecrets() dialogVisible.value = false formEl.resetFields() }, creatingLoading) diff --git a/console/atest-ui/src/views/StoreManager.vue b/console/atest-ui/src/views/StoreManager.vue index b0052c0..d04fba3 100644 --- a/console/atest-ui/src/views/StoreManager.vue +++ b/console/atest-ui/src/views/StoreManager.vue @@ -1,10 +1,11 @@