Skip to content

Add testcode to network group behavior#789

Merged
sehkone merged 1 commit intomainfrom
pott/add-test-customer-network-ip
Mar 27, 2026
Merged

Add testcode to network group behavior#789
sehkone merged 1 commit intomainfrom
pott/add-test-customer-network-ip

Conversation

@pott-cho
Copy link
Copy Markdown
Contributor

Closes: #775

I added test code to clarify the behavior of customer network add/update.
The tests in this PR clarify the following behaviors:

  • When adding customer networks, the networkGroup fields (hosts, networks, ranges) are stored in sorted order.
  • When adding customer networks, duplicate values within a single networkGroup are removed without an error.
  • When adding customer networks, identical networkGroup values across different network entries are allowed (for both insert and update).

@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.85%. Comparing base (a6cc39c) to head (f6b61f3).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #789      +/-   ##
==========================================
+ Coverage   76.33%   76.85%   +0.52%     
==========================================
  Files          73       73              
  Lines       20293    20520     +227     
==========================================
+ Hits        15490    15770     +280     
+ Misses       4803     4750      -53     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@octoaide
Copy link
Copy Markdown
Contributor

octoaide Bot commented Feb 26, 2026

Hi @sehkone — this PR (Add testcode to network group behavior, @pott-cho) adds tests clarifying customer-network add/update behavior and closes #775. All CI checks and codecov are green. The branch is mergeable but blocked because GitHub requires at least one approving review from someone with write access and no reviewers are currently assigned. Could you please assign a reviewer or let us know if there's a reason to hold (release timing, broader review plan, etc.)? If you want, I can suggest reviewers or provide any extra context to speed review.

@octoaide
Copy link
Copy Markdown
Contributor

octoaide Bot commented Mar 3, 2026

Hi @sehkone — this PR (#789, author: @pott-cho) adds tests clarifying customer-network add/update behavior and closes #775. All CI checks and codecov are green and the branch is mergeable, but GitHub requires at least one approving review from someone with write access and no reviewers are currently assigned. Could you please assign a reviewer with write access or let us know if there’s a reason to hold this (release timing, broader review plan, etc.)? If helpful, I can suggest reviewers familiar with the networking area to speed review. Thanks!

Comment thread src/graphql/customer.rs
}

#[tokio::test]
async fn allow_duplicate_network_groups_on_insert() {
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.

I think adding assertions that verify the network entries are actually preserved as intended (e.g., both n1 and n2 exist) would improve the test’s purpose. Similar assertions might be helpful to allow_duplicate_network_groups_on_update as well.

Comment thread src/graphql/customer.rs Outdated

#[tokio::test]
async fn ensure_network_group_items_are_sorted() {
// The values inside networkGroup are stored in alphabetical order regardless of the input order.
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.

Suggested change
// The values inside networkGroup are stored in alphabetical order regardless of the input order.
// The values inside networkGroup are stored in deterministic sorted order (per type-defined ordering), regardless of input order.

“alphabetical order” is not a perfectly precise term here. To avoid inaccuracies and keep the comment future-proof against implementation changes, please consider the suggestion above.

@pott-cho pott-cho force-pushed the pott/add-test-customer-network-ip branch from a156659 to 41c9495 Compare March 6, 2026 04:48
Copy link
Copy Markdown
Contributor

@sophie-cluml sophie-cluml left a comment

Choose a reason for hiding this comment

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

Thanks for addressing the earlier test concern.

Two small follow-ups:

  • The recursion-limit change in examples/minireview.rs seems orthogonal to #775. Would it make sense to stack this PR on top of #802 instead?
  • The new insert/update tests now assert that two network entries remain, but they still do not verify that the preserved entries are actually n1 and n2. Tightening those assertions would make the test intent more direct.

@pott-cho pott-cho force-pushed the pott/add-test-customer-network-ip branch from 16d628a to f6b61f3 Compare March 11, 2026 00:38
@pott-cho
Copy link
Copy Markdown
Contributor Author

Thanks for addressing the earlier test concern.

Two small follow-ups:

I removed the recursion-limit change because it is already handled in #802. I also tightened the tests by adding assertions to verify that the preserved entries are indeed n1 and n2.

@sehkone sehkone merged commit 00d427c into main Mar 27, 2026
18 checks passed
@sehkone sehkone deleted the pott/add-test-customer-network-ip branch March 27, 2026 02:44
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

Successfully merging this pull request may close these issues.

Add Validation to Prevent Duplicate Network Ranges per Customer

3 participants