def METHOD_NAME(self):
    """Test failure when no shard is given and autodetect fails."""
    # Setting up non-matching IPs.
    _set_up_ip_addresses(["1.1.1.1", "0.0.0.2"])
    with self.assertRaises(ValueError):
        get_safe_shard("Service", None)