mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-08 19:26:48 +00:00
- Totals above the list: hosts connected of all, VMs running of all, vCPUs given on the CPUs, memory given of the memory of the hosts the panel reads, as cards; the connected count is red while a host is not. - A host's name links its overview; its state is a Connected or Not connected badge (the dot goes), beside a badge of how the panel reaches it (TCP, SSH, TLS, Socket); its address in monospace. - A VMs column: the host's VMs, linked to its Instances, and how many run. - The vCPUs have a bar like the memory's: running VMs' and shut-off VMs' vCPUs against the CPUs, amber over 2:1 and red over 4:1 as the ratio is; the overview's vCPU card shares it. - The three coloured buttons of each row are one menu: Overview, Edit connection and Remove from panel (its popper fixed, as the table's scrolling box would cut it off). - The four green add buttons are one "Add host" menu that says what each kind of connection is. - The table is table-hover; a host the panel cannot reach has a table-warning row.
26 lines
1.1 KiB
Python
26 lines
1.1 KiB
Python
from unittest.mock import PropertyMock, patch
|
|
|
|
from django.contrib.auth import get_user_model
|
|
from django.test import TestCase
|
|
from django.urls import reverse
|
|
|
|
from computes.models import Compute
|
|
|
|
ERROR = "Connection Failed: Host key verification failed."
|
|
|
|
|
|
class OverviewStatusTests(TestCase):
|
|
def setUp(self):
|
|
self.client.force_login(
|
|
get_user_model().objects.create_superuser(username="ov-admin", password="pwd", email="ov@example.com")
|
|
)
|
|
# an ssh_config alias: not a name a TCP probe can reach
|
|
self.compute = Compute.objects.create(name="ov-alias", hostname="wvc-alias", login="root", password="", type=2)
|
|
|
|
def test_compute_list_shows_why_a_host_is_not_connected(self):
|
|
with patch.object(Compute, "status", new_callable=PropertyMock, return_value=False), patch.object(
|
|
Compute, "connection_error", new_callable=PropertyMock, return_value=ERROR
|
|
):
|
|
response = self.client.get(reverse("computes"))
|
|
self.assertContains(response, "Not connected")
|
|
self.assertContains(response, ERROR)
|