$uname -smprv
Darwin 14.5.0 Darwin Kernel Version 14.5.0: Tue Apr 11 16:12:42 PDT 2017; root:xnu-2782.50.9.2.3~1/RELEASE_X86_64 x86_64 i386
$docker -v
Docker version 17.03.1-ce, build c6d412e
$git clone git clone https://github.com/Lab41/poseidon.git && cd poseidon/ && make docs
(Edit: sorry about the formatting, MD is confused by the content)
.
.
.
`=================================== FAILURES ===================================
_____________________________ test_PoseidonStorage _____________________________
def test_PoseidonStorage():
"""
test of PoseidonStorage class that
brokers communication with the mongodb container.
client.address tests connection to database and returns
tuple of host and port. default port for mongodb
is 27017.
"""
ps = PoseidonStorage()
assert isinstance(ps.client.address, type(()))
poseidon/poseidonStorage/test_poseidonStorage.py:77:
/usr/local/lib/python2.7/dist-packages/pymongo/mongo_client.py:614: in address
return self._server_property('address')
/usr/local/lib/python2.7/dist-packages/pymongo/mongo_client.py:580: in _server_property
writable_server_selector)
/usr/local/lib/python2.7/dist-packages/pymongo/topology.py:214: in select_server
address))
self = <pymongo.topology.Topology object at 0x7fe03c650890>
selector = <function writable_server_selector at 0x7fe044fb72a8>
server_selection_timeout = None, address = None
def select_servers(self,
selector,
server_selection_timeout=None,
address=None):
"""Return a list of Servers matching selector, or time out.
:Parameters:
- `selector`: function that takes a list of Servers and returns
a subset of them.
- `server_selection_timeout` (optional): maximum seconds to wait.
If not provided, the default value common.SERVER_SELECTION_TIMEOUT
is used.
- `address`: optional server address to select.
Calls self.open() if needed.
Raises exc:`ServerSelectionTimeoutError` after
`server_selection_timeout` if no matching servers are found.
"""
if server_selection_timeout is None:
server_timeout = self._settings.server_selection_timeout
else:
server_timeout = server_selection_timeout
with self._lock:
self._description.check_compatible()
now = _time()
end_time = now + server_timeout
server_descriptions = self._description.apply_selector(
selector, address)
while not server_descriptions:
# No suitable servers.
if server_timeout == 0 or now > end_time:
raise ServerSelectionTimeoutError(
self._error_message(selector))
E ServerSelectionTimeoutError: localhost:27017: [Errno 111] Connection refused
/usr/local/lib/python2.7/dist-packages/pymongo/topology.py:189: ServerSelectionTimeoutError
____________________________ test_db_database_names ____________________________
client = <pytest_falcon.plugin.Client object at 0x7fe03c621c90>
def test_db_database_names(client):
"""
tests retrieval of database names from
poseidonStorage.
"""
resp = client.get('/v1/storage')
assert resp.status == falcon.HTTP_OK
E AssertionError: assert '500 Internal Server Error' == '200 OK'
E - 500 Internal Server Error
E + 200 OK
poseidon/poseidonStorage/test_poseidonStorage.py:106: AssertionError
___________________________ test_db_collection_names ___________________________
client = <pytest_falcon.plugin.Client object at 0x7fe03c5c9f10>
def test_db_collection_names(client):
"""
tests retrieval of collection names for a
given database.
"""
resp = client.get('/v1/storage/local')
assert resp.status == falcon.HTTP_OK
E AssertionError: assert '500 Internal Server Error' == '200 OK'
E - 500 Internal Server Error
E + 200 OK
poseidon/poseidonStorage/test_poseidonStorage.py:116: AssertionError
___________________________ test_db_collection_count ___________________________
client = <pytest_falcon.plugin.Client object at 0x7fe03c6502d0>
def test_db_collection_count(client):
"""
tests retrieval of document count for
a given database and collection.
"""
resp = client.get('/v1/storage/local/startup_log')
assert resp.status == falcon.HTTP_OK
E AssertionError: assert '500 Internal Server Error' == '200 OK'
E - 500 Internal Server Error
E + 200 OK
poseidon/poseidonStorage/test_poseidonStorage.py:131: AssertionError
_____________________________ test_db_retrieve_doc _____________________________
client = <pytest_falcon.plugin.Client object at 0x7fe03c6503d0>
def test_db_retrieve_doc(client):
"""
tests retrieval of document from a
given database and collection.
If no document is found then error message
is returned.
"""
resp = client.get(
'/v1/storage/doc/local/startup_log/ffffffffffffffffffffffff')
assert resp.status == falcon.HTTP_OK
E AssertionError: assert '500 Internal Server Error' == '200 OK'
E - 500 Internal Server Error
E + 200 OK
poseidon/poseidonStorage/test_poseidonStorage.py:144: AssertionError
___________________________ test_db_collection_query ___________________________
client = <pytest_falcon.plugin.Client object at 0x7fe03c5c9110>
def test_db_collection_query(client):
"""
tests response from query of database.
response is a serialized dict with 'count'
and 'docs' fields.
"""
query = {}
query = json.dumps(query)
resp = client.get('/v1/storage/query/' + 'local/' + 'startup_log/' + query)
assert resp.status == falcon.HTTP_OK
E AssertionError: assert '500 Internal Server Error' == '200 OK'
E - 500 Internal Server Error
E + 200 OK
poseidon/poseidonStorage/test_poseidonStorage.py:160: AssertionError
_____________________________ test_db_add_one_doc ______________________________
client = <pytest_falcon.plugin.Client object at 0x7fe03c650790>
def test_db_add_one_doc(client):
"""
tests adding document to a database, then
tests retrieving added document from the database
using the returned id, then tests that the collection
inserted into is listed under the database collections.
"""
doc = {}
doc['node_ip'] = 'TEST'
doc['talked_to'] = {'machine_1': 2,
'machine_2': 1,
'machine_3': 1}
doc['recieved_from'] = {'machine_1': 1,
'machine_6': 3,
'machine_2': 2}
doc['packet_lengths'] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
doc['flow_id'] = '6a32984d2348e23894f3298'
doc['dns_records'] = ['0.0.0.0', '1.1.1.1']
doc['time_rec'] = {'first_sent': '0-0-0 00:00:00.000000',
'first_received': '0-0-0 00:00:00.000000',
'last_sent': '0-0-0 00:00:00.000000',
'last_received': '0-0-0 00:00:00.000000'}
# adds doc to db
uri = '/v1/storage/add_one_doc/' + 'test_poseidon_records/' + 'network_graph'
resp = client.post(uri, data=json.dumps(doc))
assert resp.status == falcon.HTTP_OK
E AssertionError: assert '500 Internal Server Error' == '200 OK'
E - 500 Internal Server Error
E + 200 OK
poseidon/poseidonStorage/test_poseidonStorage.py:196: AssertionError
____________________________ test_db_add_many_docs _____________________________
client = <pytest_falcon.plugin.Client object at 0x7fe03c524150>
def test_db_add_many_docs(client):
"""
tests inserting several docs into database.
encodes with bson for well-formatted url.
"""
doc_one = {}
doc_one['node_ip'] = '1.1.1.1'
doc_one['packet_lengths'] = [1, 1, 2]
doc_two = {}
doc_two['node_ip'] = '2.2.2.2'
doc_two['packet_lengths'] = [3, 5, 8]
doc_thr = {}
doc_thr['node_ip'] = '3.3.3.3'
doc_thr['packet_lengths'] = [13, 21, 34]
# insert 3 docs
docs = [doc_one, doc_two, doc_thr]
uri = '/v1/storage/add_many_docs/'+'test_poseidon_records/'+'network_graph/'
resp = client.post(uri, data=json.dumps(docs))
assert resp.status == falcon.HTTP_OK
E AssertionError: assert '500 Internal Server Error' == '200 OK'
E - 500 Internal Server Error
E + 200 OK
poseidon/poseidonStorage/test_poseidonStorage.py:263: AssertionError
____________________________ test_db_update_one_doc ____________________________
client = <pytest_falcon.plugin.Client object at 0x7fe03c650410>
def test_db_update_one_doc(client):
"""
tests updating nonexistent doc,
encodes filter and updated doc with
bson.
"""
filt = {'node_ip': '-1.-1.-1.-1'}
update = {'node_ip': '-1.-1.-1.-1', 'new_field': 101}
# non-existent document
filt = json.dumps(filt)
uri = '/v1/storage/update_one_doc/'+'test_poseidon_records/'+'network_graph/'+filt
resp = client.post(uri, data=json.dumps(update))
assert resp.status == falcon.HTTP_BAD_REQUEST
resp = json.loads(resp.body)
assert not resp['success']
# insert doc
doc = {'node_ip': 'GIRAFFE'}
uri = '/v1/storage/add_one_doc/' + 'test_poseidon_records/' + 'network_graph'
resp = client.post(uri, data=json.dumps(doc))
assert resp.status == falcon.HTTP_OK
E AssertionError: assert '500 Internal Server Error' == '200 OK'
E - 500 Internal Server Error
E + 200 OK
poseidon/poseidonStorage/test_poseidonStorage.py:297: AssertionError
===================== 9 failed, 2 passed in 271.80 seconds =====================
The command '/bin/sh -c py.test -v --ignore=poseidon/poseidonMain --ignore=poseidon/poseidonMonitor --ignore=poseidon/periodically --ignore=poseidon/mockController --ignore=collectors --ignore=plugins/ --cov=poseidon/poseidonStorage --cov-report term-missing --cov-config .coveragerc' returned a non-zero code: 1
make: *** [build] Error 1`