Skip to content

Conversation

@jonasbardino
Copy link
Contributor

@jonasbardino jonasbardino commented Oct 21, 2025

Fundamental test coverage of vgrid module reusing existing structure.

Some tests are disabled on purpose because changes are needed in the tested module. Marked as follow-up.

@jonasbardino jonasbardino self-assigned this Oct 21, 2025
@jonasbardino jonasbardino added the test-only Improvements or additions solely for better test coverage - without functionality changes label Oct 21, 2025
self.test_vgrid, 'owners', self.configuration)
self.assertEqual(owners, [owner1])

# Test 2: Prepend new owner
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When we have a situation where a single test function is actually testing multiple things like this to me that's a hint to each of these ought to be their own test function.

Moreover, there seem to be two different "starting" states for these tests - there is a "with no existing vgrid" and "with an existing vgrid", and likely different needs in terms of setup code for them. With a lens like that, it suggests two test case blocks:

class TestCase_no_vgrid:
pass

class TestCase_with_existing_vgrid:
pass

with the tests shared between the two, and ech of the "Test 1, Test 2, ..." things in here being much more naturally separate functions in the latter testcase. Note you get one other benefit: you can then tailor before_each to both of the situations. In the "with existing vgrid" case you can place the setup code for provisioning a vgrid in before_each and then that details doesn't need to exist in each test function.

Copy link
Contributor

@albu-diku albu-diku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a very important area to cover and it will be a boon to have coverage of this in tree.

I've left a comment with suggestions about how I think the tests could be restructured a little for what I think will be a big aid to comprehensibility here: https://github.com/ucphhpc/migrid-sync/pull/371/files#r2472789903. I'm not going to insist hence delivery as a comment rather than requesting changes, but I do feel it worthwhile if possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

follow-up pending Pending tasks to follow-up on after close test-only Improvements or additions solely for better test coverage - without functionality changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants