(t *testing.T)
| 748 | } |
| 749 | |
| 750 | func TestWebSocketMultipleRepos(t *testing.T) { |
| 751 | t.Parallel() |
| 752 | |
| 753 | ctx := testutil.Context(t, testutil.WaitLong) |
| 754 | repoA := initTestRepo(t) |
| 755 | repoB := initTestRepo(t) |
| 756 | require.NoError(t, os.WriteFile(filepath.Join(repoA, "a.go"), []byte("package a\n"), 0o600)) |
| 757 | require.NoError(t, os.WriteFile(filepath.Join(repoB, "b.go"), []byte("package b\n"), 0o600)) |
| 758 | |
| 759 | ps := agentgit.NewPathStore() |
| 760 | chatID := uuid.New() |
| 761 | ps.AddPaths([]uuid.UUID{chatID}, []string{ |
| 762 | filepath.Join(repoA, "a.go"), |
| 763 | filepath.Join(repoB, "b.go"), |
| 764 | }) |
| 765 | |
| 766 | stream := dialGitWatchWithPathStore(t, ps, chatID) |
| 767 | ch := stream.Chan() |
| 768 | |
| 769 | msg := recvMsg(ctx, t, ch) |
| 770 | require.Equal(t, codersdk.WorkspaceAgentGitServerMessageTypeChanges, msg.Type) |
| 771 | require.Len(t, msg.Repositories, 2, "should include both repos") |
| 772 | |
| 773 | roots := map[string]bool{} |
| 774 | for _, r := range msg.Repositories { |
| 775 | roots[r.RepoRoot] = true |
| 776 | } |
| 777 | require.True(t, roots[repoA], "repo A missing") |
| 778 | require.True(t, roots[repoB], "repo B missing") |
| 779 | } |
| 780 | |
| 781 | func TestWebSocketIncrementalSubscribe(t *testing.T) { |
| 782 | t.Parallel() |
nothing calls this directly
no test coverage detected