Skip to content

Commit 33a03c8

Browse files
committed
Adjust table test for longer architectures
Turns out that "aarch64" is one character longer than "x86_64". In the future, we might want to have a special tablewriter mod. Signed-off-by: Anders F Björklund <[email protected]>
1 parent 9491b7f commit 33a03c8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pkg/store/instance_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"os/user"
66
"path/filepath"
77
"runtime"
8+
"strings"
89
"testing"
910

1011
"github.com/lima-vm/lima/pkg/limayaml"
@@ -15,6 +16,7 @@ const separator = string(filepath.Separator)
1516

1617
var vmtype = limayaml.QEMU
1718
var goarch = limayaml.NewArch(runtime.GOARCH)
19+
var space = strings.Repeat(" ", len(goarch)-4)
1820

1921
var instance = Instance{
2022
Name: "foo",
@@ -33,7 +35,7 @@ var tableEmu = "NAME STATUS SSH ARCH CPUS MEMORY D
3335
var tableHome = "NAME STATUS SSH CPUS MEMORY DISK DIR\n" +
3436
"foo Stopped 127.0.0.1:0 0 0B 0B ~" + separator + "dir\n"
3537

36-
var tableAll = "NAME STATUS SSH VMTYPE ARCH CPUS MEMORY DISK DIR\n" +
38+
var tableAll = "NAME STATUS SSH VMTYPE ARCH" + space + " CPUS MEMORY DISK DIR\n" +
3739
"foo Stopped 127.0.0.1:0 " + vmtype + " " + goarch + " 0 0B 0B dir\n"
3840

3941
// for width 60, everything is hidden
@@ -49,7 +51,7 @@ var table80d = "NAME STATUS SSH ARCH CPUS MEMORY D
4951
"foo Stopped 127.0.0.1:0 unknown 0 0B 0B\n"
5052

5153
// for width 100, nothing is hidden
52-
var table100 = "NAME STATUS SSH VMTYPE ARCH CPUS MEMORY DISK DIR\n" +
54+
var table100 = "NAME STATUS SSH VMTYPE ARCH" + space + " CPUS MEMORY DISK DIR\n" +
5355
"foo Stopped 127.0.0.1:0 " + vmtype + " " + goarch + " 0 0B 0B dir\n"
5456

5557
// for width 80, directory is hidden (if not identical)

0 commit comments

Comments
 (0)