File: fixtures.go

package info (click to toggle)
golang-github-rackspace-gophercloud 1.0.0%2Bgit20160603.920.934dbf8-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 4,936 kB
  • ctags: 6,116
  • sloc: sh: 16; makefile: 4
file content (137 lines) | stat: -rw-r--r-- 3,589 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
// +build fixtures

package flavors

// ListOutput is a sample response of a flavor List request.
const ListOutput = `
{
  "flavors": [
    {
      "OS-FLV-EXT-DATA:ephemeral": 0,
      "OS-FLV-WITH-EXT-SPECS:extra_specs": {
        "class": "performance1",
        "disk_io_index": "40",
        "number_of_data_disks": "0",
        "policy_class": "performance_flavor",
        "resize_policy_class": "performance_flavor"
      },
      "disk": 20,
      "id": "performance1-1",
      "links": [
        {
          "href": "https://iad.servers.api.rackspacecloud.com/v2/864477/flavors/performance1-1",
          "rel": "self"
        },
        {
          "href": "https://iad.servers.api.rackspacecloud.com/864477/flavors/performance1-1",
          "rel": "bookmark"
        }
      ],
      "name": "1 GB Performance",
      "ram": 1024,
      "rxtx_factor": 200,
      "swap": "",
      "vcpus": 1
    },
    {
      "OS-FLV-EXT-DATA:ephemeral": 20,
      "OS-FLV-WITH-EXT-SPECS:extra_specs": {
        "class": "performance1",
        "disk_io_index": "40",
        "number_of_data_disks": "1",
        "policy_class": "performance_flavor",
        "resize_policy_class": "performance_flavor"
      },
      "disk": 40,
      "id": "performance1-2",
      "links": [
        {
          "href": "https://iad.servers.api.rackspacecloud.com/v2/864477/flavors/performance1-2",
          "rel": "self"
        },
        {
          "href": "https://iad.servers.api.rackspacecloud.com/864477/flavors/performance1-2",
          "rel": "bookmark"
        }
      ],
      "name": "2 GB Performance",
      "ram": 2048,
      "rxtx_factor": 400,
      "swap": "",
      "vcpus": 2
    }
  ]
}`

// GetOutput is a sample response from a flavor Get request. Its contents correspond to the
// Performance1Flavor struct.
const GetOutput = `
{
  "flavor": {
    "OS-FLV-EXT-DATA:ephemeral": 0,
    "OS-FLV-WITH-EXT-SPECS:extra_specs": {
      "class": "performance1",
      "disk_io_index": "40",
      "number_of_data_disks": "0",
      "policy_class": "performance_flavor",
      "resize_policy_class": "performance_flavor"
    },
    "disk": 20,
    "id": "performance1-1",
    "links": [
      {
        "href": "https://iad.servers.api.rackspacecloud.com/v2/864477/flavors/performance1-1",
        "rel": "self"
      },
      {
        "href": "https://iad.servers.api.rackspacecloud.com/864477/flavors/performance1-1",
        "rel": "bookmark"
      }
    ],
    "name": "1 GB Performance",
    "ram": 1024,
    "rxtx_factor": 200,
    "swap": "",
    "vcpus": 1
  }
}
`

// Performance1Flavor is the expected result of parsing GetOutput, or the first element of
// ListOutput.
var Performance1Flavor = Flavor{
	ID:         "performance1-1",
	Disk:       20,
	RAM:        1024,
	Name:       "1 GB Performance",
	RxTxFactor: 200.0,
	Swap:       0,
	VCPUs:      1,
	ExtraSpecs: ExtraSpecs{
		NumDataDisks: 0,
		Class:        "performance1",
		DiskIOIndex:  0,
		PolicyClass:  "performance_flavor",
	},
}

// Performance2Flavor is the second result expected from parsing ListOutput.
var Performance2Flavor = Flavor{
	ID:         "performance1-2",
	Disk:       40,
	RAM:        2048,
	Name:       "2 GB Performance",
	RxTxFactor: 400.0,
	Swap:       0,
	VCPUs:      2,
	ExtraSpecs: ExtraSpecs{
		NumDataDisks: 0,
		Class:        "performance1",
		DiskIOIndex:  0,
		PolicyClass:  "performance_flavor",
	},
}

// ExpectedFlavorSlice is the slice of Flavor structs that are expected to be parsed from
// ListOutput.
var ExpectedFlavorSlice = []Flavor{Performance1Flavor, Performance2Flavor}