(t *testing.T)
| 123 | } |
| 124 | |
| 125 | func TestConfigSetReportsMutationLifecycle(t *testing.T) { |
| 126 | t.Parallel() |
| 127 | |
| 128 | tests := []struct { |
| 129 | name string |
| 130 | path string |
| 131 | value string |
| 132 | wantLifecycle string |
| 133 | wantApplied bool |
| 134 | wantRestart bool |
| 135 | wantRestartScope string |
| 136 | }{ |
| 137 | { |
| 138 | name: "Should report daemon restart for persisted log config", |
| 139 | path: "log.level", |
| 140 | value: "debug", |
| 141 | wantLifecycle: "restart-required", |
| 142 | wantRestart: true, |
| 143 | wantRestartScope: "daemon", |
| 144 | }, |
| 145 | { |
| 146 | name: "Should report applied now for disabled skills", |
| 147 | path: "skills.disabled_skills", |
| 148 | value: `["agent-browser"]`, |
| 149 | wantLifecycle: "live", |
| 150 | wantApplied: true, |
| 151 | }, |
| 152 | } |
| 153 | |
| 154 | for _, tt := range tests { |
| 155 | t.Run(tt.name, func(t *testing.T) { |
| 156 | t.Parallel() |
| 157 | |
| 158 | deps := newTestDeps(t, &stubClient{}) |
| 159 | out, _, err := executeRootCommand(t, deps, "config", "set", tt.path, tt.value, "-o", "json") |
| 160 | if err != nil { |
| 161 | t.Fatalf("config set %s error = %v", tt.path, err) |
| 162 | } |
| 163 | var record configSetRecord |
| 164 | if err := json.Unmarshal([]byte(out), &record); err != nil { |
| 165 | t.Fatalf("json.Unmarshal(config set %s) error = %v", tt.path, err) |
| 166 | } |
| 167 | if record.Lifecycle != tt.wantLifecycle { |
| 168 | t.Fatalf("config set %s lifecycle = %q, want %q", tt.path, record.Lifecycle, tt.wantLifecycle) |
| 169 | } |
| 170 | if record.Applied != tt.wantApplied { |
| 171 | t.Fatalf("config set %s applied = %v, want %v", tt.path, record.Applied, tt.wantApplied) |
| 172 | } |
| 173 | if record.RestartRequired != tt.wantRestart { |
| 174 | t.Fatalf( |
| 175 | "config set %s restart_required = %v, want %v", |
| 176 | tt.path, |
| 177 | record.RestartRequired, |
| 178 | tt.wantRestart, |
| 179 | ) |
| 180 | } |
| 181 | if record.RestartScope != tt.wantRestartScope { |
| 182 | t.Fatalf("config set %s restart_scope = %q, want %q", tt.path, record.RestartScope, tt.wantRestartScope) |
nothing calls this directly
no test coverage detected