Ash Wilson | 6f3162a | 2014-10-20 17:28:36 -0400 | [diff] [blame] | 1 | // +build fixtures |
Alex Gaynor | 2f07174 | 2014-11-13 12:03:29 -0800 | [diff] [blame] | 2 | |
Ash Wilson | 6f3162a | 2014-10-20 17:28:36 -0400 | [diff] [blame] | 3 | package flavors |
| 4 | |
Ash Wilson | 6f3162a | 2014-10-20 17:28:36 -0400 | [diff] [blame] | 5 | // ListOutput is a sample response of a flavor List request. |
| 6 | const ListOutput = ` |
| 7 | { |
| 8 | "flavors": [ |
| 9 | { |
| 10 | "OS-FLV-EXT-DATA:ephemeral": 0, |
| 11 | "OS-FLV-WITH-EXT-SPECS:extra_specs": { |
| 12 | "class": "performance1", |
| 13 | "disk_io_index": "40", |
| 14 | "number_of_data_disks": "0", |
| 15 | "policy_class": "performance_flavor", |
| 16 | "resize_policy_class": "performance_flavor" |
| 17 | }, |
| 18 | "disk": 20, |
| 19 | "id": "performance1-1", |
| 20 | "links": [ |
| 21 | { |
| 22 | "href": "https://iad.servers.api.rackspacecloud.com/v2/864477/flavors/performance1-1", |
| 23 | "rel": "self" |
| 24 | }, |
| 25 | { |
| 26 | "href": "https://iad.servers.api.rackspacecloud.com/864477/flavors/performance1-1", |
| 27 | "rel": "bookmark" |
| 28 | } |
| 29 | ], |
| 30 | "name": "1 GB Performance", |
| 31 | "ram": 1024, |
| 32 | "rxtx_factor": 200, |
| 33 | "swap": "", |
| 34 | "vcpus": 1 |
| 35 | }, |
| 36 | { |
| 37 | "OS-FLV-EXT-DATA:ephemeral": 20, |
| 38 | "OS-FLV-WITH-EXT-SPECS:extra_specs": { |
| 39 | "class": "performance1", |
| 40 | "disk_io_index": "40", |
| 41 | "number_of_data_disks": "1", |
| 42 | "policy_class": "performance_flavor", |
| 43 | "resize_policy_class": "performance_flavor" |
| 44 | }, |
| 45 | "disk": 40, |
| 46 | "id": "performance1-2", |
| 47 | "links": [ |
| 48 | { |
| 49 | "href": "https://iad.servers.api.rackspacecloud.com/v2/864477/flavors/performance1-2", |
| 50 | "rel": "self" |
| 51 | }, |
| 52 | { |
| 53 | "href": "https://iad.servers.api.rackspacecloud.com/864477/flavors/performance1-2", |
| 54 | "rel": "bookmark" |
| 55 | } |
| 56 | ], |
| 57 | "name": "2 GB Performance", |
| 58 | "ram": 2048, |
| 59 | "rxtx_factor": 400, |
| 60 | "swap": "", |
| 61 | "vcpus": 2 |
| 62 | } |
| 63 | ] |
| 64 | }` |
| 65 | |
| 66 | // GetOutput is a sample response from a flavor Get request. Its contents correspond to the |
| 67 | // Performance1Flavor struct. |
| 68 | const GetOutput = ` |
| 69 | { |
| 70 | "flavor": { |
| 71 | "OS-FLV-EXT-DATA:ephemeral": 0, |
| 72 | "OS-FLV-WITH-EXT-SPECS:extra_specs": { |
| 73 | "class": "performance1", |
| 74 | "disk_io_index": "40", |
| 75 | "number_of_data_disks": "0", |
| 76 | "policy_class": "performance_flavor", |
| 77 | "resize_policy_class": "performance_flavor" |
| 78 | }, |
| 79 | "disk": 20, |
| 80 | "id": "performance1-1", |
| 81 | "links": [ |
| 82 | { |
| 83 | "href": "https://iad.servers.api.rackspacecloud.com/v2/864477/flavors/performance1-1", |
| 84 | "rel": "self" |
| 85 | }, |
| 86 | { |
| 87 | "href": "https://iad.servers.api.rackspacecloud.com/864477/flavors/performance1-1", |
| 88 | "rel": "bookmark" |
| 89 | } |
| 90 | ], |
| 91 | "name": "1 GB Performance", |
| 92 | "ram": 1024, |
| 93 | "rxtx_factor": 200, |
| 94 | "swap": "", |
| 95 | "vcpus": 1 |
| 96 | } |
| 97 | } |
| 98 | ` |
| 99 | |
| 100 | // Performance1Flavor is the expected result of parsing GetOutput, or the first element of |
| 101 | // ListOutput. |
Jon Perritt | 52e6ada | 2015-07-16 17:58:04 -0600 | [diff] [blame] | 102 | var Performance1Flavor = Flavor{ |
Ash Wilson | 6f3162a | 2014-10-20 17:28:36 -0400 | [diff] [blame] | 103 | ID: "performance1-1", |
| 104 | Disk: 20, |
| 105 | RAM: 1024, |
| 106 | Name: "1 GB Performance", |
| 107 | RxTxFactor: 200.0, |
| 108 | Swap: 0, |
| 109 | VCPUs: 1, |
Jon Perritt | 52e6ada | 2015-07-16 17:58:04 -0600 | [diff] [blame] | 110 | ExtraSpecs: ExtraSpecs{ |
| 111 | NumDataDisks: 0, |
| 112 | Class: "performance1", |
| 113 | DiskIOIndex: 0, |
| 114 | PolicyClass: "performance_flavor", |
| 115 | }, |
Ash Wilson | 6f3162a | 2014-10-20 17:28:36 -0400 | [diff] [blame] | 116 | } |
| 117 | |
| 118 | // Performance2Flavor is the second result expected from parsing ListOutput. |
Jon Perritt | 52e6ada | 2015-07-16 17:58:04 -0600 | [diff] [blame] | 119 | var Performance2Flavor = Flavor{ |
Ash Wilson | 6f3162a | 2014-10-20 17:28:36 -0400 | [diff] [blame] | 120 | ID: "performance1-2", |
| 121 | Disk: 40, |
| 122 | RAM: 2048, |
| 123 | Name: "2 GB Performance", |
| 124 | RxTxFactor: 400.0, |
| 125 | Swap: 0, |
| 126 | VCPUs: 2, |
Jon Perritt | 52e6ada | 2015-07-16 17:58:04 -0600 | [diff] [blame] | 127 | ExtraSpecs: ExtraSpecs{ |
| 128 | NumDataDisks: 0, |
| 129 | Class: "performance1", |
| 130 | DiskIOIndex: 0, |
| 131 | PolicyClass: "performance_flavor", |
| 132 | }, |
Ash Wilson | 6f3162a | 2014-10-20 17:28:36 -0400 | [diff] [blame] | 133 | } |
| 134 | |
| 135 | // ExpectedFlavorSlice is the slice of Flavor structs that are expected to be parsed from |
| 136 | // ListOutput. |
Jon Perritt | 52e6ada | 2015-07-16 17:58:04 -0600 | [diff] [blame] | 137 | var ExpectedFlavorSlice = []Flavor{Performance1Flavor, Performance2Flavor} |