Initial
This commit is contained in:
@@ -19,7 +19,7 @@ test('normalizeBaseUrl trims trailing slashes', () => {
|
||||
test('normalizeVCenterVm maps guest identity and networking into a host candidate', () => {
|
||||
const candidate = normalizeVCenterVm(
|
||||
{ vm: 'vm-42', name: 'ENG-ENT-APP01', power_state: 'POWERED_ON' },
|
||||
{ host_name: 'eng-ent-app01.contoso.local', ip_address: '10.42.1.20', full_name: 'Microsoft Windows Server 2022' },
|
||||
{ host_name: 'eng-ent-app01.contoso.local', ip_address: '10.42.1.20', full_name: { default_message: 'Microsoft Windows Server 2022' } },
|
||||
[{ ip: { ip_addresses: [{ ip_address: 'fe80::1' }, { ip_address: '10.42.1.21' }] } }]
|
||||
);
|
||||
|
||||
@@ -29,16 +29,29 @@ test('normalizeVCenterVm maps guest identity and networking into a host candidat
|
||||
assert.equal(candidate.address, 'eng-ent-app01.contoso.local');
|
||||
assert.deepEqual(candidate.ipAddresses, ['10.42.1.20', '10.42.1.21']);
|
||||
assert.equal(candidate.osFamily, 'windows');
|
||||
assert.equal(candidate.guestFullName, 'Microsoft Windows Server 2022');
|
||||
});
|
||||
|
||||
test('vmMatchesFilter supports hostname contains and IP equals matching', () => {
|
||||
const candidate = { name: 'ENG-ENT-APP01', fqdn: 'app01.contoso.local', ipAddress: '10.42.1.20', ipAddresses: ['10.42.1.20'] };
|
||||
const candidate = { name: 'ENG-ENT-APP01', fqdn: 'app01.contoso.local', address: 'app01.contoso.local', ipAddress: '10.42.1.20', ipAddresses: ['10.42.1.20'] };
|
||||
|
||||
assert.equal(vmMatchesFilter(candidate, { field: 'hostname', operator: 'contains', value: 'eng-ent' }), true);
|
||||
assert.equal(vmMatchesFilter(candidate, { field: 'hostname', operator: 'contains', value: 'contoso' }), true);
|
||||
assert.equal(vmMatchesFilter(candidate, { field: 'ip', operator: 'equals', value: '10.42.1.20' }), true);
|
||||
assert.equal(vmMatchesFilter(candidate, { field: 'fqdn', operator: 'startsWith', value: 'db' }), false);
|
||||
});
|
||||
|
||||
test('vmMatchesFilter matches guest-only host names after enrichment', () => {
|
||||
const candidate = normalizeVCenterVm(
|
||||
{ vm: 'vm-200', name: 'KSUS01PAPP01', power_state: 'POWERED_ON' },
|
||||
{ host_name: 'MCS-WIN-APP01.ent.mitekindustries.com', ip_address: '10.42.5.44', family: 'WINDOWS' },
|
||||
[]
|
||||
);
|
||||
|
||||
assert.equal(vmMatchesFilter(candidate, { field: 'hostname', operator: 'contains', value: 'MCS' }), true);
|
||||
assert.equal(vmMatchesFilter(candidate, { field: 'name', operator: 'contains', value: 'MCS' }), false);
|
||||
});
|
||||
|
||||
test('filterSummaryVms scans the full VM summary list for VM-name filters', () => {
|
||||
const vms = [
|
||||
...Array.from({ length: 900 }, (_, index) => ({ vm: `vm-${index}`, name: `ZZZ-${index}` })),
|
||||
|
||||
Reference in New Issue
Block a user