module BuildBox.Command.Network
(PropNetwork(..))
where
import BuildBox.Build
import BuildBox.Command.File
import BuildBox.Command.System
type HostName = String
type URL = String
data PropNetwork
= HostReachable HostName
| UrlGettable URL
deriving Show
instance Testable PropNetwork where
test prop
= case prop of
HostReachable hostName
-> do check $ HasExecutable "ping"
(code, _, _) <- systemq $ "ping -o " ++ hostName
return $ code == ExitSuccess
UrlGettable url
-> do check $ HasExecutable "wget"
(code, _, _) <- systemq $ "wget -q --delete-after " ++ url
return $ code == ExitSuccess