77 "github.com/UpCloudLtd/upcloud-cli/internal/config"
88 smock "github.com/UpCloudLtd/upcloud-cli/internal/mock"
99 "github.com/UpCloudLtd/upcloud-cli/internal/mockexecute"
10+ "github.com/bradleyjkemp/cupaloy/v2"
1011
1112 "github.com/UpCloudLtd/upcloud-go-api/v4/upcloud"
1213 "github.com/UpCloudLtd/upcloud-go-api/v4/upcloud/request"
@@ -148,52 +149,6 @@ func TestServerHumanOutput(t *testing.T) {
148149 },
149150 }
150151
151- expected := `
152- Common
153- UUID: 0077fa3d-32db-4b09-9f5f-30d9e9afb565
154- Hostname: server1.example.com
155- Title: server1.example.com
156- Plan: 1xCPU-2GB
157- Zone: fi-hel1
158- State: started
159- Simple Backup: 0100,dailies
160- Licence: 0
161- Metadata: True
162- Timezone: UTC
163- Host ID: 7653311107
164- Tags: DEV,Ubuntu
165-
166- Storage: (Flags: B = bootdisk, P = part of plan)
167-
168- UUID Title Type Address Size (GiB) Flags
169- ────────────────────────────────────── ───────────────────────────────── ────── ────────── ──────────── ───────
170- 012580a1-32a1-466e-a323-689ca16f2d43 Storage for server1.example.com disk virtio:0 20 P
171-
172- NICs: (Flags: S = source IP filtering, B = bootable)
173-
174- # Type IP Address MAC Address Network Flags
175- ─── ───────── ──────────────────────────────────────────────────── ─────────────────── ────────────────────────────────────── ───────
176- 1 public IPv4: 94.237.0.207 de:ff:ff:ff:66:89 037fcf2a-6745-45dd-867e-f9479ea8c044
177- 2 utility IPv4: 10.6.3.95 (f) de:ff:ff:ff:ed:85 03000000-0000-4000-8045-000000000000
178- 3 public IPv6: xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx de:ff:ff:ff:cc:20 03c93fd8-cc60-4849-91b8-6e404b228e2a
179-
180- Firewall Rules:
181-
182- # Direction Action Src IPAddress Dest IPAddress Src Port Dest Port Protocol
183- ─── ─────────── ──────── ─────────────── ──────────────── ────────── ─────────── ───────────────
184- 1 in accept Any Any Any Any IPv4/tcp
185- 2 out drop 10.10.10.0 → 10.20.20.0 0 → Any IPv4/udp/icmp
186- 10.10.10.99 1024
187-
188-
189- Remote Access
190- Type: vnc
191- Host: fi-hel1.vnc.upcloud.com
192- Port: 3000
193- Password: aabbccdd
194-
195- `
196-
197152 mService := smock.Service {}
198153 mService .On ("GetServers" ).Return (& upcloud.Servers {Servers : []upcloud.Server {srv .Server }}, nil )
199154 mService .On ("GetServerDetails" , & request.GetServerDetailsRequest {UUID : uuid }).Return (srv , nil )
@@ -213,5 +168,5 @@ func TestServerHumanOutput(t *testing.T) {
213168 output , err := mockexecute .MockExecute (command , & mService , conf )
214169
215170 assert .NoError (t , err )
216- assert . Equal ( t , expected , output )
171+ cupaloy . SnapshotT ( t , output )
217172}
0 commit comments