Skip to content
Open
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
18 changes: 9 additions & 9 deletions internal/cmd/all/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,12 @@ func TestListAll(t *testing.T) {
expOut := `SERVERS
---
ID NAME STATUS IPV4 IPV6 PRIVATE NET LOCATION AGE
123 my server running 192.0.2.1 - - hel1 3d
123 my server running 192.0.2.1 - - hel1 3d

IMAGES
---
ID TYPE NAME DESCRIPTION ARCHITECTURE IMAGE SIZE DISK SIZE CREATED DEPRECATED
1 backup test - arm - 20 GB 2036-08-20 12:00:00 UTC -
1 backup test - arm - 20 GB 2036-08-20 12:00:00 UTC -

PLACEMENT GROUPS
---
Expand All @@ -253,12 +253,12 @@ ID NAME SERVERS TYPE AGE
PRIMARY IPS
---
ID TYPE NAME IP ASSIGNEE DNS AUTO DELETE AGE
123 ipv4 test 127.0.0.1 - - no 2h
123 ipv4 test 127.0.0.1 - - no 2h

ISOS
---
ID NAME DESCRIPTION TYPE ARCHITECTURE
123 test - private arm
123 test - private arm

VOLUMES
---
Expand All @@ -268,12 +268,12 @@ ID NAME SIZE SERVER LOCATION AGE
LOAD BALANCER
---
ID NAME HEALTH IPV4 IPV6 TYPE LOCATION NETWORK ZONE AGE
123 foobar healthy 192.0.2.1 :: lb11 fsn1 eu-central 5h
123 foobar healthy 192.0.2.1 :: lb11 fsn1 eu-central 5h

FLOATING IPS
---
ID TYPE NAME DESCRIPTION IP HOME SERVER DNS AGE
123 ipv4 test - 127.0.0.1 fsn1 - - 1d
123 ipv4 test - 127.0.0.1 fsn1 - - 1d

NETWORKS
---
Expand All @@ -283,7 +283,7 @@ ID NAME IP RANGE SERVERS AGE
FIREWALLS
---
ID NAME RULES COUNT APPLIED TO COUNT AGE
123 test 5 Rules 2 Servers | 0 Label Selectors 7m
123 test 5 Rules 2 Servers | 0 Label Selectors 7m

CERTIFICATES
---
Expand All @@ -293,12 +293,12 @@ ID NAME TYPE DOMAIN NAMES NOT VALID AFTER AGE
SSH KEYS
---
ID NAME FINGERPRINT AGE
123 test - 2h
123 test - 2h

STORAGE BOXES
---
ID NAME USERNAME SERVER TYPE SIZE LOCATION AGE
123 test u12345 u1337.your-storagebox.de bx11 42 GiB fsn1 3h
123 test u12345 u1337.your-storagebox.de bx11 42 GiB fsn1 3h

ZONES
---
Expand Down
8 changes: 4 additions & 4 deletions internal/cmd/base/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ func TestList(t *testing.T) {
testutil.TestCommand(t, fakeListCmd, map[string]testutil.TestCase{
"no flags": {
Args: []string{"list"},
ExpOut: `ID NAME
123 test
ExpOut: `ID NAME
123 test
456 test2
789 test3
`,
Expand All @@ -102,8 +102,8 @@ func TestList(t *testing.T) {
},
"quiet": {
Args: []string{"list", "--quiet"},
ExpOut: `ID NAME
123 test
ExpOut: `ID NAME
123 test
456 test2
789 test3
`,
Expand Down
54 changes: 27 additions & 27 deletions internal/cmd/config/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,52 +58,52 @@ func TestList(t *testing.T) {
{
name: "default",
args: []string{},
expOut: `KEY VALUE
context test_context
debug yes
deeply.nested.option bar
expOut: `KEY VALUE
context test_context
debug yes
deeply.nested.option bar
endpoint https://example.com
poll-interval 1.234s
quiet yes
token [redacted]
poll-interval 1.234s
quiet yes
token [redacted]
`,
},
{
name: "only key",
args: []string{"-o=columns=key"},
expOut: `KEY
context
debug
expOut: `KEY
context
debug
deeply.nested.option
endpoint
poll-interval
quiet
token
endpoint
poll-interval
quiet
token
`,
},
{
name: "no header",
args: []string{"-o=noheader"},
expOut: `context test_context
debug yes
deeply.nested.option bar
expOut: `context test_context
debug yes
deeply.nested.option bar
endpoint https://example.com
poll-interval 1.234s
quiet yes
token [redacted]
poll-interval 1.234s
quiet yes
token [redacted]
`,
},
{
name: "allow sensitive",
args: []string{"--allow-sensitive"},
expOut: `KEY VALUE
context test_context
debug yes
deeply.nested.option bar
expOut: `KEY VALUE
context test_context
debug yes
deeply.nested.option bar
endpoint https://example.com
poll-interval 1.234s
quiet yes
token super secret token
poll-interval 1.234s
quiet yes
token super secret token
`,
},
{
Expand Down
12 changes: 6 additions & 6 deletions internal/cmd/context/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ token = "yet another super secret token"
name: "default",
args: []string{},
config: testConfig,
expOut: `ACTIVE NAME
* my-context
expOut: `ACTIVE NAME
* my-context
my-other-context
my-third-context
`,
Expand All @@ -59,7 +59,7 @@ token = "yet another super secret token"
name: "no header",
args: []string{"-o=noheader"},
config: testConfig,
expOut: `* my-context
expOut: `* my-context
my-other-context
my-third-context
`,
Expand All @@ -68,7 +68,7 @@ token = "yet another super secret token"
name: "no header only name",
args: []string{"-o=noheader", "-o=columns=name"},
config: testConfig,
expOut: `my-context
expOut: `my-context
my-other-context
my-third-context
`,
Expand All @@ -83,8 +83,8 @@ my-third-context
postRun: func() {
_ = os.Unsetenv("HCLOUD_CONTEXT")
},
expOut: `ACTIVE NAME
my-context
expOut: `ACTIVE NAME
my-context
* my-other-context
my-third-context
`,
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/datacenter/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func TestList(t *testing.T) {
out, errOut, err := fx.Run(cmd, []string{})

expOut := `ID NAME DESCRIPTION LOCATION
4 fsn1-dc14 Falkenstein 1 virtual DC 14 fsn1
4 fsn1-dc14 Falkenstein 1 virtual DC 14 fsn1
`

require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/image/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func TestList(t *testing.T) {
out, errOut, err := fx.Run(cmd, []string{})

expOut := `ID TYPE NAME DESCRIPTION ARCHITECTURE IMAGE SIZE DISK SIZE CREATED DEPRECATED
123 system test - x86 20.00 GB 15 GB 2036-08-20 12:00:00 UTC -
123 system test - x86 20.00 GB 15 GB 2036-08-20 12:00:00 UTC -
`

require.NoError(t, err)
Expand Down
6 changes: 3 additions & 3 deletions internal/cmd/iso/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func TestList(t *testing.T) {
out, errOut, err := fx.Run(cmd, []string{})

expOut := `ID NAME DESCRIPTION TYPE ARCHITECTURE
123 test Test ISO public x86
123 test Test ISO public x86
`

require.NoError(t, err)
Expand Down Expand Up @@ -95,8 +95,8 @@ func TestListPrivate(t *testing.T) {
out, errOut, err := fx.Run(cmd, []string{"--type=private"})

expOut := `ID NAME DESCRIPTION TYPE ARCHITECTURE
456 private1 Test Private ISO 1 private x86
789 private2 Test Private ISO 2 private x86
456 private1 Test Private ISO 1 private x86
789 private2 Test Private ISO 2 private x86
`

require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/loadbalancertype/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func TestList(t *testing.T) {
out, errOut, err := fx.Run(cmd, []string{})

expOut := `ID NAME DESCRIPTION MAX SERVICES MAX CONNECTIONS MAX TARGETS
123 test - 12 100 5
123 test - 12 100 5
`

require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/location/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func TestList(t *testing.T) {

out, errOut, err := fx.Run(cmd, []string{})

expOut := `ID NAME DESCRIPTION NETWORK ZONE COUNTRY CITY
expOut := `ID NAME DESCRIPTION NETWORK ZONE COUNTRY CITY
1 fsn1 - eu-central DE Falkenstein
`

Expand Down
1 change: 1 addition & 0 deletions internal/cmd/output/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ func NewTable[T any](out io.Writer) *Table[T] {

w := table.NewWriter()
w.SetStyle(style)
w.SuppressTrailingSpaces()

return &Table[T]{
out: out,
Expand Down
6 changes: 3 additions & 3 deletions internal/cmd/servertype/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func TestList(t *testing.T) {
out, errOut, err := fx.Run(cmd, []string{})

expOut := `ID NAME CORES CPU TYPE ARCHITECTURE MEMORY DISK STORAGE TYPE
123 test 2 shared arm 8.0 GB 80 GB local
123 test 2 shared arm 8.0 GB 80 GB local
`

require.NoError(t, err)
Expand Down Expand Up @@ -100,9 +100,9 @@ func TestListColumnDeprecated(t *testing.T) {

out, errOut, err := fx.Run(cmd, []string{"-o=columns=id,name,deprecated"})

expOut := `ID NAME DEPRECATED
expOut := `ID NAME DEPRECATED
123 deprecated fsn1=2025-04-01,nbg1=2025-05-01
124 current -
124 current -
`

require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/sshkey/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func TestList(t *testing.T) {
out, errOut, err := fx.Run(cmd, []string{})

expOut := `ID NAME FINGERPRINT AGE
123 test - 1h
123 test - 1h
`

require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/storagebox/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func TestList(t *testing.T) {
out, errOut, err := fx.Run(cmd, []string{})

expOut := `ID NAME USERNAME SERVER TYPE SIZE LOCATION AGE
123 test u12345 u1337.your-storagebox.de bx11 42 GiB fsn1 3h
123 test u12345 u1337.your-storagebox.de bx11 42 GiB fsn1 3h
`

require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/storagebox/snapshot/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func TestList(t *testing.T) {

out, errOut, err := fx.Run(cmd, []string{"test"})

expOut := fmt.Sprintf(`ID NAME DESCRIPTION SIZE IS AUTOMATIC AGE
expOut := fmt.Sprintf(`ID NAME DESCRIPTION SIZE IS AUTOMATIC AGE
456 snapshot-1 some-description 50 GiB no %s
`, util.Age(sbs.Created, time.Now()))

Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/storagebox/subaccount/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func TestList(t *testing.T) {

out, errOut, err := fx.Run(cmd, []string{"test"})

expOut := fmt.Sprintf(`ID NAME HOME DIRECTORY DESCRIPTION USERNAME SERVER AGE
expOut := fmt.Sprintf(`ID NAME HOME DIRECTORY DESCRIPTION USERNAME SERVER AGE
42 u1337-sub1 my_backups/host01.my.company host01 backup u1337-sub1 u1337-sub1.your-storagebox.de %s
`, util.Age(sbs.Created, time.Now()))

Expand Down
6 changes: 3 additions & 3 deletions internal/cmd/storageboxtype/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func TestList(t *testing.T) {
out, errOut, err := fx.Run(cmd, []string{})

expOut := `ID NAME DESCRIPTION SIZE SNAPSHOT LIMIT AUTOMATIC SNAPSHOT LIMIT SUBACCOUNTS LIMIT
42 bx11 BX11 1.0 GiB 10 10 200
42 bx11 BX11 1.0 GiB 10 10 200
`

require.NoError(t, err)
Expand Down Expand Up @@ -88,9 +88,9 @@ func TestListColumnDeprecated(t *testing.T) {

out, errOut, err := fx.Run(cmd, []string{"-o=columns=id,name,deprecated"})

expOut := `ID NAME DEPRECATED
expOut := `ID NAME DEPRECATED
123 deprecated 2037-08-20 12:00:00 UTC
124 current -
124 current -
`

require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/volume/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func TestList(t *testing.T) {
out, errOut, err := fx.Run(cmd, []string{})

expOut := `ID NAME SIZE SERVER LOCATION AGE
123 test 50 GB myServer fsn1 1h
123 test 50 GB myServer fsn1 1h
`

require.NoError(t, err)
Expand Down
6 changes: 3 additions & 3 deletions internal/cmd/zone/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func TestList(t *testing.T) {

out, errOut, err := fx.Run(cmd, []string{})

expOut := fmt.Sprintf(`ID NAME STATUS MODE RECORD COUNT AGE
expOut := fmt.Sprintf(`ID NAME STATUS MODE RECORD COUNT AGE
42 example.com ok primary 0 %s
`, util.Age(z.Created, time.Now()))

Expand Down Expand Up @@ -98,7 +98,7 @@ func TestListPrimaryNameservers(t *testing.T) {

out, errOut, err := fx.Run(cmd, []string{"-o=columns=id,primary_nameservers"})

expOut := `ID PRIMARY NAMESERVERS
expOut := `ID PRIMARY NAMESERVERS
42 primary.example.com:53, 192.0.2.7:53, [2001:db8::7]:53
`

Expand Down Expand Up @@ -136,7 +136,7 @@ func TestListAuthoritativeNameservers(t *testing.T) {

out, errOut, err := fx.Run(cmd, []string{"-o=columns=id,authoritative_nameservers"})

expOut := `ID AUTHORITATIVE NAMESERVERS
expOut := `ID AUTHORITATIVE NAMESERVERS
42 helium.ns.hetzner.de., hydrogen.ns.hetzner.com., oxygen.ns.hetzner.com.
`

Expand Down
Loading
Loading