Unified Agent + reusable Go agent core.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: skip missing managed channel tokens

Lyric 8d0f4075 37221a73

+51 -2
+51 -2
cmd/mistermorph/consolecmd/managed_runtime_test.go
··· 7 7 "github.com/spf13/viper" 8 8 ) 9 9 10 - func TestManagedRuntimeSupervisorReloadDisablesChannelMissingToken(t *testing.T) { 10 + func TestManagedRuntimeSupervisorReloadDisablesTelegramMissingToken(t *testing.T) { 11 11 local := &consoleLocalRuntime{managedRuntimeRunning: map[string]bool{}} 12 12 local.SetManagedRuntimeRunning("telegram", true) 13 13 supervisor := newManagedRuntimeSupervisor(local, false, false) ··· 26 26 if err != nil { 27 27 t.Fatalf("ReloadConfig() error = %v, want nil", err) 28 28 } 29 + if supervisor.configReader != next { 30 + t.Fatal("configReader was not updated") 31 + } 29 32 if got := supervisor.configReader.GetString("telegram.bot_token"); got != "" { 30 33 t.Fatalf("configReader.telegram.bot_token = %q, want empty", got) 31 34 } ··· 37 40 } 38 41 } 39 42 40 - func TestManagedRuntimeSupervisorSkipsSlackMissingToken(t *testing.T) { 43 + func TestManagedRuntimeSupervisorReloadDisablesSlackMissingTokens(t *testing.T) { 44 + cases := []struct { 45 + name string 46 + setNext func(*viper.Viper) 47 + }{ 48 + {name: "missing bot token"}, 49 + { 50 + name: "missing app token", 51 + setNext: func(v *viper.Viper) { 52 + v.Set("slack.bot_token", "xoxb-test") 53 + }, 54 + }, 55 + } 56 + 57 + for _, tc := range cases { 58 + t.Run(tc.name, func(t *testing.T) { 59 + local := &consoleLocalRuntime{managedRuntimeRunning: map[string]bool{}} 60 + local.SetManagedRuntimeRunning("slack", true) 61 + supervisor := newManagedRuntimeSupervisor(local, false, false) 62 + supervisor.parentCtx = context.Background() 63 + supervisor.configReader = viper.New() 64 + supervisor.kinds = []string{"slack"} 65 + 66 + next := viper.New() 67 + next.Set("console.managed_runtimes", []string{"slack"}) 68 + if tc.setNext != nil { 69 + tc.setNext(next) 70 + } 71 + 72 + err := supervisor.ReloadConfig(next) 73 + if err != nil { 74 + t.Fatalf("ReloadConfig() error = %v, want nil", err) 75 + } 76 + if supervisor.configReader != next { 77 + t.Fatal("configReader was not updated") 78 + } 79 + if len(supervisor.kinds) != 0 { 80 + t.Fatalf("kinds = %#v, want empty", supervisor.kinds) 81 + } 82 + if local.isManagedRuntimeRunning("slack") { 83 + t.Fatal("slack running = true, want false") 84 + } 85 + }) 86 + } 87 + } 88 + 89 + func TestManagedRuntimeSupervisorPrepareSkipsSlackMissingTokens(t *testing.T) { 41 90 cases := []struct { 42 91 name string 43 92 setNext func(*viper.Viper)