@@ -20,6 +20,7 @@ import (
20
20
"errors"
21
21
"fmt"
22
22
"log"
23
+ "math/rand"
23
24
"reflect"
24
25
"strings"
25
26
"sync"
@@ -880,7 +881,7 @@ func Test_dynamicNesting(t *testing.T) {
880
881
for i := 0 ; i < 10 ; i ++ {
881
882
wg .Add (1 )
882
883
tree .Add (oversight.ChildProcessSpecification {
883
- Name : "child" ,
884
+ Name : fmt . Sprintf ( "child %d" , rand . Int63 ()) ,
884
885
Restart : oversight .Transient (),
885
886
Start : func (ctx context.Context ) error {
886
887
defer wg .Done ()
@@ -890,13 +891,13 @@ func Test_dynamicNesting(t *testing.T) {
890
891
select {
891
892
case <- ctx .Done ():
892
893
return ctx .Err ()
893
- case <- time .After (1 * time .Second ):
894
+ case <- time .After (100 * time .Millisecond ):
894
895
t .Log ("deleting" , realChildName )
895
896
_ = tree .Delete (realChildName )
896
897
return nil
897
898
}
898
899
},
899
- Shutdown : oversight .Timeout (1 * time .Second ),
900
+ Shutdown : oversight .Timeout (500 * time .Millisecond ),
900
901
})
901
902
}
902
903
return nil
@@ -907,6 +908,9 @@ func Test_dynamicNesting(t *testing.T) {
907
908
if err != nil && err != oversight .ErrNoChildProcessLeft {
908
909
t .Fatal ("unexpected error:" , err )
909
910
}
911
+ if err := tree .Start (context .Background ()); ! errors .Is (err , oversight .ErrNoChildProcessLeft ) {
912
+ t .Fatal ("expected error missing: %$v" , err )
913
+ }
910
914
}
911
915
912
916
func TestTree_shutdownOrder (t * testing.T ) {
0 commit comments