telefonicaid / sigfox-iotagent

IoT Agent for the Sigfox protocol
https://iotagent-sigfox.rtfd.io/
GNU Affero General Public License v3.0
11 stars 13 forks source link

Use nock in tests to avoid depending on a running context broker #81

Closed bobeal closed 3 years ago

bobeal commented 4 years ago

Currently, the tests require a running context broker to work properly.

As is done in the IoT Agent node lib, they could use the nock library to be able to run independently of any third party system.

fgalan commented 4 years ago

I think it is a great idea. The most can be mocked for runing the test, the better. In fact some other IOTA-related repos (IOTA Lib, IOTA UL, IOTA JSON) and doing this, as far as I know.

It would be great if you could provide a contribution pull request with the needed changes, please. Thanks!

bobeal commented 4 years ago

Yes, actually, the plan was to do it alongside our current work to make the Sigfox agent NGSI-LD compliant :)

fgalan commented 4 years ago

Yes, actually, the plan was to do it alongside our current work to make the Sigfox agent NGSI-LD compliant :)

For the sake of clearness and review-ability I'd suggest to split the work in two pieces:

Does it make sense to you?

fgalan commented 4 years ago

Moreover, with regards to NGSI-LD, are you planning actual modification in the IOTA code itself? As far as I understand, the NGSI-LD interface towards CB is part of the IOTA Node Lib work and it's already done in a first experimental version available in this branch: https://github.com/telefonicaid/iotagent-node-lib/tree/feature/842_ngsi_ld. No modifications in IOTA code should be needed.

See also how other IOTAs are using this functionality (it's easy, just to use the branch as dependency): https://github.com/telefonicaid/iotagent-ul/pull/420

(Maybe this should be discussed in another issue, this one originally was about nock refactoring :)

bobeal commented 4 years ago

For the sake of clearness and review-ability I'd suggest to split the work in two pieces:

  • First, a PR with the changes to nock in the current code base (NGSIv2) based, without adding anything related with NGSI-LD
  • Second, a PR with contributions with NGSI-LD

Does it make sense to you?

Yes, sure, one issue, one PR :)

But maybe not in this order, because we have to move fast on the NGSI-LD compliance of the Sigfox agent.

In any case, we'll also take care of the NGSIv2 APIs when integrating nock.

(I gonna create another issue for the NGSI-LD topic)

bobeal commented 3 years ago

Resolved, cf #83