test: Gaiia.Reconciliation nil-field mismatch suppression branch
This commit is contained in:
parent
d15d2cf29f
commit
0f87ec5b89
2 changed files with 32 additions and 0 deletions
|
|
@ -140,5 +140,33 @@ defmodule Towerops.Gaiia.ReconciliationTest do
|
|||
assert result.summary.untracked_count == 1
|
||||
assert result.summary.missing_mapping_count == 1
|
||||
end
|
||||
|
||||
test "skips data_mismatches when towerops or gaiia field is nil",
|
||||
%{org: org} do
|
||||
device =
|
||||
device_fixture(%{
|
||||
organization_id: org.id,
|
||||
name: "Nil-IP",
|
||||
# No ip_address set on Towerops side → maybe_add_mismatch returns acc
|
||||
ip_address: "10.0.0.42"
|
||||
})
|
||||
|
||||
{:ok, _item} =
|
||||
Gaiia.upsert_inventory_item(org.id, %{
|
||||
gaiia_id: "gaiia-inv-nil",
|
||||
name: "Nil-IP",
|
||||
ip_address: nil
|
||||
})
|
||||
|
||||
Gaiia.update_inventory_item_mapping(
|
||||
Gaiia.get_inventory_item(org.id, "gaiia-inv-nil"),
|
||||
%{device_id: device.id}
|
||||
)
|
||||
|
||||
result = Reconciliation.reconcile(org.id)
|
||||
|
||||
# gaiia_val is nil → mismatch suppressed
|
||||
assert result.data_mismatches == []
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -15,11 +15,15 @@ defmodule ToweropsWeb.AgentChannelExtraCoverageTest do
|
|||
alias Towerops.AccountsFixtures
|
||||
alias Towerops.Agent.AgentHeartbeat
|
||||
alias Towerops.Agent.AgentJobList
|
||||
alias Towerops.Agent.CheckResult, as: CheckResultProto
|
||||
alias Towerops.Agent.MonitoringCheck, as: MonitoringCheckProto
|
||||
alias Towerops.Agent.SnmpResult
|
||||
alias Towerops.Agents.AgentAssignment
|
||||
alias Towerops.AgentsFixtures
|
||||
alias Towerops.Alerts
|
||||
alias Towerops.DevicesFixtures
|
||||
alias Towerops.OrganizationsFixtures
|
||||
alias Towerops.Repo
|
||||
alias Towerops.Snmp.AgentDiscovery
|
||||
alias Towerops.SnmpFixtures
|
||||
alias ToweropsWeb.AgentSocket
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue