Skip to content

Conversation

@AlliumApotheosis
Copy link
Contributor

@AlliumApotheosis AlliumApotheosis commented Mar 29, 2016

@RackHD/corecommitters @heckj
Added a job for executing arbitrary commands over ssh and cataloging the results. Additionally, refactored linux catalog/command jobs into a command-util which also supports the ssh-job
requires RackHD/on-core#116


if (!_.contains(self.acceptedCodes, sshData.exitCode)) {
reject(sshData);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not an exclusive if block, if/else instead?

@JenkinsRHD
Copy link
Contributor

*** BUILD #439 ***
Test Name: ssh-job catalogUserTasks should use the command parser to parse and array of tasks andreturn a Promise for catalogging them
Error Details: Object #<Object> has no method 'parseUnknownTasks'
Stack Trace: TypeError: Object #<Object> has no method 'parseUnknownTasks'
    at SshJob.catalogUserTasks (lib/jobs/ssh-job.js:9:3742)
    at Context.<anonymous> (spec/lib/jobs/ssh-job-spec.js:187:27)

Test Name: ssh-job catalogUserTasks should catalog only marked tasks
Error Details: Object #<Object> has no method 'parseUnknownTasks'
Stack Trace: TypeError: Object #<Object> has no method 'parseUnknownTasks'
    at SshJob.catalogUserTasks (lib/jobs/ssh-job.js:9:3742)
    at Context.<anonymous> (spec/lib/jobs/ssh-job-spec.js:195:27)

Test Name: ssh-job catalogUserTasks should not catalog tasks that could not be parsed
Error Details: Object #<Object> has no method 'parseUnknownTasks'
Stack Trace: TypeError: Object #<Object> has no method 'parseUnknownTasks'
    at SshJob.catalogUserTasks (lib/jobs/ssh-job.js:9:3742)
    at Context.<anonymous> (spec/lib/jobs/ssh-job-spec.js:203:27)

Test Name: Task cancellation/completion of task should cancel
Error Details: expected 'TaskCancellationError: test error\n    at Context.<anonymous> (/var/lib/jenkins/jobs/on-tasks/workspace/build/spec/lib/task-spec.js:375:29)\n    at callFn (/var/lib/jenkins/jobs/on-tasks/workspace/build/node_modules/mocha/lib/runnable.js:315:21)\n    at Test.Runnable.run (/var/lib/jenkins/jobs/on-tasks/workspace/build/node_modules/mocha/lib/runnable.js:308:7)\n    at Runner.runTest (/var/lib/jenkins/jobs/on-tasks/workspace/build/node_modules/mocha/lib/runner.js:422:10)\n    at /var/lib/jenkins/jobs/on-tasks/workspace/build/node_modules/mocha/lib/runner.js:533:12\n    at next (/var/lib/jenkins/jobs/on-tasks/workspace/build/node_modules/mocha/lib/runner.js:342:14)\n    at /var/lib/jenkins/jobs/on-tasks/workspace/build/node_modules/mocha/lib/runner.js:352:7\n    at next (/var/lib/jenkins/jobs/on-tasks/workspace/build/node_modules/mocha/lib/runner.js:284:14)\n    at Object._onImmediate (/var/lib/jenkins/jobs/on-tasks/workspace/build/node_modules/mocha/lib/runner.js:320:5)\n    at processImmediate [as _immediateCallback] (timers.js:330:15)' to equal { Object (message, name, ...) }
Stack Trace:     at spec/lib/task-spec.js:388:43
    at tryCatcher (node_modules/on-core/node_modules/bluebird/js/main/util.js:26:23)
    at Promise._settlePromiseFromHandler (node_modules/on-core/node_modules/bluebird/js/main/promise.js:507:31)
    at Promise._settlePromiseAt (node_modules/on-core/node_modules/bluebird/js/main/promise.js:581:18)
    at Promise._settlePromises (node_modules/on-core/node_modules/bluebird/js/main/promise.js:697:14)
    at Async._drainQueue (node_modules/on-core/node_modules/bluebird/js/main/async.js:123:16)
    at Async._drainQueues (node_modules/on-core/node_modules/bluebird/js/main/async.js:133:10)
    at Async.drainQueues (node_modules/on-core/node_modules/bluebird/js/main/async.js:15:14)

Test Name: Task cancellation/completion of task should timeout
Error Details: expected 'TaskTimeoutError: test timeout error\n    at Context.<anonymous> (/var/lib/jenkins/jobs/on-tasks/workspace/build/spec/lib/task-spec.js:395:29)\n    at callFn (/var/lib/jenkins/jobs/on-tasks/workspace/build/node_modules/mocha/lib/runnable.js:315:21)\n    at Test.Runnable.run (/var/lib/jenkins/jobs/on-tasks/workspace/build/node_modules/mocha/lib/runnable.js:308:7)\n    at Runner.runTest (/var/lib/jenkins/jobs/on-tasks/workspace/build/node_modules/mocha/lib/runner.js:422:10)\n    at /var/lib/jenkins/jobs/on-tasks/workspace/build/node_modules/mocha/lib/runner.js:533:12\n    at next (/var/lib/jenkins/jobs/on-tasks/workspace/build/node_modules/mocha/lib/runner.js:342:14)\n    at /var/lib/jenkins/jobs/on-tasks/workspace/build/node_modules/mocha/lib/runner.js:352:7\n    at next (/var/lib/jenkins/jobs/on-tasks/workspace/build/node_modules/mocha/lib/runner.js:284:14)\n    at Object._onImmediate (/var/lib/jenkins/jobs/on-tasks/workspace/build/node_modules/mocha/lib/runner.js:320:5)\n    at processImmediate [as _immediateCallback] (timers.js:330:15)' to equal { Object (message, name, ...) }
Stack Trace:     at spec/lib/task-spec.js:408:43
    at tryCatcher (node_modules/on-core/node_modules/bluebird/js/main/util.js:26:23)
    at Promise._settlePromiseFromHandler (node_modules/on-core/node_modules/bluebird/js/main/promise.js:507:31)
    at Promise._settlePromiseAt (node_modules/on-core/node_modules/bluebird/js/main/promise.js:581:18)
    at Promise._settlePromises (node_modules/on-core/node_modules/bluebird/js/main/promise.js:697:14)
    at Async._drainQueue (node_modules/on-core/node_modules/bluebird/js/main/async.js:123:16)
    at Async._drainQueues (node_modules/on-core/node_modules/bluebird/js/main/async.js:133:10)
    at Async.drainQueues (node_modules/on-core/node_modules/bluebird/js/main/async.js:15:14)

Test Name: Task cancellation/completion of task should cancel on failure to instantiate a job
Error Details: expected 'Error: test instantiate job error\n    at Context.<anonymous> (/var/lib/jenkins/jobs/on-tasks/workspace/build/spec/lib/task-spec.js:414:29)\n    at callFn (/var/lib/jenkins/jobs/on-tasks/workspace/build/node_modules/mocha/lib/runnable.js:315:21)\n    at Test.Runnable.run (/var/lib/jenkins/jobs/on-tasks/workspace/build/node_modules/mocha/lib/runnable.js:308:7)\n    at Runner.runTest (/var/lib/jenkins/jobs/on-tasks/workspace/build/node_modules/mocha/lib/runner.js:422:10)\n    at /var/lib/jenkins/jobs/on-tasks/workspace/build/node_modules/mocha/lib/runner.js:533:12\n    at next (/var/lib/jenkins/jobs/on-tasks/workspace/build/node_modules/mocha/lib/runner.js:342:14)\n    at /var/lib/jenkins/jobs/on-tasks/workspace/build/node_modules/mocha/lib/runner.js:352:7\n    at next (/var/lib/jenkins/jobs/on-tasks/workspace/build/node_modules/mocha/lib/runner.js:284:14)\n    at Object._onImmediate (/var/lib/jenkins/jobs/on-tasks/workspace/build/node_modules/mocha/lib/runner.js:320:5)\n    at processImmediate [as _immediateCallback] (timers.js:330:15)' to equal [Error: test instantiate job error]
Stack Trace:     at spec/lib/task-spec.js:421:43
    at tryCatcher (node_modules/on-core/node_modules/bluebird/js/main/util.js:26:23)
    at Promise._settlePromiseFromHandler (node_modules/on-core/node_modules/bluebird/js/main/promise.js:507:31)
    at Promise._settlePromiseAt (node_modules/on-core/node_modules/bluebird/js/main/promise.js:581:18)
    at Promise._settlePromises (node_modules/on-core/node_modules/bluebird/js/main/promise.js:697:14)
    at Async._drainQueue (node_modules/on-core/node_modules/bluebird/js/main/async.js:123:16)
    at Async._drainQueues (node_modules/on-core/node_modules/bluebird/js/main/async.js:133:10)
    at Async.drainQueues (node_modules/on-core/node_modules/bluebird/js/main/async.js:15:14)

});
ssh.connect({
host: sshSettings.host,
port: 22,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be another input like "sshSettings.port" with a default to 22?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seconded.

@yyscamper
Copy link
Contributor

👎 because I see a lot duplicated code between this job and linux-command, linux-catalog job, this need a code refactor

@yyscamper
Copy link
Contributor

Meanwhile, @VulpesArtificem could you please add some description and user cases for the PR in future, so reviewer can understand your design before digging into the code. I guess the ssh job is used for the inband mangement, right?


it('should take an arbitrary number of parsed tasks and return '+
'an array of promises to catalog them', function() {
var tasks = Array(5).fill({source: 'test', data:'stdout', store: true});

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing 'new' prefix when invoking a constructor.

var tasks = [
{source: 'test', data:'stdout', store: true}
{source: 'test', data:'stdout', store: true}
{source: 'test', data:'stdout', store: true}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected ')' and instead saw '{'.
Missing semicolon.
Label 'source' on test statement.
Unrecoverable syntax error. (62% scanned).

@benbp
Copy link
Contributor

benbp commented Apr 18, 2016

test this please

@JenkinsRHD
Copy link
Contributor

*** BUILD #552 ***

@yyscamper
Copy link
Contributor

👍

@yyscamper
Copy link
Contributor

test this please

1 similar comment
@AlliumApotheosis
Copy link
Contributor Author

test this please

ssh.on('ready', function() {
ssh.exec(cmdObj.cmd, function(err, stream) {
if (err) { reject(err); }
stream.on('close', function(code) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we going to get fatal errors if we don't handle 'error' on this stream object?

@benbp
Copy link
Contributor

benbp commented Apr 22, 2016

@VulpesArtificem can you add a quick test for the dpkg -l parser?

@benbp
Copy link
Contributor

benbp commented Apr 22, 2016

Otherwise, 👍

@JenkinsRHD
Copy link
Contributor

*** BUILD #589 ***
Test Name: test_node_workflows_del_active
Error Details: (500)
Reason: Internal Server Error
HTTP response headers: HTTPHeaderDict({'Content-Length': '55', 'X-Powered-By': 'Express', 'Connection': 'keep-alive', 'ETag': 'W/"37-EwYudpiSIPXySNazhkLbsw"', 'Date': 'Fri, 22 Apr 2016 16:46:41 GMT', 'Access-Control-Allow-Origin': '*', 'Content-Type': 'application/json; charset=utf-8'})
HTTP response body: {"message":"Failed to cancel 571a556f06ef7595a572cc2c"}

-------------------- >> begin captured logging << --------------------
urllib3.connectionpool: WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', BadStatusLine("''",))': /api/1.1/nodes
urllib3.connectionpool: INFO: Starting new HTTP connection (11): localhost
--------------------- >> 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 "/tmp/.venv/local/lib/python2.7/site-packages/proboscis/case.py", line 296, in testng_method_mistake_capture_func
    compatability.capture_type_error(s_func)
  File "/tmp/.venv/local/lib/python2.7/site-packages/proboscis/compatability/exceptions_2_6.py", line 27, in capture_type_error
    func()
  File "/tmp/.venv/local/lib/python2.7/site-packages/proboscis/case.py", line 350, in func
    func(test_case.state.get_state())
  File "/var/lib/jenkins/jobs/on-tasks/workspace/RackHD/test/tests/api/v1_1/nodes_tests.py", line 376, in test_node_workflows_del_active
    raise e
'(500)\nReason: Internal Server Error\nHTTP response headers: HTTPHeaderDict({\'Content-Length\': \'55\', \'X-Powered-By\': \'Express\', \'Connection\': \'keep-alive\', \'ETag\': \'W/"37-EwYudpiSIPXySNazhkLbsw"\', \'Date\': \'Fri, 22 Apr 2016 16:46:41 GMT\', \'Access-Control-Allow-Origin\': \'*\', \'Content-Type\': \'application/json; charset=utf-8\'})\nHTTP response body: {"message":"Failed to cancel 571a556f06ef7595a572cc2c"}\n\n-------------------- >> begin captured logging << --------------------\nurllib3.connectionpool: WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by \'ProtocolError(\'Connection aborted.\', BadStatusLine("\'\'",))\': /api/1.1/nodes\nurllib3.connectionpool: INFO: Starting new HTTP connection (11): localhost\n--------------------- >> end captured logging << ---------------------'

Test Name: pollers_data_get
Error Details: Condition was True.
Stack Trace: Traceback (most recent call last):
  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 "/tmp/.venv/local/lib/python2.7/site-packages/proboscis/case.py", line 296, in testng_method_mistake_capture_func
    compatability.capture_type_error(s_func)
  File "/tmp/.venv/local/lib/python2.7/site-packages/proboscis/compatability/exceptions_2_6.py", line 27, in capture_type_error
    func()
  File "/tmp/.venv/local/lib/python2.7/site-packages/proboscis/case.py", line 350, in func
    func(test_case.state.get_state())
  File "/var/lib/jenkins/jobs/on-tasks/workspace/RackHD/test/tests/api/v2_0/pollers_tests.py", line 157, in pollers_data_get
    assert_false(poller.get('lastFinished', False))
  File "/tmp/.venv/local/lib/python2.7/site-packages/proboscis/asserts.py", line 67, in assert_false
    raise ASSERTION_ERROR(message)
AssertionError: Condition was True.


Test Name: test_tag_create
Error Details: 'System Information'
-------------------- >> begin captured logging << --------------------
tests.api.v2_0.tags_tests: INFO: {'rules': [{'path': 'dmi.System Information.Manufacturer', 'equals': u'EMC'}], 'name': u'571a551b7641683708fad999'}
--------------------- >> 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 "/tmp/.venv/local/lib/python2.7/site-packages/proboscis/case.py", line 296, in testng_method_mistake_capture_func
    compatability.capture_type_error(s_func)
  File "/tmp/.venv/local/lib/python2.7/site-packages/proboscis/compatability/exceptions_2_6.py", line 27, in capture_type_error
    func()
  File "/tmp/.venv/local/lib/python2.7/site-packages/proboscis/case.py", line 350, in func
    func(test_case.state.get_state())
  File "/var/lib/jenkins/jobs/on-tasks/workspace/RackHD/test/tests/api/v2_0/tags_tests.py", line 35, in test_tag_create
    "rules":[{"equals": updated_catalog[0]["data"]["System Information"]["Manufacturer"],
"'System Information'\n-------------------- >> begin captured logging << --------------------\ntests.api.v2_0.tags_tests: INFO: {'rules': [{'path': 'dmi.System Information.Manufacturer', 'equals': u'EMC'}], 'name': u'571a551b7641683708fad999'}\n--------------------- >> end captured logging << ---------------------"

@benbp
Copy link
Contributor

benbp commented Apr 22, 2016

👍

@JenkinsRHD
Copy link
Contributor

*** BUILD #592 ***
Test Name: test_get_chassis
Error Details: (404)
Reason: Not Found
HTTP response headers: HTTPHeaderDict({'Content-Length': '741', 'X-Powered-By': 'Express', 'Connection': 'keep-alive', 'ETag': 'W/"2e5-QhNDvdW4+8T3R+Rymd23mg"', 'Date': 'Fri, 22 Apr 2016 19:09:41 GMT', 'Access-Control-Allow-Origin': '*', 'Content-Type': 'application/json; charset=utf-8'})
HTTP response body: {"error":{"code":"Base.1.0.GeneralError","message":"A general error has occurred. See ExtendedInfo for more information.","@Message.ExtendedInfo":[{"@odata.type":"#Message.1.0.0.Message","MessageId":"Base.1.0.Messages.InvalidObject","Description":"Indicates that the object in question is invalid according to the implementation.  Examples include a firmware update malformed URI.","Message":"The object at %1 is invalid.","Resolution":"Either the object is malformed or the URI is not correct.  Correct the condition and resubmit the request if it failed.","Severity":"Critical"},{"MessageId":"RackHD.1.0.DetailedErrorMessage","Message":"No Catalogs Found for Source (ohai).","Description":"Contains the detailed error message contents"}]}}

-------------------- >> begin captured logging << --------------------
tests.api.redfish_1_0.chassis_tests: INFO: 571a7611570ef23208be51dd
tests.api.redfish_1_0.chassis_tests: INFO: FC6PL142600004
tests.api.redfish_1_0.chassis_tests: INFO: 571a761c570ef23208be51e9
--------------------- >> 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 "/tmp/.venv/local/lib/python2.7/site-packages/proboscis/case.py", line 296, in testng_method_mistake_capture_func
    compatability.capture_type_error(s_func)
  File "/tmp/.venv/local/lib/python2.7/site-packages/proboscis/compatability/exceptions_2_6.py", line 27, in capture_type_error
    func()
  File "/tmp/.venv/local/lib/python2.7/site-packages/proboscis/case.py", line 350, in func
    func(test_case.state.get_state())
  File "/var/lib/jenkins/jobs/on-tasks/workspace/RackHD/test/tests/api/redfish_1_0/chassis_tests.py", line 47, in test_get_chassis
    redfish().get_chassis(dataId)
  File "/tmp/.venv/local/lib/python2.7/site-packages/on_http_redfish_1_0/apis/redfishv_api.py", line 343, in get_chassis
    callback=params.get('callback'))
  File "/tmp/.venv/local/lib/python2.7/site-packages/on_http_redfish_1_0/api_client.py", line 322, in call_api
    response_type, auth_settings, callback)
  File "/tmp/.venv/local/lib/python2.7/site-packages/on_http_redfish_1_0/api_client.py", line 149, in __call_api
    post_params=post_params, body=body)
  File "/tmp/.venv/local/lib/python2.7/site-packages/on_http_redfish_1_0/api_client.py", line 342, in request
    headers=headers)
  File "/tmp/.venv/local/lib/python2.7/site-packages/on_http_redfish_1_0/rest.py", line 184, in GET
    query_params=query_params)
  File "/tmp/.venv/local/lib/python2.7/site-packages/on_http_redfish_1_0/rest.py", line 177, in request
    raise ApiException(http_resp=r)
'(404)\nReason: Not Found\nHTTP response headers: HTTPHeaderDict({\'Content-Length\': \'741\', \'X-Powered-By\': \'Express\', \'Connection\': \'keep-alive\', \'ETag\': \'W/"2e5-QhNDvdW4+8T3R+Rymd23mg"\', \'Date\': \'Fri, 22 Apr 2016 19:09:41 GMT\', \'Access-Control-Allow-Origin\': \'*\', \'Content-Type\': \'application/json; charset=utf-8\'})\nHTTP response body: {"error":{"code":"Base.1.0.GeneralError","message":"A general error has occurred. See ExtendedInfo for more information.","@Message.ExtendedInfo":[{"@odata.type":"#Message.1.0.0.Message","MessageId":"Base.1.0.Messages.InvalidObject","Description":"Indicates that the object in question is invalid according to the implementation.  Examples include a firmware update malformed URI.","Message":"The object at %1 is invalid.","Resolution":"Either the object is malformed or the URI is not correct.  Correct the condition and resubmit the request if it failed.","Severity":"Critical"},{"MessageId":"RackHD.1.0.DetailedErrorMessage","Message":"No Catalogs Found for Source (ohai).","Description":"Contains the detailed error message contents"}]}}\n\n-------------------- >> begin captured logging << --------------------\ntests.api.redfish_1_0.chassis_tests: INFO: 571a7611570ef23208be51dd\ntests.api.redfish_1_0.chassis_tests: INFO: FC6PL142600004\ntests.api.redfish_1_0.chassis_tests: INFO: 571a761c570ef23208be51e9\n--------------------- >> end captured logging << ---------------------'

Test Name: test_tag_create
Error Details: 'System Information'
Stack Trace: Traceback (most recent call last):
  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 "/tmp/.venv/local/lib/python2.7/site-packages/proboscis/case.py", line 296, in testng_method_mistake_capture_func
    compatability.capture_type_error(s_func)
  File "/tmp/.venv/local/lib/python2.7/site-packages/proboscis/compatability/exceptions_2_6.py", line 27, in capture_type_error
    func()
  File "/tmp/.venv/local/lib/python2.7/site-packages/proboscis/case.py", line 350, in func
    func(test_case.state.get_state())
  File "/var/lib/jenkins/jobs/on-tasks/workspace/RackHD/test/tests/api/v2_0/tags_tests.py", line 35, in test_tag_create
    "rules":[{"equals": updated_catalog[0]["data"]["System Information"]["Manufacturer"],
KeyError: 'System Information'


@benbp benbp merged commit d9192f2 into RackHD:master Apr 22, 2016
kellylu2sym pushed a commit to kellylu2sym/on-tasks that referenced this pull request Aug 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants