Skip to content

Fundamental test coverage of vgrid module reusing existing structure.#371

Merged
jonasbardino merged 5 commits intonextfrom
add/mig-shared-vgrid-unit-tests
Jan 29, 2026
Merged

Fundamental test coverage of vgrid module reusing existing structure.#371
jonasbardino merged 5 commits intonextfrom
add/mig-shared-vgrid-unit-tests

Conversation

@jonasbardino
Copy link
Copy Markdown
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
@jonasbardino jonasbardino marked this pull request as ready for review October 29, 2025 11:20
@jonasbardino jonasbardino requested a review from a team October 29, 2025 11:20
@jonasbardino jonasbardino added the follow-up pending Pending tasks to follow-up on after close label Oct 29, 2025
self.test_vgrid, 'owners', self.configuration)
self.assertEqual(owners, [owner1])

# Test 2: Prepend new owner
Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed, and I already started splitting similar constructs in other PRs now as you may have recently seen. I have continued here but there's probably room for more. Yet, I think there's no point in delaying this one much further, so I lean towards merging with the latest updates and keeping it in mind for future unit tests or refactoring in a follow-up PR.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yah - since that comment was written towards the end of October last year we collectively definitely been more consistently splitting things etc :) That's for having revisited it, even if a little, here.

Aside, I'm as ever on the side of lets get the tests in, but much like being cautious against small workarounds that have that nasty tendency to persist (and for that reason we are rightly way of) I feel the same about tests - trying to maintain that balance etc.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks, and yes while this is a work in progress I believe we're on the right track. I'll proceed with merging and see if the recent merge of #427 gives rise to obvious test additions as follow-up.

Copy link
Copy Markdown
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.

@jonasbardino jonasbardino force-pushed the add/mig-shared-vgrid-unit-tests branch from fd97e90 to 15337ad Compare January 21, 2026 15:04
@jonasbardino
Copy link
Copy Markdown
Contributor Author

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.

Thanks for the review. I've updated and requested another review to also ask for approval before merging.

Copy link
Copy Markdown
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 don't feel quite as confident in terms of having detailed knowledge of the functionality being tested, and as such a word of caution that I can't comment on whether we have exercised all the behaviours we should - but the tests themselves here look good at this point, so approving that aspect.

@jonasbardino jonasbardino force-pushed the add/mig-shared-vgrid-unit-tests branch from cd8a79d to c9a6a2e Compare January 29, 2026 11:32
@jonasbardino jonasbardino merged commit 9e50679 into next Jan 29, 2026
7 checks passed
@jonasbardino jonasbardino deleted the add/mig-shared-vgrid-unit-tests branch January 29, 2026 11:40
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.

2 participants