Skip to content
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

ICAT ids hardcoded in UserResourceTest and no timeout for tests #35

Open
patrick-austin opened this issue Apr 12, 2024 · 0 comments
Open

Comments

@patrick-austin
Copy link

While attempting to set up a dev environment and run the tests, ran into the following problems:

  • ICAT entity ids are hardcoded to 1 in two tests:

    response = userResource.addCartItems(facilityName, sessionId, "dataset 1", false);
    assertEquals(200, response.getStatus());
    response = userResource.getCart(facilityName, sessionId);
    assertEquals(200, response.getStatus());
    assertEquals(1, getCartSize(response));
    // Now we need to remove the cart item again;
    // Again, this ought to be done directly, rather than using the methods we
    // should be testing independently!
    response = userResource.deleteCartItems(facilityName, sessionId, "dataset 1");

    After running the LILS generator script I had entities with much higher ids (as I have already used the other components for development in the past). These tests are fairly generic, any id will do as long as it matches an entity. Suggest this should be changed to find an existing id first, rather than being hardcoded to 1.
  • There's no timeout set in https://github.com/ral-facilities/datagateway-download-api/blob/master/src/test/resources/run.properties, which is fine if the tests pass but will hang indefinitely if the IDS is incorrectly configured (for me this was because I was using localhost rather than the FQDN in the IDS run.properties, which lead to IdsBean never initialising but retrying forever). The tests should either succeed or fail relatively quickly, so setting this to a few seconds would prevent long running CI and make it clearer that something has gone wrong.
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

No branches or pull requests

1 participant