RWTH-EBC/FiLiP

Revise NGSI-LD batch operation tests

Opened this issue · 1 comments

The batch operation tests are overall not very consistent, i suspect due to some possible changes in other apps from the platform.
Some examples include ( but not limited to ):

  • Practically every test that defines two different types: The test setup actually throws because it attempts to update the type of some entities, and update one that does not exist, that results in a multi_status_response that is completely wrong, which according to the implementation, raises, and no self.assertRaises is given, e.g :
ContextLDEntity(id=f"urn:ngsi-ld:test:10", type=f'filip:object:TypeA')
entities_a = [ContextLDEntity(id=f"urn:ngsi-ld:test:{str(i)}",
                              type=f'filip:object:TypeA') for i in
              range(0, 5)]

self.cb_client.entity_batch_operation(entities=entities_a, action_type=ActionTypeLD.CREATE)

entities_update = [ContextLDEntity(id=f"urn:ngsi-ld:test:{str(i)}",
                                   type=f'filip:object:TypeUpdate') for i in
                   range(3, 6)]
self.cb_client.entity_batch_operation(entities=entities_update, action_type=ActionTypeLD.UPDATE)
  • in the test_ngsi_ld_cb test file, there are also batch operations. In the test_batch_operations test the opposite problem is happening:
    UPSERT to change type does not raise, or at least not the expected error ( RuntimeError ), when it should at least raise. Maybe remove these tests an leave that file for management/stat endpoint testing? ? it happens to contain all types of tests in a single file.

  • Some tests overall either call the cleanup function in the setup function , which sometimes causes errors, or they attempt to define a header with a tenant = filip, which also intells that that tenant already exists wherever we are testing and that sometimes throws. A proper lookover of test modes ( local env variables .vs env variables pointing to cluster ) is also a good idea.