Skip to content

Commit 8fa9914

Browse files
prakash-kalwaniyamn-ram
authored andcommitted
[fix] Use 63-char hostname in tests to pass device name validator
Device name must be a valid hostname (max 63-char label per RFC 952). Using 63 chars still triggers truncation (63 > 63 - 17 = 46).
1 parent 7af16b1 commit 8fa9914

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

openwisp_controller/config/tests/test_vpn.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ def test_get_common_name_does_not_mutate_device_name(self):
302302
"""Regression test: _get_common_name() must not mutate the
303303
device object's name in memory. A long device name should be
304304
truncated only for the common_name, not on the device itself."""
305-
long_name = "a" * 64
305+
long_name = "a" * 63 # max valid hostname label length, exceeds 63 - len(mac)
306306
vpn = self._create_vpn()
307307
d = self._create_device(name=long_name)
308308
c = self._create_config(device=d)
@@ -422,7 +422,7 @@ def test_auto_create_cert_preserves_full_device_name(self):
422422
"""Regression test: when a device has a very long name, the
423423
auto-created certificate's display name should be the original
424424
(full) device name, not the truncated common_name version."""
425-
long_name = "a" * 64 # exceeds 63 - len(mac_address) limit
425+
long_name = "a" * 63 # max valid hostname label, exceeds 63 - len(mac)
426426
org = self._create_org(name="org1")
427427
vpn = self._create_vpn(organization=org)
428428
d = self._create_device(organization=org, name=long_name)

0 commit comments

Comments
 (0)