Skip to content

Commit 7212ba9

Browse files
Add hardware type and linode label fields to volume struct (#604)
* Add hardware type and linode label fields to volume struct * Update tests
1 parent 95e95bd commit 7212ba9

File tree

6 files changed

+864
-808
lines changed

6 files changed

+864
-808
lines changed

test/integration/fixtures/TestVolume_WaitForLinodeID_linode.yaml

Lines changed: 286 additions & 269 deletions
Large diffs are not rendered by default.

test/integration/fixtures/TestVolume_WaitForLinodeID_nil.yaml

Lines changed: 278 additions & 261 deletions
Large diffs are not rendered by default.

test/integration/fixtures/TestVolume_WaitForLinodeID_volume.yaml

Lines changed: 287 additions & 270 deletions
Large diffs are not rendered by default.

test/integration/fixtures/TestVolume_WaitForLinodeID_waiting.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ interactions:
1111
- application/json
1212
User-Agent:
1313
- linodego/dev https://github.com/linode/linodego
14-
url: https://api.linode.com/v4beta/volumes/4979073
14+
url: https://api.linode.com/v4beta/volumes/7301562
1515
method: GET
1616
response:
17-
body: '{"id": 4979073, "status": "active", "label": "go-vol-test-def", "created":
17+
body: '{"id": 7301562, "status": "active", "label": "go-vol-test-def", "created":
1818
"2018-01-02T03:04:05", "updated": "2018-01-02T03:04:05", "filesystem_path":
1919
"/dev/disk/by-id/scsi-0Linode_Volume_go-vol-test-def", "size": 20, "linode_id":
20-
61342082, "linode_label": "go-test-ins-8w21pl1h4n1x", "region": "ap-west", "tags":
21-
[], "hardware_type": "nvme"}'
20+
67701824, "linode_label": "go-test-ins-4n57ej5b4bz0", "region": "ap-west", "tags":
21+
[], "hardware_type": "nvme", "encryption": "disabled"}'
2222
headers:
2323
Access-Control-Allow-Credentials:
2424
- "true"
@@ -37,13 +37,13 @@ interactions:
3737
Connection:
3838
- keep-alive
3939
Content-Length:
40-
- "342"
40+
- "368"
4141
Content-Security-Policy:
4242
- default-src 'none'
4343
Content-Type:
4444
- application/json
4545
Expires:
46-
- Thu, 11 Jul 2024 20:02:05 GMT
46+
- Thu, 28 Nov 2024 05:53:18 GMT
4747
Pragma:
4848
- no-cache
4949
Strict-Transport-Security:
@@ -61,7 +61,7 @@ interactions:
6161
X-Oauth-Scopes:
6262
- '*'
6363
X-Ratelimit-Limit:
64-
- "400"
64+
- "1600"
6565
X-Xss-Protection:
6666
- 1; mode=block
6767
status: 200 OK

test/integration/volumes_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,13 @@ func TestVolume_WaitForLinodeID(t *testing.T) {
215215
client, teardownWait := createTestClient(t, "fixtures/TestVolume_WaitForLinodeID_waiting")
216216
defer teardownWait()
217217

218-
_, errWait = client.WaitForVolumeLinodeID(context.Background(), volume.ID, &instance.ID, 20)
218+
v, errWait := client.WaitForVolumeLinodeID(context.Background(), volume.ID, &instance.ID, 20)
219219
if errWait != nil {
220220
t.Errorf("Error waiting for volume %d to attach to instance %d: %s", volume.ID, instance.ID, errWait)
221221
}
222+
if v.LinodeLabel != instance.Label {
223+
t.Error("Error linode label mismatched")
224+
}
222225
}
223226

224227
func TestVolume_Update(t *testing.T) {

volumes.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ type Volume struct {
3535
LinodeID *int `json:"linode_id"`
3636
FilesystemPath string `json:"filesystem_path"`
3737
Tags []string `json:"tags"`
38+
HardwareType string `json:"hardware_type"`
39+
LinodeLabel string `json:"linode_label"`
3840
Created *time.Time `json:"-"`
3941
Updated *time.Time `json:"-"`
4042

0 commit comments

Comments
 (0)