Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hardware type and linode label fields to volume struct #604

Merged
merged 6 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
555 changes: 286 additions & 269 deletions test/integration/fixtures/TestVolume_WaitForLinodeID_linode.yaml

Large diffs are not rendered by default.

539 changes: 278 additions & 261 deletions test/integration/fixtures/TestVolume_WaitForLinodeID_nil.yaml

Large diffs are not rendered by default.

557 changes: 287 additions & 270 deletions test/integration/fixtures/TestVolume_WaitForLinodeID_volume.yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ interactions:
- application/json
User-Agent:
- linodego/dev https://github.com/linode/linodego
url: https://api.linode.com/v4beta/volumes/4979073
url: https://api.linode.com/v4beta/volumes/7301562
method: GET
response:
body: '{"id": 4979073, "status": "active", "label": "go-vol-test-def", "created":
body: '{"id": 7301562, "status": "active", "label": "go-vol-test-def", "created":
"2018-01-02T03:04:05", "updated": "2018-01-02T03:04:05", "filesystem_path":
"/dev/disk/by-id/scsi-0Linode_Volume_go-vol-test-def", "size": 20, "linode_id":
61342082, "linode_label": "go-test-ins-8w21pl1h4n1x", "region": "ap-west", "tags":
[], "hardware_type": "nvme"}'
67701824, "linode_label": "go-test-ins-4n57ej5b4bz0", "region": "ap-west", "tags":
[], "hardware_type": "nvme", "encryption": "disabled"}'
headers:
Access-Control-Allow-Credentials:
- "true"
Expand All @@ -37,13 +37,13 @@ interactions:
Connection:
- keep-alive
Content-Length:
- "342"
- "368"
Content-Security-Policy:
- default-src 'none'
Content-Type:
- application/json
Expires:
- Thu, 11 Jul 2024 20:02:05 GMT
- Thu, 28 Nov 2024 05:53:18 GMT
Pragma:
- no-cache
Strict-Transport-Security:
Expand All @@ -61,7 +61,7 @@ interactions:
X-Oauth-Scopes:
- '*'
X-Ratelimit-Limit:
- "400"
- "1600"
X-Xss-Protection:
- 1; mode=block
status: 200 OK
Expand Down
5 changes: 4 additions & 1 deletion test/integration/volumes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,13 @@ func TestVolume_WaitForLinodeID(t *testing.T) {
client, teardownWait := createTestClient(t, "fixtures/TestVolume_WaitForLinodeID_waiting")
defer teardownWait()

_, errWait = client.WaitForVolumeLinodeID(context.Background(), volume.ID, &instance.ID, 20)
v, errWait := client.WaitForVolumeLinodeID(context.Background(), volume.ID, &instance.ID, 20)
if errWait != nil {
t.Errorf("Error waiting for volume %d to attach to instance %d: %s", volume.ID, instance.ID, errWait)
}
if v.LinodeLabel != instance.Label {
t.Error("Error linode label mismatched")
}
}

func TestVolume_Update(t *testing.T) {
Expand Down
2 changes: 2 additions & 0 deletions volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ type Volume struct {
LinodeID *int `json:"linode_id"`
FilesystemPath string `json:"filesystem_path"`
Tags []string `json:"tags"`
HardwareType string `json:"hardware_type"`
LinodeLabel string `json:"linode_label"`
Created *time.Time `json:"-"`
Updated *time.Time `json:"-"`

Expand Down
Loading