Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ go.work
# Build output
/bin/
/dist/
/release/

# IDE
.idea/
Expand All @@ -35,4 +36,7 @@ Thumbs.db

# Local config (for testing)
.prw/
prw

# Binary built in the repository root (not the cmd/prw sources)
/prw
/prw.exe
11 changes: 10 additions & 1 deletion internal/watcher/autowatch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,12 +286,21 @@ func TestRun_PicksUpAutoWatchEnabledWhileRunning(t *testing.T) {
s := &fakeSearcher{results: map[string]*github.SearchResult{config.AutoWatchMine: found(2)}}
s.prs = map[string]*github.PullRequest{"owner/repo/1": newPR(1, "sha1"), "owner/repo/2": newPR(2, "sha2")}

ctx, cancel := context.WithTimeout(context.Background(), 1500*time.Millisecond)
// Stop as soon as the search added PR 2, so a slow machine doesn't fail the test
// by missing a fixed deadline.
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
go func() {
time.Sleep(300 * time.Millisecond)
// `prw watch --mine` in another terminal.
config.Update(func(c *config.Config) error { c.EnableAutoWatch(config.AutoWatchMine); return nil })
for ctx.Err() == nil {
if c, err := config.Load(); err == nil && len(c.WatchedPRs) == 2 {
cancel()
return
}
time.Sleep(50 * time.Millisecond)
}
}()
New(s, cfg, &mockNotifier{}).Run(ctx)

Expand Down
Loading