package net import ( "testing" ) func TestScanZone(t *testing.T) { dzc := &DiscoveryZoneConfig{ ExcludePatterns: []string{`^br-`, `^docker`}, } zs := newZoneScan(dzc) defer func() { zs.Close() }() go scanZone(zs) Loop: for { select { case zone := <-zs.zoneChan: t.Logf("zone: %v", zone) case err := <-zs.logChan: t.Logf("log: %v", err) case <-zs.endChan: break Loop } } }