| // Copyright 2017 The Go Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| "golang.org/x/build/maintner/maintpb" |
| func TestGCSLogWakeup_Timeout(t *testing.T) { |
| testGCSLogWakeup(t, false) |
| func TestGCSLogWakeup_Activity(t *testing.T) { |
| testGCSLogWakeup(t, true) |
| func testGCSLogWakeup(t *testing.T, activity bool) { |
| waitc := make(chan bool, 1) |
| ctx, cancel := context.WithTimeout(context.Background(), 500*time.Millisecond) |
| waitc <- gl.waitSizeNot(ctx, 0) |
| if err := gl.Log(new(maintpb.Mutation)); err != nil { |
| t.Errorf("changed = %v; want %v", got, activity) |
| case <-time.After(2 * time.Second): |