fix: FQDN resolution and display_name blank bug; fix: Arch/Alpine/RPM packages
Bug fixes: - get_fqdn() now prioritizes 'hostname -f' (returns full FQDN) over /etc/hostname (returns short hostname) - Added get_hostname() for short hostname extraction - Added hostname field to EnrollmentRequest for manager display_name population - Updated SPEC.md and API_DOCUMENTATION.md Package fixes: - Arch: Added linux-patch-api.install with post_install/upgrade/remove hooks, user creation, directory creation, config handling - Alpine: Added linux-patch-api.apk-install with pre/post install/deinstall hooks, user creation, directory creation, config handling, missing config.yaml.example - RPM: Dynamic version from Cargo.toml, %ghost %config(noreplace) for live configs, tarball exclusions, /var/log in %files
This commit is contained in:
@ -473,6 +473,18 @@ async fn test_registration_payload_structure() {
|
||||
os_obj.contains_key("distro") || os_obj.contains_key("kernel"),
|
||||
"os_details should contain distro or kernel information"
|
||||
);
|
||||
|
||||
// Verify hostname field (optional, may be present or absent)
|
||||
// When present, it should be a non-empty string without dots (short hostname)
|
||||
if let Some(hostname) = payload.get("hostname").and_then(|v| v.as_str()) {
|
||||
assert!(!hostname.is_empty(), "hostname should not be empty when present");
|
||||
assert!(
|
||||
!hostname.contains('.'),
|
||||
"hostname should be short form (no dots), got: {}",
|
||||
hostname
|
||||
);
|
||||
}
|
||||
// hostname field is optional — its absence is valid (skip_serializing_if = None)
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
|
||||
Reference in New Issue
Block a user