Skip to content

Conversation

@chandradeep11
Copy link
Owner

HTTPBinding.js file modified for reported lint error in telefonicaid#396

lib/bindings/HTTPBinding.js: line 216, col 26, 'i' is already defined.
resolved and updated.

lib/bindings/HTTPBinding.js: line 315, col 71, Functions declared within loops referencing an outer scoped variable may lead to >confusing semantics. (next, iotaUtils, req, arr, i, sendConfigurationToDevice, replyToDevice
Resolved.

>lib/bindings/HTTPBinding.js: line 216, col 26, 'i' is already defined.
resolved and updated.

>lib/bindings/HTTPBinding.js: line 315, col 71, Functions declared within loops referencing an outer scoped variable may lead to >confusing semantics. (next, iotaUtils, req, arr, i, sendConfigurationToDevice, replyToDevice
Resolved.
@fgalan
Copy link

fgalan commented Apr 12, 2019

Modification seems to be fine

@chandradeep11
Copy link
Owner Author

@fgalan
Can you please let me know the steps to run the existing UT.
I'm using Mocha to run existing test folder all test case are failed.

@fgalan
Copy link

fgalan commented Apr 15, 2019

The travis configuration at https://github.com/chandradeep03/iotagent-json/blob/master/.travis.yml is a good guide. For instance, you should ensure you have your MongoDB up and running before executing npm test to run the tests.

@chandradeep11
Copy link
Owner Author

Thanks for your response.

We foolowed the steps of trvis.yml and executed UT of HTTP_reveice_measures-test.js but still all test case get failed.
Following error is dispolying on terminal:

mocha --recursive 'test/**/*.js' --reporter spec --timeout 3000 --ui bdd --exit

HTTP: Measure reception
When a POST measure arrives for the HTTP binding
1) "before each" hook for "should return a 200 OK with no error"
2) "after each" hook for "should return a 200 OK with no error"

HTTP: Measure reception
When a POST measure arrives for the HTTP binding
3) "before each" hook
time=2019-04-16T05:30:59.320Z | lvl=FATAL | corr=n/a | trans=n/a | op=IoTAgentNGSI.Global | srv=n/a | subsrv=n/a | msg=An unexpected exception has been raised. Ignoring: Error: listen EADDRINUSE 0.0.0.0:4041 | comp=IoTAgent
4) "after each" hook for "should return a 200 OK with no error"

0 passing (3s)
4 failing

  1. HTTP: Measure reception
    "before each" hook for "should return a 200 OK with no error":
    Error: Timeout of 3000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/home/sumit/Downloads/Iot/iotagent-json-master/test/unit/HTTP_reveice_measures-test.js)

  2. HTTP: Measure reception
    "after each" hook for "should return a 200 OK with no error":
    Error: Not running
    at Server.close (net.js:1620:12)
    at emitCloseNT (net.js:1671:8)
    at _combinedTickCallback (internal/process/next_tick.js:135:11)
    at process._tickDomainCallback (internal/process/next_tick.js:218:9)

  3. HTTP: Measure reception
    "before each" hook:
    Uncaught Error: listen EADDRINUSE 0.0.0.0:4041
    at Object._errnoException (util.js:1022:11)
    at _exceptionWithHostPort (util.js:1044:20)
    at Server.setupListenHandle [as _listen2] (net.js:1367:14)
    at listenInCluster (net.js:1408:12)
    at doListen (net.js:1517:7)
    at _combinedTickCallback (internal/process/next_tick.js:141:11)
    at process._tickDomainCallback (internal/process/next_tick.js:218:9)

  4. HTTP: Measure reception
    "after each" hook for "should return a 200 OK with no error":
    Error: Not running
    at Server.close (net.js:1620:12)
    at emitCloseNT (net.js:1671:8)
    at _combinedTickCallback (internal/process/next_tick.js:135:11)
    at Immediate._tickDomainCallback (internal/process/next_tick.js:218:9)

@fgalan
Copy link

fgalan commented Apr 16, 2019

By Error: listen EADDRINUSE 0.0.0.0:4041 it seems you have already a process in your system listening on that port. Please, checkit (for instance using netstat).

@chandradeep11
Copy link
Owner Author

@fgalan thanks for your response.
I've already checked it. I killed the process as "node" which was running on this port. but still the same error is displaying and UT execution get failed.

@chandradeep11
Copy link
Owner Author

@fgalan
When we commented the code written in before-each and after-each of HTTP_reveice_measures-test.js then the existing UT are running sucessfully in our environment.

Can you please let me know as which test file should be modified if we have to add UT for PR telefonicaid#396. If adding of UT not required for PR telefonicaid#396 then please confirm.
As per my observation, there is no such test file written for HTTPBinding.js.

@fgalan
Copy link

fgalan commented Apr 22, 2019

... but still the same error is displaying and UT execution get failed.

If you are still getting Error: listen EADDRINUSE 0.0.0.0:4041 maybe you still have having some process running in that port.

Not sure what the problem is. What is sure is that a run of the tests from master in a clean environment works. I'm sharing how I run it, in the case it helps (showing only the output of the revelant commands):

$ git checkout master
$ git pull
$ npm run clean
$  node --version
v8.12.0
$ sudo netstat -ntlpd | grep 4041 | wc -l
0
$ npm install
...
added 838 packages from 1300 contributors and audited 5167 packages in 171.065s
found 0 vulnerabilities
$ npm test
...
  102 passing (24s)
  3 pending

@fgalan
Copy link

fgalan commented Apr 22, 2019

With regards to:

Can you please let me know as which test file should be modified if we have to add UT for PR telefonicaid#396. If adding of UT not required for PR telefonicaid#396 then please confirm.
As per my observation, there is no such test file written for HTTPBinding.js.

The bottom line is what I said in telefonicaid#396 (comment):

If functionality changes that should have an impact on test (we will see that once lint issues get fixes and travis can execute the unit test stage). If there is no impact, then new tests should be added to cover this fix.

Does you PR changes the functionality? I guess so, as it is about supporting multimeasures in IOTA-JSON and I understand that support doesn't previously exist. Is my interpretation correct? In that case is a matter of adding a new test that covers the sending of multimeasures.

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.

3 participants