-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(RHINENG-9787): Add tests for bootc image table
- Loading branch information
1 parent
9f73281
commit 97749de
Showing
7 changed files
with
531 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
[ | ||
{ | ||
"image": "India Pale Ale", | ||
"hashCommitCount": 2, | ||
"systemCount": 3, | ||
"hashes": [ | ||
{ | ||
"image_digest": "Hazy", | ||
"hashSystemCount": 2 | ||
}, | ||
{ | ||
"image_digest": "West Coast", | ||
"hashSystemCount": 1 | ||
} | ||
] | ||
}, | ||
{ | ||
"image": "Belgian", | ||
"hashCommitCount": 1, | ||
"systemCount": 1, | ||
"hashes": [ | ||
{ | ||
"image_digest": "Dubbel", | ||
"hashSystemCount": 1 | ||
} | ||
] | ||
}, | ||
{ | ||
"image": "Stout", | ||
"hashCommitCount": 1, | ||
"systemCount": 1, | ||
"hashes": [ | ||
{ | ||
"image_digest": "Bourbon Barrell Aged", | ||
"hashSystemCount": 1 | ||
} | ||
] | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,288 @@ | ||
{ | ||
"total": 5, | ||
"count": 5, | ||
"page": 1, | ||
"per_page": 50, | ||
"results": [ | ||
{ | ||
"id": "6de30d78-f052-41d4-b123-125017443a98", | ||
"system_profile": { | ||
"arch": "x86_64", | ||
"cpu_flags": [ "fpu" ], | ||
"yum_repos": [ | ||
{ | ||
"name": "Extra Packages for Enterprise Linux 7 - Testing - $basearch", | ||
"enabled": false, | ||
"gpgcheck": true | ||
} | ||
], | ||
"os_release": "7.4", | ||
"bios_vendor": "SeaBIOS", | ||
"bios_version": "1.10.2-2.fc27", | ||
"kernel_modules": [ "veth" ], | ||
"last_boot_time": "2018-03-14T17:06:10", | ||
"number_of_cpus": 1, | ||
"cores_per_socket": 1, | ||
"enabled_services": [ "auditd" ], | ||
"bios_release_date": "04\/01\/2014", | ||
"number_of_sockets": 1, | ||
"os_kernel_version": "3.10.0", | ||
"running_processes": [ "qmgr" ], | ||
"satellite_managed": false, | ||
"installed_packages": [ "0:GeoIP-1.5.0-11.el7" ], | ||
"installed_services": [ "arp-ethers" ], | ||
"network_interfaces": [ | ||
{ | ||
"mtu": 65536, | ||
"name": "lo", | ||
"type": "loopback", | ||
"state": "UNKNOWN", | ||
"mac_address": "00:00:00:00:00:00", | ||
"ipv4_addresses": [ | ||
"127.0.0.1" | ||
], | ||
"ipv6_addresses": [ | ||
"::1" | ||
] | ||
} | ||
], | ||
"infrastructure_type": "virtual", | ||
"system_memory_bytes": 512073728, | ||
"infrastructure_vendor": "qemu", | ||
"system_purpose": { | ||
"usage": "Production" | ||
}, | ||
"bootc_status": { | ||
"booted": { | ||
"image": "India Pale Ale", | ||
"image_digest": "Hazy" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"id": "08a06e04-afbb-4e3c-b923-91aa1c17acc1", | ||
"system_profile": { | ||
"arch": "x86_64", | ||
"cpu_flags": [ "fpu" ], | ||
"yum_repos": [ | ||
{ | ||
"name": "Extra Packages for Enterprise Linux 7 - Testing - $basearch", | ||
"enabled": false, | ||
"gpgcheck": true | ||
} | ||
], | ||
"os_release": "8.4", | ||
"bios_vendor": "SeaBIOS", | ||
"bios_version": "1.10.2-2.fc27", | ||
"kernel_modules": [ "veth" ], | ||
"last_boot_time": "2018-03-14T17:06:10", | ||
"number_of_cpus": 1, | ||
"cores_per_socket": 1, | ||
"enabled_services": [ "auditd" ], | ||
"bios_release_date": "04\/01\/2014", | ||
"number_of_sockets": 1, | ||
"os_kernel_version": "3.10.0", | ||
"running_processes": [ "qmgr" ], | ||
"satellite_managed": false, | ||
"installed_packages": [ "0:GeoIP-1.5.0-11.el7" ], | ||
"installed_services": [ "arp-ethers" ], | ||
"network_interfaces": [ | ||
{ | ||
"mtu": 65536, | ||
"name": "lo", | ||
"type": "loopback", | ||
"state": "UNKNOWN", | ||
"mac_address": "00:00:00:00:00:00", | ||
"ipv4_addresses": [ | ||
"127.0.0.1" | ||
], | ||
"ipv6_addresses": [ | ||
"::1" | ||
] | ||
} | ||
], | ||
"infrastructure_type": "virtual", | ||
"system_memory_bytes": 512073728, | ||
"infrastructure_vendor": "qemu", | ||
"system_purpose": { | ||
"usage": "Production" | ||
}, | ||
"bootc_status": { | ||
"booted": { | ||
"image": "India Pale Ale", | ||
"image_digest": "Hazy" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"id": "4ef68d04-79fa-42ea-a0fe-b40ee257ff0e", | ||
"system_profile": { | ||
"arch": "x86_64", | ||
"cpu_flags": [ "fpu" ], | ||
"yum_repos": [ | ||
{ | ||
"name": "Extra Packages for Enterprise Linux 7 - Testing - $basearch", | ||
"enabled": false, | ||
"gpgcheck": true | ||
} | ||
], | ||
"os_release": "8.5", | ||
"bios_vendor": "SeaBIOS", | ||
"bios_version": "1.10.2-2.fc27", | ||
"kernel_modules": [ "veth" ], | ||
"last_boot_time": "2018-03-14T17:06:10", | ||
"number_of_cpus": 1, | ||
"cores_per_socket": 1, | ||
"enabled_services": [ "auditd" ], | ||
"bios_release_date": "04\/01\/2014", | ||
"number_of_sockets": 1, | ||
"os_kernel_version": "3.10.0", | ||
"running_processes": [ "qmgr" ], | ||
"satellite_managed": false, | ||
"installed_packages": [ "0:GeoIP-1.5.0-11.el7" ], | ||
"installed_services": [ "arp-ethers" ], | ||
"network_interfaces": [ | ||
{ | ||
"mtu": 65536, | ||
"name": "lo", | ||
"type": "loopback", | ||
"state": "UNKNOWN", | ||
"mac_address": "00:00:00:00:00:00", | ||
"ipv4_addresses": [ | ||
"127.0.0.1" | ||
], | ||
"ipv6_addresses": [ | ||
"::1" | ||
] | ||
} | ||
], | ||
"infrastructure_type": "virtual", | ||
"system_memory_bytes": 512073728, | ||
"infrastructure_vendor": "qemu", | ||
"system_purpose": { | ||
"usage": "Production" | ||
}, | ||
"bootc_status": { | ||
"booted": { | ||
"image": "India Pale Ale", | ||
"image_digest": "West Coast" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"id": "b6197999-06f8-4301-a936-651832aa8b31", | ||
"system_profile": { | ||
"arch": "x86_64", | ||
"cpu_flags": [ "fpu" ], | ||
"yum_repos": [ | ||
{ | ||
"name": "Extra Packages for Enterprise Linux 7 - Testing - $basearch", | ||
"enabled": false, | ||
"gpgcheck": true | ||
} | ||
], | ||
"os_release": "8.5", | ||
"bios_vendor": "SeaBIOS", | ||
"bios_version": "1.10.2-2.fc27", | ||
"kernel_modules": [ "veth" ], | ||
"last_boot_time": "2018-03-14T17:06:10", | ||
"number_of_cpus": 1, | ||
"cores_per_socket": 1, | ||
"enabled_services": [ "auditd" ], | ||
"bios_release_date": "04\/01\/2014", | ||
"number_of_sockets": 1, | ||
"os_kernel_version": "3.10.0", | ||
"running_processes": [ "qmgr" ], | ||
"satellite_managed": false, | ||
"installed_packages": [ "0:GeoIP-1.5.0-11.el7" ], | ||
"installed_services": [ "arp-ethers" ], | ||
"network_interfaces": [ | ||
{ | ||
"mtu": 65536, | ||
"name": "lo", | ||
"type": "loopback", | ||
"state": "UNKNOWN", | ||
"mac_address": "00:00:00:00:00:00", | ||
"ipv4_addresses": [ | ||
"127.0.0.1" | ||
], | ||
"ipv6_addresses": [ | ||
"::1" | ||
] | ||
} | ||
], | ||
"infrastructure_type": "virtual", | ||
"system_memory_bytes": 512073728, | ||
"infrastructure_vendor": "qemu", | ||
"system_purpose": { | ||
"usage": "Production" | ||
}, | ||
"bootc_status": { | ||
"booted": { | ||
"image": "Belgian", | ||
"image_digest": "Dubbel" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"id": "8499b198-5352-4eda-8650-ca09e002fdc1", | ||
"system_profile": { | ||
"arch": "x86_64", | ||
"cpu_flags": [ "fpu" ], | ||
"yum_repos": [ | ||
{ | ||
"name": "Extra Packages for Enterprise Linux 7 - Testing - $basearch", | ||
"enabled": false, | ||
"gpgcheck": true | ||
} | ||
], | ||
"os_release": "8.2", | ||
"bios_vendor": "SeaBIOS", | ||
"bios_version": "1.10.2-2.fc27", | ||
"kernel_modules": [ "veth" ], | ||
"last_boot_time": "2018-03-14T17:06:10", | ||
"number_of_cpus": 1, | ||
"cores_per_socket": 1, | ||
"enabled_services": [ "auditd" ], | ||
"bios_release_date": "04\/01\/2014", | ||
"number_of_sockets": 1, | ||
"os_kernel_version": "3.10.0", | ||
"running_processes": [ "qmgr" ], | ||
"satellite_managed": false, | ||
"installed_packages": [ "0:GeoIP-1.5.0-11.el7" ], | ||
"installed_services": [ "arp-ethers" ], | ||
"network_interfaces": [ | ||
{ | ||
"mtu": 65536, | ||
"name": "lo", | ||
"type": "loopback", | ||
"state": "UNKNOWN", | ||
"mac_address": "00:00:00:00:00:00", | ||
"ipv4_addresses": [ | ||
"127.0.0.1" | ||
], | ||
"ipv6_addresses": [ | ||
"::1" | ||
] | ||
} | ||
], | ||
"infrastructure_type": "virtual", | ||
"system_memory_bytes": 512073728, | ||
"infrastructure_vendor": "qemu", | ||
"system_purpose": { | ||
"usage": "Production" | ||
}, | ||
"bootc_status": { | ||
"booted": { | ||
"image": "Stout", | ||
"image_digest": "Bourbon Barrell Aged" | ||
} | ||
} | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React from 'react'; | ||
import { render, waitFor } from '@testing-library/react'; | ||
import '@testing-library/jest-dom'; | ||
import axios from 'axios'; | ||
import BifrostPage from './BifrostPage'; | ||
import mockedBootCStatusData from '../../__mocks__/mockedBootCStatusData.json'; | ||
import { | ||
INVENTORY_TOTAL_FETCH_URL_SERVER, | ||
INVENTORY_FETCH_BOOTC, | ||
INVENTORY_FETCH_NON_BOOTC, | ||
INVENTORY_FILTER_NO_HOST_TYPE, | ||
} from '../../Utilities/constants'; | ||
|
||
jest.mock('axios'); | ||
|
||
describe('BifrostPage', () => { | ||
beforeEach(() => { | ||
axios.get.mockResolvedValue({ | ||
data: mockedBootCStatusData, | ||
}); | ||
}); | ||
|
||
test('should fetch bootc_status', async () => { | ||
render(<BifrostPage />); | ||
await waitFor(() => | ||
expect(axios.get).toHaveBeenCalledWith( | ||
`${INVENTORY_TOTAL_FETCH_URL_SERVER}${INVENTORY_FETCH_BOOTC}&fields[system_profile]=bootc_status` | ||
) | ||
); | ||
|
||
expect(axios.get).toHaveBeenCalledWith( | ||
`${INVENTORY_TOTAL_FETCH_URL_SERVER}${INVENTORY_FETCH_NON_BOOTC}&${INVENTORY_FILTER_NO_HOST_TYPE}&per_page=1` | ||
); | ||
}); | ||
}); |
Oops, something went wrong.