| Giorgi Lekveishvili | 46743d4 | 2023-12-10 15:47:23 +0400 | [diff] [blame] | 1 | package tasks |
| 2 | |
| 3 | import ( |
| 4 | "context" |
| 5 | "net" |
| 6 | "testing" |
| 7 | "time" |
| 8 | ) |
| 9 | |
| 10 | func TestGoogle(t *testing.T) { |
| 11 | ctx, _ := context.WithTimeout(context.Background(), 30*time.Second) |
| 12 | d := NewDNSResolverTask( |
| 13 | "welcome.t5.lekva.me", |
| 14 | []net.IP{ |
| 15 | net.ParseIP("135.181.48.180"), |
| 16 | net.ParseIP("65.108.39.172"), |
| 17 | }, |
| 18 | ctx, |
| 19 | t.Logf, |
| 20 | ) |
| 21 | d.FinalizeSubtasks() |
| 22 | ch := make(chan struct{}) |
| 23 | d.OnDone(func(err error) { |
| 24 | if err != nil { |
| 25 | t.Logf("%s\n", err.Error()) |
| 26 | } else { |
| 27 | t.Logf("Dooone") |
| 28 | } |
| 29 | ch <- struct{}{} |
| 30 | }) |
| 31 | d.Start() |
| 32 | <-ch |
| 33 | } |