Skip to content

Commit d978238

Browse files
committed
Added unit test for getHypervisor
1 parent c7ee53b commit d978238

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
HTTP/1.1 200 OK
2+
Content-Type: application/json
3+
4+
{
5+
"hypervisor":{
6+
"status":"enabled",
7+
"service":{
8+
"host":"localhost.localdomain",
9+
"disabled_reason":null,
10+
"id":8
11+
},
12+
"vcpus_used":10,
13+
"hypervisor_type":"QEMU",
14+
"local_gb_used":120,
15+
"vcpus":56,
16+
"hypervisor_hostname":"localhost.localdomain",
17+
"memory_mb_used":20992,
18+
"memory_mb":97909,
19+
"current_workload":0,
20+
"state":"up",
21+
"host_ip":"1.2.3.4",
22+
"cpu_info":"{\"vendor\": \"Intel\", \"model\": \"Haswell-noTSX\", \"arch\": \"x86_64\", \"features\": [\"pge\", \"avx\", \"xsaveopt\", \"clflush\", \"sep\", \"syscall\", \"tsc_adjust\", \"vme\", \"dtes64\", \"invpcid\", \"msr\", \"sse\", \"xsave\", \"vmx\", \"erms\", \"xtpr\", \"cmov\", \"smep\", \"pcid\", \"est\", \"pat\", \"arat\", \"smx\", \"pbe\", \"lm\", \"tsc\", \"nx\", \"fxsr\", \"tm\", \"sse4.1\", \"pae\", \"sse4.2\", \"pclmuldq\", \"acpi\", \"fma\", \"tsc-deadline\", \"mmx\", \"osxsave\", \"cx8\", \"mce\", \"de\", \"tm2\", \"ht\", \"dca\", \"pni\", \"abm\", \"popcnt\", \"mca\", \"pdpe1gb\", \"apic\", \"fsgsbase\", \"f16c\", \"pse\", \"ds\", \"invtsc\", \"lahf_lm\", \"aes\", \"avx2\", \"sse2\", \"ss\", \"ds_cpl\", \"bmi1\", \"bmi2\", \"ssse3\", \"rdtscp\", \"fpu\", \"cx16\", \"pse36\", \"mtrr\", \"movbe\", \"pdcm\", \"cmt\", \"rdrand\", \"x2apic\"], \"topology\": {\"cores\": 14, \"cells\": 2, \"threads\": 2, \"sockets\": 1}}",
23+
"running_vms":4,
24+
"free_disk_gb":146,
25+
"hypervisor_version":2006000,
26+
"disk_available_least":2,
27+
"local_gb":266,
28+
"free_ram_mb":76917,
29+
"id":1
30+
}
31+
}

tests/unit/Compute/v2/ServiceTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,4 +152,17 @@ public function test_it_lists_hypervisors()
152152
$this->assertInstanceOf(Hypervisor::class, $hypervisor);
153153
}
154154
}
155+
156+
public function test_it_gets_hypervisor()
157+
{
158+
$this->client
159+
->request('GET', 'os-hypervisors/1234', ['headers' => []])
160+
->shouldBeCalled()
161+
->willReturn($this->getFixture('hypervisor-get'));
162+
163+
$hypervisor = $this->service->getHypervisor(['id' => 1234]);
164+
$hypervisor->retrieve();
165+
166+
$this->assertInstanceOf(Hypervisor::class, $hypervisor);
167+
}
155168
}

0 commit comments

Comments
 (0)