()
| 126 | } |
| 127 | |
| 128 | func ExampleWatcher_watchWithProgressNotify() { |
| 129 | forUnitTestsRunInMockedContext(mockWatcher_watchWithProgressNotify, func() { |
| 130 | cli, err := clientv3.New(clientv3.Config{ |
| 131 | Endpoints: exampleEndpoints(), |
| 132 | DialTimeout: dialTimeout, |
| 133 | }) |
| 134 | if err != nil { |
| 135 | log.Fatal(err) |
| 136 | } |
| 137 | |
| 138 | rch := cli.Watch(context.Background(), "foo", clientv3.WithProgressNotify()) |
| 139 | closedch := make(chan bool) |
| 140 | go func() { |
| 141 | // This assumes that cluster is configured with frequent WatchProgressNotifyInterval |
| 142 | // e.g. WatchProgressNotifyInterval: 200 * time.Millisecond. |
| 143 | time.Sleep(time.Second) |
| 144 | err := cli.Close() |
| 145 | if err != nil { |
| 146 | log.Fatal(err) |
| 147 | } |
| 148 | close(closedch) |
| 149 | }() |
| 150 | wresp := <-rch |
| 151 | fmt.Println("wresp.IsProgressNotify:", wresp.IsProgressNotify()) |
| 152 | <-closedch |
| 153 | }) |
| 154 | |
| 155 | // TODO: Rather wresp.IsProgressNotify: true should be expected |
| 156 | |
| 157 | // Output: |
| 158 | // wresp.IsProgressNotify: true |
| 159 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…