@@ -346,6 +346,36 @@ const HypervisorGetEmptyCPUInfoBody = `
346346}
347347`
348348
349+ // HypervisorAfterV287ResponseBody represents a raw hypervisor GET result with
350+ // missing cpu_info, free_disk_gb, local_gb as seen after v2.87
351+ const HypervisorAfterV287ResponseBody = `
352+ {
353+ "hypervisor":{
354+ "current_workload":0,
355+ "status":"enabled",
356+ "state":"up",
357+ "disk_available_least":0,
358+ "host_ip":"1.1.1.1",
359+ "free_ram_mb":7680,
360+ "hypervisor_hostname":"fake-mini",
361+ "hypervisor_type":"fake",
362+ "hypervisor_version":2002000,
363+ "id":"c48f6247-abe4-4a24-824e-ea39e108874f",
364+ "local_gb_used":0,
365+ "memory_mb":8192,
366+ "memory_mb_used":512,
367+ "running_vms":0,
368+ "service":{
369+ "host":"e6a37ee802d74863ab8b91ade8f12a67",
370+ "id":"9c2566e7-7a54-4777-a1ae-c2662f0c407c",
371+ "disabled_reason":null
372+ },
373+ "vcpus":1,
374+ "vcpus_used":0
375+ }
376+ }
377+ `
378+
349379// HypervisorUptimeBody represents a raw hypervisor uptime request result with
350380// Pike+ release.
351381const HypervisorUptimeBody = `
@@ -492,6 +522,7 @@ var (
492522 }
493523
494524 HypervisorEmptyCPUInfo = hypervisors.Hypervisor {
525+ CPUInfo : hypervisors.CPUInfo {},
495526 CurrentWorkload : 0 ,
496527 Status : "enabled" ,
497528 State : "up" ,
@@ -517,6 +548,33 @@ var (
517548 VCPUsUsed : 0 ,
518549 }
519550
551+ HypervisorAfterV287Response = hypervisors.Hypervisor {
552+ CPUInfo : hypervisors.CPUInfo {},
553+ CurrentWorkload : 0 ,
554+ Status : "enabled" ,
555+ State : "up" ,
556+ DiskAvailableLeast : 0 ,
557+ HostIP : "1.1.1.1" ,
558+ FreeDiskGB : 0 ,
559+ FreeRamMB : 7680 ,
560+ HypervisorHostname : "fake-mini" ,
561+ HypervisorType : "fake" ,
562+ HypervisorVersion : 2002000 ,
563+ ID : "c48f6247-abe4-4a24-824e-ea39e108874f" ,
564+ LocalGB : 0 ,
565+ LocalGBUsed : 0 ,
566+ MemoryMB : 8192 ,
567+ MemoryMBUsed : 512 ,
568+ RunningVMs : 0 ,
569+ Service : hypervisors.Service {
570+ Host : "e6a37ee802d74863ab8b91ade8f12a67" ,
571+ ID : "9c2566e7-7a54-4777-a1ae-c2662f0c407c" ,
572+ DisabledReason : "" ,
573+ },
574+ VCPUs : 1 ,
575+ VCPUsUsed : 0 ,
576+ }
577+
520578 HypervisorsStatisticsExpected = hypervisors.Statistics {
521579 Count : 1 ,
522580 CurrentWorkload : 0 ,
@@ -604,6 +662,16 @@ func HandleHypervisorGetEmptyCPUInfoSuccessfully(t *testing.T) {
604662 })
605663}
606664
665+ func HandleHypervisorAfterV287ResponseSuccessfully (t * testing.T ) {
666+ testhelper .Mux .HandleFunc ("/os-hypervisors/" + HypervisorFake .ID , func (w http.ResponseWriter , r * http.Request ) {
667+ testhelper .TestMethod (t , r , "GET" )
668+ testhelper .TestHeader (t , r , "X-Auth-Token" , client .TokenID )
669+
670+ w .Header ().Add ("Content-Type" , "application/json" )
671+ fmt .Fprintf (w , HypervisorAfterV287ResponseBody )
672+ })
673+ }
674+
607675func HandleHypervisorUptimeSuccessfully (t * testing.T ) {
608676 testhelper .Mux .HandleFunc ("/os-hypervisors/" + HypervisorFake .ID + "/uptime" , func (w http.ResponseWriter , r * http.Request ) {
609677 testhelper .TestMethod (t , r , "GET" )
0 commit comments