Implement logs model using Elasticsearch

- Implement logs model using Elasticsearch with tests
- Implement transition model using both elasticsearch and database model
- Add LOGS_MODEL configuration to choose which to use.

Co-authored-by: Sida Chen <sidchen@redhat.com>
Co-authored-by: Kenny Lee Sin Cheong <kenny.lee@redhat.com>
This commit is contained in:
Kenny Lee Sin Cheong 2019-01-21 16:33:32 -05:00 committed by Sida Chen
parent 40c0352dd1
commit 035541c6f2
20 changed files with 1282 additions and 38 deletions

View file

@ -1007,6 +1007,7 @@ class RegistryTestsMixin(object):
self.do_pull('public', 'newrepo', 'public', 'password', images=images, munge_shas=munged_shas)
# TODO(sidchen): Test logging to elastic search log model.
def test_push_pull_logging(self):
# Push a new repository.
self.do_push('public', 'newrepo', 'public', 'password')
@ -1034,6 +1035,7 @@ class RegistryTestsMixin(object):
self.assertEquals('public', logs[0]['performer']['name'])
# TODO(sidchen): Test logging to elastic search log model.
def test_push_pull_logging_byrobot(self):
# Lookup the robot's password.
self.conduct_api_login('devtable', 'password')
@ -1067,6 +1069,7 @@ class RegistryTestsMixin(object):
self.assertEquals('buynlarge+ownerbot', logs[0]['performer']['name'])
# TODO(sidchen): Test logging to elastic search log model.
def test_push_pull_logging_bytoken(self):
# Push the repository.
self.do_push('devtable', 'newrepo', 'devtable', 'password')
@ -1088,6 +1091,7 @@ class RegistryTestsMixin(object):
self.assertEquals('my-new-token', logs[0]['metadata']['token'])
# TODO(sidchen): Test logging to elastic search log model.
def test_push_pull_logging_byoauth(self):
# Push the repository.
self.do_push('devtable', 'newrepo', 'devtable', 'password')
@ -1109,6 +1113,7 @@ class RegistryTestsMixin(object):
self.assertEquals(1, logs[0]['metadata']['oauth_token_id'])
# TODO(sidchen): Test logging to elastic search log model.
def test_push_pull_logging_byclitoken(self):
# Push the repository.
self.do_push('devtable', 'newrepo', 'devtable', 'password')