Skip to content

Commit

Permalink
Adding some more system events
Browse files Browse the repository at this point in the history
Change-Id: I2737e0f187ff49531e2dc40d46e21f35fbd50065
Reviewed-on: https://review.couchbase.org/c/testrunner/+/168891
Reviewed-by: Chanabasappa Ghali <chanabasappa.ghali@couchbase.com>
Tested-by: Sujay Gad <sujay.gad@couchbase.com>
  • Loading branch information
Sujay2611 committed Jan 18, 2022
1 parent aae6115 commit e570621
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 1 deletion.
3 changes: 2 additions & 1 deletion conf/eventing/eventing_system_events.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
eventing.eventing_system_events.EventingSystemEvents:
test_eventing_processes_system_events,nodes_init=4,services_init=kv-eventing-index-n1ql,dataset=default,groups=simple,reset_services=True,skip_cleanup=True,validate_system_event_logs=True
test_debugger_and_tracing_start_stop_system_events,nodes_init=4,services_init=kv-eventing-index-n1ql,dataset=default,groups=simple,reset_services=True,skip_cleanup=True,validate_system_event_logs=True
test_create_delete_import_export_eventing_functions_system_events,nodes_init=4,services_init=kv-eventing-index-n1ql,dataset=default,groups=simple,reset_services=True,skip_cleanup=True,validate_system_event_logs=True
test_create_delete_import_export_eventing_functions_system_events,nodes_init=4,services_init=kv-eventing-index-n1ql,dataset=default,groups=simple,reset_services=True,skip_cleanup=True,validate_system_event_logs=True
test_lifecycle_operations_system_events,nodes_init=4,services_init=kv-eventing-index-n1ql,dataset=default,groups=simple,reset_services=True,skip_cleanup=True,validate_system_event_logs=True
4 changes: 4 additions & 0 deletions constants/cb_constants/system_event_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ class Eventing(object):
DeleteFunction = 4104
ImportFunctions = 4105
ExportFunctions = 4106
DeployFunction = 4109
UndeployFunction = 4110
PauseFunction = 4111
ResumeFunction = 4112


class Analytics(object):
Expand Down
48 changes: 48 additions & 0 deletions lib/SystemEventLogLib/eventing_service_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,52 @@ def export_functions(node):
Event.Fields.SEVERITY: Event.Severity.INFO,
Event.Fields.SUB_COMPONENT: "eventing-producer",
Event.Fields.NODE_NAME: node
}

@staticmethod
def deploy_function(node, appname):
return {
Event.Fields.EVENT_ID: Eventing.DeployFunction,
Event.Fields.COMPONENT: Event.Component.EVENTING,
Event.Fields.DESCRIPTION: "Function deployed",
Event.Fields.SEVERITY: Event.Severity.INFO,
Event.Fields.SUB_COMPONENT: "eventing-producer",
Event.Fields.NODE_NAME: node,
Event.Fields.EXTRA_ATTRS: {"appName": appname}
}

@staticmethod
def undeploy_function(node, appname):
return {
Event.Fields.EVENT_ID: Eventing.UndeployFunction,
Event.Fields.COMPONENT: Event.Component.EVENTING,
Event.Fields.DESCRIPTION: "Function undeployed",
Event.Fields.SEVERITY: Event.Severity.INFO,
Event.Fields.SUB_COMPONENT: "eventing-producer",
Event.Fields.NODE_NAME: node,
Event.Fields.EXTRA_ATTRS: {"appName": appname}
}

@staticmethod
def resume_function(node, appname):
return {
Event.Fields.EVENT_ID: Eventing.ResumeFunction,
Event.Fields.COMPONENT: Event.Component.EVENTING,
Event.Fields.DESCRIPTION: "Function resumed",
Event.Fields.SEVERITY: Event.Severity.INFO,
Event.Fields.SUB_COMPONENT: "eventing-producer",
Event.Fields.NODE_NAME: node,
Event.Fields.EXTRA_ATTRS: {"appName": appname}
}

@staticmethod
def pause_function(node, appname):
return {
Event.Fields.EVENT_ID: Eventing.PauseFunction,
Event.Fields.COMPONENT: Event.Component.EVENTING,
Event.Fields.DESCRIPTION: "Function paused",
Event.Fields.SEVERITY: Event.Severity.INFO,
Event.Fields.SUB_COMPONENT: "eventing-producer",
Event.Fields.NODE_NAME: node,
Event.Fields.EXTRA_ATTRS: {"appName": appname}
}
21 changes: 21 additions & 0 deletions pytests/eventing/eventing_system_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,25 @@ def test_create_delete_import_export_eventing_functions_system_events(self):
global_vars.system_event_logs.add_event(
EventingServiceEvents.delete_function(self.eventing_node,
self.function_name))
self.system_events.validate(server=self.master)

def test_lifecycle_operations_system_events(self):
body = self.create_save_function_body(self.function_name,
self.handler_code)
self.deploy_function(body)
global_vars.system_event_logs.add_event(
EventingServiceEvents.deploy_function(self.eventing_node,
self.function_name))
self.pause_function(body)
global_vars.system_event_logs.add_event(
EventingServiceEvents.pause_function(self.eventing_node,
self.function_name))
self.resume_function(body)
global_vars.system_event_logs.add_event(
EventingServiceEvents.resume_function(self.eventing_node,
self.function_name))
self.undeploy_and_delete_function(body)
global_vars.system_event_logs.add_event(
EventingServiceEvents.undeploy_function(self.eventing_node,
self.function_name))
self.system_events.validate(server=self.master)

0 comments on commit e570621

Please sign in to comment.