Example #1
0
void host_object::test<9>()
{
    std::string hostStr = "google.com";
    LLHost host;
    host.setHostByName(hostStr);

    // reverse DNS will likely result in appending of some
    // sub-domain to the main hostname. so look for
    // the main domain name and not do the exact compare

    std::string hostname = host.getHostName();
    ensure("getHostName failed", hostname.find(hostStr) != std::string::npos);
}
Example #2
0
	void host_object::test<9>()
	{
		skip("this test is irreparably flaky");
//		skip("setHostByName(\"google.com\"); getHostName() -> (e.g.) \"yx-in-f100.1e100.net\"");
		// nat: is it reasonable to expect LLHost::getHostName() to echo
		// back something resembling the string passed to setHostByName()?
		//
		// If that's not even reasonable, would a round trip in the /other/
		// direction make more sense? (Call getHostName() for something with
		// known IP address; call setHostByName(); verify IP address)
		//
		// Failing that... is there a plausible way to test getHostName() and
		// setHostByName()? Hopefully without putting up a dummy local DNS
		// server?

		// monty: If you don't control the DNS server or the DNS configuration
		// for the test point then, no, none of these will necessarily be
		// reliable and may start to fail at any time. Forward translation
		// is subject to CNAME records and round-robin address assignment.
		// Reverse lookup is 1-to-many and is more and more likely to have
		// nothing to do with the forward translation.
		// 
		// So the test is increasingly meaningless on a real network.

		std::string hostStr = "lindenlab.com";
		LLHost host;
		host.setHostByName(hostStr);

		// reverse DNS will likely result in appending of some
		// sub-domain to the main hostname. so look for
		// the main domain name and not do the exact compare
		
		std::string hostname = host.getHostName();
		try
		{
			ensure("getHostName failed", hostname.find(hostStr) != std::string::npos);
		}
		catch (const std::exception&)
		{
			std::cerr << "set '" << hostStr << "'; reported '" << hostname << "'" << std::endl;
			throw;
		}
	}
	void host_object::test<9>()
	{
//		skip("setHostByName(\"google.com\"); getHostName() -> (e.g.) \"yx-in-f100.1e100.net\"");
		std::string hostStr = "linux.org";		
		LLHost host;
		host.setHostByName(hostStr);	

		// reverse DNS will likely result in appending of some
		// sub-domain to the main hostname. so look for
		// the main domain name and not do the exact compare
		
		std::string hostname = host.getHostName();
		try
		{
			ensure("getHostName failed", hostname.find(hostStr) != std::string::npos);
		}
		catch (const std::exception&)
		{
			std::cerr << "set '" << hostStr << "'; reported '" << hostname << "'" << std::endl;
			throw;
		}
	}