overflow_discovery/net/zone_test.go

36 lines
539 B
Go
Raw Normal View History

2017-10-20 09:09:07 +00:00
package net
import (
"log"
"testing"
"git.loafle.net/overflow/overflow_discovery/net/model"
)
func TestScanZone(t *testing.T) {
endChan := make(chan bool)
zoneChan := make(chan *model.DiscoveryZone, 4)
logChan := make(chan error, 4)
defer func() {
close(endChan)
close(zoneChan)
close(logChan)
}()
go ScanZone(endChan, zoneChan, logChan)
Loop:
for {
select {
case zone := <-zoneChan:
log.Printf("zone: %v", zone)
case err := <-logChan:
log.Printf("log: %v", err)
case <-endChan:
break Loop
}
}
}