-
Notifications
You must be signed in to change notification settings - Fork 77
WIP: Add UCS obm service:Fix Unit Tests #429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| PowerState : 'On' | ||
| } | ||
| }, | ||
| testActions = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'testActions' is defined but never used.
| base.runInterfaceTestCases(); | ||
| }); | ||
| });` | ||
| ` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon.
| }); | ||
| base.runInterfaceTestCases(); | ||
| }); | ||
| });` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'template literal syntax' is only available in ES6 (use 'esversion: 6').
lib/jobs/ucs-discovery.js
Outdated
| id = [config.ucs, data.path]; | ||
| } | ||
|
|
||
| config['dn'] = data.path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
['dn'] is better written in dot notation.
Missing semicolon.
|
BUILD on-tasks #5 : FAILURE BUILD on-tasks #5 Error Logs ▼Test Name: UCS OBM Service base ObmService interface reboot() should call BaseObmService.run() with the correct options Error Details: Cannot read property 'findOne' of undefined Stack Trace: TypeError: Cannot read property 'findOne' of undefined at UcsObmServiceFactory.UcsObmService.run (lib/services/ucs-obm-service.js:9:4022) at UcsObmServiceFactory.UcsObmService._runInternal (lib/services/ucs-obm-service.js:9:3565) at UcsObmServiceFactory.UcsObmService.reboot (lib/services/ucs-obm-service.js:9:1911) at Context.<anonymous> (spec/lib/services/base-obm-services-spec.js:89:45)Test Name: UCS OBM Service base ObmService interface powerOn() should call BaseObmService.run() with the correct options Test Name: UCS OBM Service base ObmService interface powerOff() should call BaseObmService.run() with the correct options Test Name: UCS OBM Service base ObmService interface powerStatus() should call BaseObmService.run() with the correct options Test Name: UCS OBM Service base ObmService interface powerOn() should call BaseObmService.run() with the correct options Test Name: UCS OBM Service base ObmService interface powerOff() should call BaseObmService.run() with the correct options Test Name: UCS OBM Service base ObmService interface reboot() should call BaseObmService.run() with the correct options Test Name: UCS OBM Service base ObmService interface NMI() should call BaseObmService.run() with the correct options Test Name: UCS OBM Service base ObmService interface powerButton() should call BaseObmService.run() with the correct options Test Name: UCS OBM Service base ObmService interface powerStatus() should call BaseObmService.run() with the correct options |
c6e85ae to
1f47671
Compare
| }; | ||
|
|
||
| describe('base', function() { | ||
| var waterline |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon.
1f47671 to
809db3e
Compare
|
BUILD on-tasks #6 : FAILURE |
|
BUILD on-tasks #7 : FAILURE BUILD on-tasks #7 Error Logs ▼Test Name: Redfish Registries "before all" hook: start HTTP server Error Details: timeout of 5000ms exceeded. Ensure the done() callback is being called in this test. Stack Trace: Error: timeout of 5000ms exceeded. Ensure the done() callback is being called in this test.Test Name: Redfish TaskService "before all" hook: start HTTP server |
00c5fbb to
006646f
Compare
|
BUILD on-tasks #8 : FAILURE |
|
BUILD on-tasks #9 : FAILURE |
542116a to
fd41eff
Compare
|
BUILD on-tasks #10 : FAILURE BUILD on-tasks #10 Error Logs ▼Test Name: test_nodes_discovery Error Details: timeout waiting for task discovery -------------------- >> begin captured logging << -------------------- tests.api.v2_0.nodes_tests: INFO: Wait start time: 2017-03-21 10:31:15.731148 amqp: DEBUG: Start from server, version: 0.9, properties: {u'information': u'Licensed under the MPL. See http://www.rabbitmq.com/', u'product': u'RabbitMQ', u'copyright': u'Copyright (C) 2007-2013 GoPivotal, Inc.', u'capabilities': {u'exchange_exchange_bindings': True, u'connection.blocked': True, u'authentication_failure_close': True, u'basic.nack': True, u'consumer_priorities': True, u'consumer_cancel_notify': True, u'publisher_confirms': True}, u'platform': u'Erlang/OTP', u'version': u'3.2.4'}, mechanisms: [u'AMQPLAIN', u'PLAIN'], locales: [u'en_US'] amqp: DEBUG: Open OK! kombu: INFO: Starting AMQP worker -> graph.finished.*> amqp: DEBUG: Start from server, version: 0.9, properties: {u'information': u'Licensed under the MPL. See http://www.rabbitmq.com/', u'product': u'RabbitMQ', u'copyright': u'Copyright (C) 2007-2013 GoPivotal, Inc.', u'capabilities': {u'exchange_exchange_bindings': True, u'connection.blocked': True, u'authentication_failure_close': True, u'basic.nack': True, u'consumer_priorities': True, u'consumer_cancel_notify': True, u'publisher_confirms': True}, u'platform': u'Erlang/OTP', u'version': u'3.2.4'}, mechanisms: [u'AMQPLAIN', u'PLAIN'], locales: [u'en_US'] amqp: DEBUG: Open OK! kombu.mixins: INFO: Connected to amqp://guest:**@127.0.0.1:9091// amqp: DEBUG: using channel_id: 1 amqp: DEBUG: Channel open tests.api.v2_0.nodes_tests: INFO: { "duration": "0:01:56.258787", "graph_name": "Graph.SKU.Discovery", "route_id": "dede3e62-635d-4bdf-91b5-935302eb4c70", "status": "succeeded" } tests.api.v2_0.nodes_tests: INFO: { "duration": "0:01:58.527576", "graph_name": "Graph.SKU.Discovery", "route_id": "6c0ced0d-2826-48cd-aeaa-a6779a82f120", "status": "succeeded" } modules.worker: ERROR: subtask timeout after 1200 seconds, (id=discovery), stopping.. kombu: INFO: Stopping AMQP worker -> graph.finished.*> modules.worker: INFO: stopping subtask for discovery amqp: DEBUG: Closed channel #1 --------------------- >> end captured logging << --------------------- Stack Trace: File "/usr/lib/python2.7/unittest/case.py", line 331, in run testMethod() File "/usr/lib/python2.7/unittest/case.py", line 1043, in runTest self._testFunc() File "/home/jenkins/workspace/on-tasks/RackHD/test/.venv/on-build-config/local/lib/python2.7/site-packages/proboscis/case.py", line 296, in testng_method_mistake_capture_func compatability.capture_type_error(s_func) File "/home/jenkins/workspace/on-tasks/RackHD/test/.venv/on-build-config/local/lib/python2.7/site-packages/proboscis/compatability/exceptions_2_6.py", line 27, in capture_type_error func() File "/home/jenkins/workspace/on-tasks/RackHD/test/.venv/on-build-config/local/lib/python2.7/site-packages/proboscis/case.py", line 350, in func func(test_case.state.get_state()) File "/home/jenkins/workspace/on-tasks/RackHD/test/tests/api/v2_0/nodes_tests.py", line 126, in test_nodes_discovery message='timeout waiting for task {0}'.format(self.__task.id)) File "/home/jenkins/workspace/on-tasks/RackHD/test/.venv/on-build-config/local/lib/python2.7/site-packages/proboscis/asserts.py", line 67, in assert_false raise ASSERTION_ERROR(message) 'timeout waiting for task discovery\n-------------------- >> begin captured logging << --------------------\ntests.api.v2_0.nodes_tests: INFO: Wait start time: 2017-03-21 10:31:15.731148\namqp: DEBUG: Start from server, version: 0.9, properties: {u\'information\': u\'Licensed under the MPL. See http://www.rabbitmq.com/\', u\'product\': u\'RabbitMQ\', u\'copyright\': u\'Copyright (C) 2007-2013 GoPivotal, Inc.\', u\'capabilities\': {u\'exchange_exchange_bindings\': True, u\'connection.blocked\': True, u\'authentication_failure_close\': True, u\'basic.nack\': True, u\'consumer_priorities\': True, u\'consumer_cancel_notify\': True, u\'publisher_confirms\': True}, u\'platform\': u\'Erlang/OTP\', u\'version\': u\'3.2.4\'}, mechanisms: [u\'AMQPLAIN\', u\'PLAIN\'], locales: [u\'en_US\']\namqp: DEBUG: Open OK!\nkombu: INFO: Starting AMQP worker -> graph.finished.*>\namqp: DEBUG: Start from server, version: 0.9, properties: {u\'information\': u\'Licensed under the MPL. See http://www.rabbitmq.com/\', u\'product\': u\'RabbitMQ\', u\'copyright\': u\'Copyright (C) 2007-2013 GoPivotal, Inc.\', u\'capabilities\': {u\'exchange_exchange_bindings\': True, u\'connection.blocked\': True, u\'authentication_failure_close\': True, u\'basic.nack\': True, u\'consumer_priorities\': True, u\'consumer_cancel_notify\': True, u\'publisher_confirms\': True}, u\'platform\': u\'Erlang/OTP\', u\'version\': u\'3.2.4\'}, mechanisms: [u\'AMQPLAIN\', u\'PLAIN\'], locales: [u\'en_US\']\namqp: DEBUG: Open OK!\nkombu.mixins: INFO: Connected to amqp://guest:**@127.0.0.1:9091//\namqp: DEBUG: using channel_id: 1\namqp: DEBUG: Channel open\ntests.api.v2_0.nodes_tests: INFO: {\n "duration": "0:01:56.258787",\n "graph_name": "Graph.SKU.Discovery",\n "route_id": "dede3e62-635d-4bdf-91b5-935302eb4c70",\n "status": "succeeded"\n}\ntests.api.v2_0.nodes_tests: INFO: {\n "duration": "0:01:58.527576",\n "graph_name": "Graph.SKU.Discovery",\n "route_id": "6c0ced0d-2826-48cd-aeaa-a6779a82f120",\n "status": "succeeded"\n}\nmodules.worker: ERROR: subtask timeout after 1200 seconds, (id=discovery), stopping..\nkombu: INFO: Stopping AMQP worker -> graph.finished.*>\nmodules.worker: INFO: stopping subtask for discovery\namqp: DEBUG: Closed channel #1\n--------------------- >> end captured logging << ---------------------'Test Name: test_tag_create Stack Trace: Traceback (most recent call last): Test Name: get_sku_nodes Stack Trace: Traceback (most recent call last): Test Name: post_skupacks Stack Trace: Traceback (most recent call last): Test Name: test_get_chassis -------------------- >> begin captured logging << -------------------- |
|
BUILD on-tasks #11 : FAILURE |
|
test this please |
|
BUILD on-tasks #12 : FAILURE |
|
test this please |
lib/services/ucs-obm-service.js
Outdated
| @@ -0,0 +1,113 @@ | |||
| // Copyright 2016, EMC, Inc. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect copyright date
lib/services/ucs-obm-service.js
Outdated
| ); | ||
| di.annotate(UcsObmServiceFactory, | ||
| new di.Inject( | ||
| 'OBM.base', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add indent
| id = [config.ucs, data.path]; | ||
| } | ||
|
|
||
| config.dn = data.path; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change a better variable name, dn is too short and never tell anything.
lib/services/ucs-obm-service.js
Outdated
| UcsObmService.prototype.run = function (options) { | ||
| var self = this; | ||
| assert.object(options); | ||
| assert.string(options.action); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function run is designed to return a Promise either success or fail, but these assertion logic break the design. when assertion fails, it throws error rather than return a rejected Promise.
Usually, the good practice in our code is wrapping the assertion within Promise.try:
return Promise.try(function() {
assertion.object(option);
assertion.string(options.action);
})
.then(function() {
return waterline.nodes.findOne(....)
});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may copy this code from our existing code, but I want to say the existing code isn't always a good example
lib/services/ucs-obm-service.js
Outdated
| assert.object(options); | ||
| assert.string(options.action); | ||
| var action = options.action; | ||
| return waterline.nodes.findOne(this.options.nodeId) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you need nodeId here, then why not add an assertion for it, just like action?
| module.exports = UcsObmServiceFactory; | ||
|
|
||
| di.annotate(UcsObmServiceFactory, | ||
| new di.Provide('ucs-obm-service') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add the new obm service into schema https://github.com/RackHD/on-tasks/blob/master/lib/task-data/base-tasks/obm.js#L30, otherwise this obm will not pass the basic validation.
fd41eff to
a96e819
Compare
lib/services/ucs-obm-service.js
Outdated
| var url= "/power?" + "identifier=" + data.name + "&action=" + action; | ||
| return self.ucs.clientRequest(url, "POST"); | ||
| }); | ||
| }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon.
lib/services/ucs-obm-service.js
Outdated
| assert.object(options); | ||
| assert.string(options.action); | ||
| var action = options.action; | ||
| var nodeId = this.options.nodeId |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon.
|
BUILD on-tasks #15 : FAILURE |
|
test this please |
a96e819 to
af3aab8
Compare
lib/services/ucs-obm-service.js
Outdated
| assert.object(options); | ||
| assert.string(options.action); | ||
| var action = options.action; | ||
| var nodeId = this.options.nodeId; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use self rather than this. The anonymous function will has its own this context, it is not the same with self
af3aab8 to
d59f617
Compare
No description provided.