test(16-02): verify new Device fields in integration test

- Assert DeviceType defaults to "routeros" via COALESCE
- Assert SNMPPort defaults to 161 via COALESCE
- Assert SNMPVersion, SNMPProfileID, CredentialProfileID are nil for
  existing RouterOS devices without profile links
- Assert ProfileEncryptedCredentials and ProfileEncryptedCredentialsTransit
  are nil when no credential profile is linked
- Update test schema with device_type, snmp_port, snmp_version,
  snmp_profile_id, credential_profile_id columns
- Add credential_profiles table to test schema for LEFT JOIN

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jason Staack
2026-03-21 18:26:53 -05:00
parent c1eb9ca41a
commit d3084abbb9
2 changed files with 26 additions and 0 deletions

View File

@@ -87,6 +87,15 @@ func TestDeviceStore_FetchDevices_Integration(t *testing.T) {
assert.Equal(t, "7.16", *d.RouterOSVersion)
require.NotNil(t, d.MajorVersion)
assert.Equal(t, 7, *d.MajorVersion)
// New fields: verify COALESCE defaults for existing RouterOS devices.
assert.Equal(t, "routeros", d.DeviceType, "COALESCE should default to routeros")
assert.Equal(t, 161, d.SNMPPort, "COALESCE should default to 161")
assert.Nil(t, d.SNMPVersion, "SNMPVersion should be nil for RouterOS devices")
assert.Nil(t, d.SNMPProfileID, "SNMPProfileID should be nil for RouterOS devices")
assert.Nil(t, d.CredentialProfileID, "CredentialProfileID should be nil when not linked")
assert.Nil(t, d.ProfileEncryptedCredentials, "ProfileEncryptedCredentials should be nil when no profile linked")
assert.Nil(t, d.ProfileEncryptedCredentialsTransit, "ProfileEncryptedCredentialsTransit should be nil when no profile linked")
}
}
}