pr comments

This commit is contained in:
Alexander Wang 2023-11-07 10:43:19 -08:00
parent adb59ec470
commit c54ea05e27
No known key found for this signature in database
GPG key ID: D89FA31966BDBECE

View file

@ -578,7 +578,7 @@ layers: {
watchURL := waitLogs(ctx, stderr, urlRE) watchURL := waitLogs(ctx, stderr, urlRE)
if watchURL == "" { if watchURL == "" {
t.Error(errors.New(string(stderr.Bytes()))) t.Error(errors.New(stderr.String()))
} }
stderr.Reset() stderr.Reset()
@ -634,7 +634,7 @@ layers: {
watchURL := waitLogs(ctx, stderr, urlRE) watchURL := waitLogs(ctx, stderr, urlRE)
if watchURL == "" { if watchURL == "" {
t.Error(errors.New(string(stderr.Bytes()))) t.Error(errors.New(stderr.String()))
} }
stderr.Reset() stderr.Reset()
@ -688,7 +688,7 @@ layers: {
watchURL := waitLogs(ctx, stderr, urlRE) watchURL := waitLogs(ctx, stderr, urlRE)
if watchURL == "" { if watchURL == "" {
t.Error(errors.New(string(stderr.Bytes()))) t.Error(errors.New(stderr.String()))
} }
stderr.Reset() stderr.Reset()
@ -812,11 +812,12 @@ func getNumBoards(svg string) int {
func waitLogs(ctx context.Context, buf *bytes.Buffer, pattern *regexp.Regexp) string { func waitLogs(ctx context.Context, buf *bytes.Buffer, pattern *regexp.Regexp) string {
ticker := time.NewTicker(10 * time.Millisecond) ticker := time.NewTicker(10 * time.Millisecond)
defer ticker.Stop()
var match string var match string
for i := 0; i < 100 && match == ""; i++ { for i := 0; i < 100 && match == ""; i++ {
select { select {
case <-ticker.C: case <-ticker.C:
out := string(buf.Bytes()) out := buf.String()
match = pattern.FindString(out) match = pattern.FindString(out)
case <-ctx.Done(): case <-ctx.Done():
ticker.Stop() ticker.Stop()