Skip to content

Conversation

@ssmadhavan006
Copy link

@ssmadhavan006 ssmadhavan006 commented Dec 8, 2025

Checklist

  • I have read the OpenWISP Contributing Guidelines.
  • I have manually tested the changes proposed in this pull request.
  • I have written new test cases for new code and/or updated existing tests for changes to existing code.
  • I have updated the documentation.

Reference to Existing Issue

Closes #1070.

Description of Changes

This PR adds missing automated tests to ensure device configuration status updates correctly when organization configuration variables (context) change. The existing implementation already handled this logic correctly (via checksum comparison) but there was no automated test coverage verifying the behavior.

What’s Added

A new test class TestOrganizationConfigUpdates in openwisp_controller/config/tests/test_device.py. It includes three scenarios:

  1. Affected device becomes modified

    • Template uses {{ ssid }}
    • Changing org context updates config status
  2. Unaffected device remains applied

    • Template has no variables
    • Context change does not affect checksum
  3. No status change when checksum does not change

    • Unused variable changes
    • Config remains unchanged

Notes:

  • No production code was modified
  • Tests run synchronously (CELERY_TASK_ALWAYS_EAGER=True)
  • Ensures future regressions are prevented

Screenshot

Creating a Organization
Screenshot 2025-12-08 232106

Creating a Template-1
Screenshot 2025-12-08 230936
Screenshot 2025-12-08 230943

Creating a Template-2
Screenshot 2025-12-08 231012
Screenshot 2025-12-08 231022

Device-1 Configuration
Screenshot 2025-12-08 231631

Device-2 Configuration
Screenshot 2025-12-08 231644

Before Change
Screenshot 2025-12-08 231402

Change Org Variable
Screenshot 2025-12-08 232038

Device Status Change
Screenshot 2025-12-08 231518

@ssmadhavan006 ssmadhavan006 changed the title Fix device config status for organization variable change #1070 Fix device config status for organization variable change Dec 8, 2025
@DragnEmperor DragnEmperor changed the title Fix device config status for organization variable change Tests for device config updates on org variable changes Dec 10, 2025
@ssmadhavan006 ssmadhavan006 force-pushed the fix/org-var-status-#1070 branch from bcc1026 to e7f3bcb Compare December 10, 2025 19:27
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.

[bug] Device config status does not update to "modified" when organization variable is changed

2 participants