@@ -797,13 +797,9 @@ func TestNotifyContextStop(t *testing.T) {
797
797
}
798
798
799
799
stop ()
800
- select {
801
- case <- c .Done ():
802
- if got := c .Err (); got != context .Canceled {
803
- t .Errorf ("c.Err() = %q, want %q" , got , context .Canceled )
804
- }
805
- case <- time .After (time .Second ):
806
- t .Errorf ("timed out waiting for context to be done after calling stop" )
800
+ <- c .Done ()
801
+ if got := c .Err (); got != context .Canceled {
802
+ t .Errorf ("c.Err() = %q, want %q" , got , context .Canceled )
807
803
}
808
804
}
809
805
@@ -818,13 +814,9 @@ func TestNotifyContextCancelParent(t *testing.T) {
818
814
}
819
815
820
816
cancelParent ()
821
- select {
822
- case <- c .Done ():
823
- if got := c .Err (); got != context .Canceled {
824
- t .Errorf ("c.Err() = %q, want %q" , got , context .Canceled )
825
- }
826
- case <- time .After (time .Second ):
827
- t .Errorf ("timed out waiting for parent context to be canceled" )
817
+ <- c .Done ()
818
+ if got := c .Err (); got != context .Canceled {
819
+ t .Errorf ("c.Err() = %q, want %q" , got , context .Canceled )
828
820
}
829
821
}
830
822
@@ -840,13 +832,9 @@ func TestNotifyContextPrematureCancelParent(t *testing.T) {
840
832
t .Errorf ("c.String() = %q, want %q" , got , want )
841
833
}
842
834
843
- select {
844
- case <- c .Done ():
845
- if got := c .Err (); got != context .Canceled {
846
- t .Errorf ("c.Err() = %q, want %q" , got , context .Canceled )
847
- }
848
- case <- time .After (time .Second ):
849
- t .Errorf ("timed out waiting for parent context to be canceled" )
835
+ <- c .Done ()
836
+ if got := c .Err (); got != context .Canceled {
837
+ t .Errorf ("c.Err() = %q, want %q" , got , context .Canceled )
850
838
}
851
839
}
852
840
@@ -868,13 +856,9 @@ func TestNotifyContextSimultaneousStop(t *testing.T) {
868
856
}()
869
857
}
870
858
wg .Wait ()
871
- select {
872
- case <- c .Done ():
873
- if got := c .Err (); got != context .Canceled {
874
- t .Errorf ("c.Err() = %q, want %q" , got , context .Canceled )
875
- }
876
- case <- time .After (time .Second ):
877
- t .Errorf ("expected context to be canceled" )
859
+ <- c .Done ()
860
+ if got := c .Err (); got != context .Canceled {
861
+ t .Errorf ("c.Err() = %q, want %q" , got , context .Canceled )
878
862
}
879
863
}
880
864
@@ -920,7 +904,6 @@ func TestSignalTrace(t *testing.T) {
920
904
if err := trace .Start (buf ); err != nil {
921
905
t .Fatalf ("[%d] failed to start tracing: %v" , i , err )
922
906
}
923
- time .After (1 * time .Microsecond )
924
907
trace .Stop ()
925
908
size := buf .Len ()
926
909
if size == 0 {
0 commit comments