TestChatAdvisorConfig_CanBeDisabledAfterEnabled pins the feature gate's "off" path. The downstream runtime gates the advisor tool and prompt guidance on Enabled, so a regression that silently drops or ignores Enabled: false on PUT would leave the feature stuck on.
(t *testing.T)
| 12978 | // prompt guidance on Enabled, so a regression that silently drops or |
| 12979 | // ignores Enabled: false on PUT would leave the feature stuck on. |
| 12980 | func TestChatAdvisorConfig_CanBeDisabledAfterEnabled(t *testing.T) { |
| 12981 | t.Parallel() |
| 12982 | |
| 12983 | ctx := testutil.Context(t, testutil.WaitLong) |
| 12984 | adminClient := newChatClient(t) |
| 12985 | coderdtest.CreateFirstUser(t, adminClient.Client) |
| 12986 | |
| 12987 | err := adminClient.UpdateChatAdvisorConfig(ctx, codersdk.AdvisorConfig{ |
| 12988 | Enabled: true, |
| 12989 | MaxUsesPerRun: 2, |
| 12990 | }) |
| 12991 | require.NoError(t, err) |
| 12992 | |
| 12993 | enabledResp, err := adminClient.GetChatAdvisorConfig(ctx) |
| 12994 | require.NoError(t, err) |
| 12995 | require.True(t, enabledResp.Enabled) |
| 12996 | |
| 12997 | err = adminClient.UpdateChatAdvisorConfig(ctx, codersdk.AdvisorConfig{ |
| 12998 | Enabled: false, |
| 12999 | }) |
| 13000 | require.NoError(t, err) |
| 13001 | |
| 13002 | disabledResp, err := adminClient.GetChatAdvisorConfig(ctx) |
| 13003 | require.NoError(t, err) |
| 13004 | require.False(t, disabledResp.Enabled) |
| 13005 | } |
| 13006 | |
| 13007 | func TestChatAdvisorConfig_ClampsNegativeStoredValues(t *testing.T) { |
| 13008 | t.Parallel() |
nothing calls this directly
no test coverage detected