cartography icon indicating copy to clipboard operation
cartography copied to clipboard

test(gcp): add sync test for GCP iam in integration

Open wahid18-maqs opened this issue 5 months ago • 4 comments

Summary

Describe your changes.

I added a new test_sync() in test_iam.py that: Creates the test project. Loads roles and service accounts using the the tests Asserts that the expected nodes and relationships are created

Related issues or links

Include links to relevant issues or other pages.

  • https://github.com/cartography-cncf/cartography/issues/...

Checklist

Provide proof that this works (this makes reviews move faster). Please perform one or more of the following:

  • [X] Update/add unit or integration tests.
  • [ ] Include a screenshot showing what the graph looked like before and after your changes.
  • [ ] Include console log trace showing what happened before and after your changes.

If you are changing a node or relationship:

If you are implementing a new intel module:

wahid18-maqs avatar Aug 11 '25 12:08 wahid18-maqs

@jych Thanks for the feedback earlier. I’ve updated the test so it now directly calls sync() and runs the full integration flow fetching roles and service accounts from our static test data, loading them into Neo4j, and performing cleanup. This covers both nodes and relationships in one pass, exercising the real code paths inside sync() rather than re-implementing them.

wahid18-maqs avatar Aug 11 '25 17:08 wahid18-maqs

Thanks, I'll address all the points you raised and push the changes soon.

wahid18-maqs avatar Aug 15 '25 20:08 wahid18-maqs

  • Added: Simple patches on the get() functions using existing test data
  • Kept: All the assertion logic testing graph outcomes
  • Simplified: iam_client parameter can be None since get functions are mocked

wahid18-maqs avatar Aug 16 '25 13:08 wahid18-maqs

Hi @achantavy Sir, this time I have followed AGENTS.md guidelines for testing outcomes over implementation details. Apologies for the previous commit.!!

wahid18-maqs avatar Aug 16 '25 14:08 wahid18-maqs