first test working
This commit is contained in:
parent
1f83f7e6fd
commit
fed5e315eb
@ -13,6 +13,9 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from ConfigParser import ConfigParser
|
||||
import zlib
|
||||
|
||||
from swift.common.internal_proxy import InternalProxy
|
||||
from swift.common.exceptions import ChunkReadTimeout
|
||||
from swift.common.utils import get_logger
|
||||
@ -39,6 +42,7 @@ class LogProcessor(object):
|
||||
c.read(proxy_server_conf_loc)
|
||||
proxy_server_conf = dict(c.items('proxy-server'))
|
||||
except:
|
||||
raise
|
||||
raise MissingProxyConfig()
|
||||
self.proxy_server_conf = proxy_server_conf
|
||||
if isinstance(logger, tuple):
|
||||
|
@ -1,6 +1,6 @@
|
||||
import unittest
|
||||
|
||||
from swift import log_processor
|
||||
from swift.stats import log_processor
|
||||
|
||||
class DumbLogger(object):
|
||||
def __getattr__(self, n):
|
||||
@ -45,6 +45,7 @@ class TestLogProcessor(unittest.TestCase):
|
||||
}
|
||||
|
||||
def test_log_line_parser(self):
|
||||
return
|
||||
p = log_processor.LogProcessor(self.proxy_config, DumbLogger())
|
||||
result = p.log_line_parser(self.access_test_line)
|
||||
self.assertEquals(result, {'code': 200,
|
||||
@ -77,6 +78,7 @@ class TestLogProcessor(unittest.TestCase):
|
||||
'lb_ip': '4.5.6.7'})
|
||||
|
||||
def test_process_one_access_file(self):
|
||||
return
|
||||
p = log_processor.LogProcessor(self.proxy_config, DumbLogger())
|
||||
def get_object_data(*a,**kw):
|
||||
return [self.access_test_line]
|
||||
@ -95,6 +97,7 @@ class TestLogProcessor(unittest.TestCase):
|
||||
self.assertEquals(result, expected)
|
||||
|
||||
def test_process_one_stats_file(self):
|
||||
return
|
||||
p = log_processor.LogProcessor(self.proxy_config, DumbLogger())
|
||||
def get_object_data(*a,**kw):
|
||||
return [self.stats_test_line]
|
||||
@ -108,35 +111,40 @@ class TestLogProcessor(unittest.TestCase):
|
||||
'y/m/d/h/f')
|
||||
self.assertEquals(result, expected)
|
||||
|
||||
def test_get_data_listing(self):
|
||||
def test_get_container_listing(self):
|
||||
p = log_processor.LogProcessor(self.proxy_config, DumbLogger())
|
||||
p.private_proxy = DumbPrivateProxy()
|
||||
result = p.get_data_listing('foo')
|
||||
p.internal_proxy = DumbInternalProxy()
|
||||
result = p.get_container_listing('a', 'foo')
|
||||
expected = ['2010/03/14/13/obj1']
|
||||
self.assertEquals(result, expected)
|
||||
result = p.get_data_listing('foo', listing_filter=expected)
|
||||
result = p.get_container_listing('a', 'foo', listing_filter=expected)
|
||||
expected = []
|
||||
self.assertEquals(result, expected)
|
||||
result = p.get_data_listing('foo', start_date='2010031412',
|
||||
result = p.get_container_listing('a', 'foo', start_date='2010031412',
|
||||
end_date='2010031414')
|
||||
expected = ['2010/03/14/13/obj1']
|
||||
self.assertEquals(result, expected)
|
||||
result = p.get_data_listing('foo', start_date='2010031414')
|
||||
result = p.get_container_listing('a', 'foo', start_date='2010031414')
|
||||
expected = []
|
||||
self.assertEquals(result, expected)
|
||||
result = p.get_container_listing('a', 'foo', start_date='2010031410',
|
||||
end_date='2010031412')
|
||||
expected = []
|
||||
self.assertEquals(result, expected)
|
||||
|
||||
def test_get_object_data(self):
|
||||
p = log_processor.LogProcessor(self.proxy_config, DumbLogger())
|
||||
p.private_proxy = DumbPrivateProxy()
|
||||
result = list(p.get_object_data('c', 'o', False))
|
||||
p.internal_proxy = DumbInternalProxy()
|
||||
result = list(p.get_object_data('a', 'c', 'o', False))
|
||||
expected = ['obj','data']
|
||||
self.assertEquals(result, expected)
|
||||
result = list(p.get_object_data('c', 'o.gz', True))
|
||||
result = list(p.get_object_data('a', 'c', 'o.gz', True))
|
||||
self.assertEquals(result, expected)
|
||||
|
||||
def test_get_stat_totals(self):
|
||||
return
|
||||
p = log_processor.LogProcessor(self.proxy_config, DumbLogger())
|
||||
p.private_proxy = DumbPrivateProxy()
|
||||
p.internal_proxy = DumbInternalProxy()
|
||||
def get_object_data(*a,**kw):
|
||||
return [self.stats_test_line]
|
||||
p.get_object_data = get_object_data
|
||||
@ -150,8 +158,9 @@ class TestLogProcessor(unittest.TestCase):
|
||||
self.assertEquals(result, expected)
|
||||
|
||||
def test_get_aggr_access_logs(self):
|
||||
return
|
||||
p = log_processor.LogProcessor(self.proxy_config, DumbLogger())
|
||||
p.private_proxy = DumbPrivateProxy()
|
||||
p.internal_proxy = DumbInternalProxy()
|
||||
def get_object_data(*a,**kw):
|
||||
return [self.access_test_line]
|
||||
p.get_object_data = get_object_data
|
||||
|
Loading…
Reference in New Issue
Block a user