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

chore(main): upgrade hcloud-go to 2.5.0 #631

Merged
merged 1 commit into from
Dec 13, 2023
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
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/golang/mock v1.6.0
github.com/google/go-cmp v0.6.0
github.com/guptarohit/asciigraph v0.5.6
github.com/hetznercloud/hcloud-go/v2 v2.4.0
github.com/hetznercloud/hcloud-go/v2 v2.5.0
github.com/pelletier/go-toml/v2 v2.1.1
github.com/rjeczalik/interfaces v0.3.0
github.com/spf13/cobra v1.8.0
Expand Down Expand Up @@ -40,7 +40,7 @@ require (
github.com/prometheus/procfs v0.11.1 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
golang.org/x/mod v0.9.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/tools v0.6.0 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/guptarohit/asciigraph v0.5.6 h1:0tra3HEhfdj1sP/9IedrCpfSiXYTtHdCgBhBL09Yx6E=
github.com/guptarohit/asciigraph v0.5.6/go.mod h1:dYl5wwK4gNsnFf9Zp+l06rFiDZ5YtXM6x7SRWZ3KGag=
github.com/hetznercloud/hcloud-go/v2 v2.4.0 h1:MqlAE+w125PLvJRCpAJmEwrIxoVdUdOyuFUhE/Ukbok=
github.com/hetznercloud/hcloud-go/v2 v2.4.0/go.mod h1:l7fA5xsncFBzQTyw29/dw5Yr88yEGKKdc6BHf24ONS0=
github.com/hetznercloud/hcloud-go/v2 v2.5.0 h1:FkfiqB2Bz2mLSQqOskWULpmVRYOQgFy7k0hfIuXv4YI=
github.com/hetznercloud/hcloud-go/v2 v2.5.0/go.mod h1:y75vdFT0eNNnYyGWO55Qv0LI23kSgsQZl3Gyy0KMrI4=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
Expand Down Expand Up @@ -101,8 +101,8 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c=
golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand Down
15 changes: 6 additions & 9 deletions internal/cmd/all/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package all

import (
"context"
_ "embed"
"net"
"testing"
"time"
Expand All @@ -13,6 +14,9 @@ import (
"github.com/hetznercloud/hcloud-go/v2/hcloud"
)

//go:embed testdata/all_list_response.json
var allListResponseJson string

func TestListAll(t *testing.T) {
fx := testutil.NewFixture(t)
defer fx.Finish()
Expand Down Expand Up @@ -287,15 +291,8 @@ func TestListAllPaidJSON(t *testing.T) {
AllWithOpts(gomock.Any(), hcloud.VolumeListOpts{}).
Return([]*hcloud.Volume{}, nil)

out, _, err := fx.Run(cmd, []string{"--paid", "-o=json"})

expOut := "{\"floating_ips\":[],\"images\":[{\"id\":114690387,\"status\":\"available\",\"type\":\"system\"," +
"\"name\":\"debian-12\",\"description\":\"Debian 12\",\"image_size\":0,\"disk_size\":5,\"created\":" +
"\"2023-06-13T06:00:00Z\",\"created_from\":null,\"bound_to\":null,\"os_flavor\":\"debian\",\"os_version\":" +
"\"12\",\"architecture\":\"x86\",\"rapid_deploy\":true,\"protection\":{\"delete\":false},\"deprecated\":" +
"\"0001-01-01T00:00:00Z\",\"deleted\":\"0001-01-01T00:00:00Z\",\"labels\":null}],\"load_balancers\":[]," +
"\"primary_ips\":[],\"servers\":[],\"volumes\":[]}\n"
jsonOut, _, err := fx.Run(cmd, []string{"--paid", "-o=json"})

assert.NoError(t, err)
assert.JSONEq(t, expOut, out)
assert.JSONEq(t, allListResponseJson, jsonOut)
}
31 changes: 31 additions & 0 deletions internal/cmd/all/testdata/all_list_response.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"floating_ips": [],
"images": [
{
"id": 114690387,
"status": "available",
"type": "system",
"name": "debian-12",
"description": "Debian 12",
"image_size": 0,
"disk_size": 5,
"created": "2023-06-13T06:00:00Z",
"created_from": null,
"bound_to": null,
"os_flavor": "debian",
"os_version": "12",
"architecture": "x86",
"rapid_deploy": true,
"protection": {
"delete": false
},
"deprecated": "0001-01-01T00:00:00Z",
"deleted": null,
"labels": null
}
],
"load_balancers": [],
"primary_ips": [],
"servers": [],
"volumes": []
}
3 changes: 2 additions & 1 deletion internal/cmd/loadbalancer/testdata/create_response.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"ingoing_traffic": null,
"labels": {},
"load_balancer_type": {
"deprecated": null,
"description": "",
"id": 0,
"max_assigned_certificates": 0,
Expand Down Expand Up @@ -48,4 +49,4 @@
"services": [],
"targets": []
}
}
}
1 change: 1 addition & 0 deletions internal/cmd/primaryip/testdata/create_response.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"name": "fsn1-dc14",
"server_types": {
"available": null,
"available_for_migration": null,
"supported": null
}
},
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/server/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func TestCreateJSON(t *testing.T) {
Status: "available",
Name: hcloud.Ptr("ubuntu-20.04"),
Description: "Ubuntu 20.04",
Deprecated: time.Time{},
Deprecated: nil,
Labels: make(map[string]string),
OSFlavor: "ubuntu",
OSVersion: hcloud.Ptr("20.04"),
Expand All @@ -141,7 +141,7 @@ func TestCreateJSON(t *testing.T) {
Name: "FreeBSD-11.0-RELEASE-amd64-dvd1",
Description: "FreeBSD 11.0 x64",
Type: "public",
Deprecated: time.Time{},
Deprecated: nil,
},
RescueEnabled: true,
Locked: true,
Expand Down
13 changes: 8 additions & 5 deletions internal/cmd/server/testdata/create_response.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,18 @@
"name": "fsn1-dc14",
"server_types": {
"available": null,
"available_for_migration": null,
"supported": null
}
},
"id": 1234,
"image": {
"architecture": "",
"bound_to": null,
"created": "0001-01-01T00:00:00Z",
"created": null,
"created_from": null,
"deleted": "0001-01-01T00:00:00Z",
"deprecated": "0001-01-01T00:00:00Z",
"deleted": null,
"deprecated": null,
"description": "Ubuntu 20.04",
"disk_size": 0,
"id": 1,
Expand All @@ -49,14 +50,15 @@
"ingoing_traffic": null,
"iso": {
"architecture": null,
"deprecated": "0001-01-01T00:00:00Z",
"deprecated": null,
"deprecation": null,
"description": "FreeBSD 11.0 x64",
"id": 1,
"name": "FreeBSD-11.0-RELEASE-amd64-dvd1",
"type": "public"
},
"labels": {},
"load_balancers": null,
"locked": true,
"name": "cli-test",
"outgoing_traffic": null,
Expand Down Expand Up @@ -88,6 +90,7 @@
"architecture": "x86",
"cores": 1,
"cpu_type": "shared",
"deprecated": false,
"deprecation": null,
"description": "",
"disk": 20,
Expand All @@ -101,4 +104,4 @@
"status": "running",
"volumes": null
}
}
}
6 changes: 3 additions & 3 deletions internal/cmd/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,15 +236,15 @@ func ImageToSchema(image hcloud.Image) schema.Image {
Type: string(image.Type),
ImageSize: &image.ImageSize,
DiskSize: image.DiskSize,
Created: image.Created,
Created: &image.Created,
OSFlavor: image.OSFlavor,
OSVersion: hcloud.String(image.OSVersion),
Architecture: string(image.Architecture),
RapidDeploy: image.RapidDeploy,
Protection: schema.ImageProtection{
Delete: image.Protection.Delete,
},
Deprecated: image.Deprecated,
Deprecated: &image.Deprecated,
Labels: image.Labels,
}
if image.CreatedFrom != nil {
Expand All @@ -265,7 +265,7 @@ func ISOToSchema(iso hcloud.ISO) schema.ISO {
Name: iso.Name,
Description: iso.Description,
Type: string(iso.Type),
Deprecated: iso.Deprecated,
Deprecated: &iso.Deprecated,
}

if iso.Architecture != nil {
Expand Down