refactor: remove unused scheduling and cache code
This commit is contained in:
@@ -57,12 +57,15 @@ func newRootCommand() *cobra.Command {
|
||||
}
|
||||
|
||||
func newAgentCommand() *cobra.Command {
|
||||
cfg := config.FromEnv()
|
||||
cfg, configErr := config.FromEnv()
|
||||
var realCall bool
|
||||
cmd := &cobra.Command{
|
||||
Use: "agent",
|
||||
Short: "run the file-backed Agent process",
|
||||
RunE: func(_ *cobra.Command, _ []string) error {
|
||||
if configErr != nil {
|
||||
return configErr
|
||||
}
|
||||
if realCall {
|
||||
return runCallOnce(cfg)
|
||||
}
|
||||
@@ -469,13 +472,16 @@ func openDispatcherStore(cfg config.Config) (*store.Store, error) {
|
||||
}
|
||||
|
||||
func newDispatcherCommand() *cobra.Command {
|
||||
cfg := config.FromEnv()
|
||||
cfg, configErr := config.FromEnv()
|
||||
var configFile string
|
||||
var once bool
|
||||
cmd := &cobra.Command{
|
||||
Use: "dispatcher",
|
||||
Short: "run the single-active Dispatcher process",
|
||||
RunE: func(cmd *cobra.Command, _ []string) error {
|
||||
if configErr != nil {
|
||||
return configErr
|
||||
}
|
||||
if err := cfg.LoadDispatcherFile(configFile); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"git.ipao.vip/rogee/go-sip/contracts"
|
||||
@@ -18,6 +19,15 @@ func TestRootHasExplicitRoles(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestAgentRejectsInvalidMediaPortEnvironment(t *testing.T) {
|
||||
t.Setenv("AGENT_CALL_MEDIA_PORT", "invalid")
|
||||
root := newRootCommand()
|
||||
root.SetArgs([]string{"agent"})
|
||||
if err := root.Execute(); err == nil || !strings.Contains(err.Error(), "AGENT_CALL_MEDIA_PORT") {
|
||||
t.Fatalf("expected invalid port error, got %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWriteResultIsJSON(t *testing.T) {
|
||||
var b bytes.Buffer
|
||||
data, err := marshalResultForTest(map[string]string{"status": "ok"})
|
||||
|
||||
@@ -11,12 +11,15 @@ import (
|
||||
)
|
||||
|
||||
func newUploadRetryCommand() *cobra.Command {
|
||||
cfg := config.FromEnv()
|
||||
cfg, configErr := config.FromEnv()
|
||||
var uploadID, requestID, path string
|
||||
cmd := &cobra.Command{
|
||||
Use: "upload-retry", Short: "explicitly request one new grant for an unsuccessful upload; never dial",
|
||||
Args: cobra.NoArgs,
|
||||
RunE: func(cmd *cobra.Command, _ []string) (returnErr error) {
|
||||
if configErr != nil {
|
||||
return configErr
|
||||
}
|
||||
if uploadID == "" || requestID == "" || path == "" {
|
||||
return errors.New("--upload-id, --request-id and --file are required")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user