mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-11-06 03:57:48 +01:00
shell: use tabwriter for aligned output, remove fragile string error checks
- Use text/tabwriter in runS3UserList and runS3UserAccessKeyList for properly aligned column output - Remove fragile strings.Contains "not found" and "already exists" fallbacks in s3ShellIsNotFound and s3ShellIsAlreadyExists; rely on typed errors and gRPC status codes only - Update test assertions to match tabwriter-formatted output
This commit is contained in:
1 parent
d4261c2271
commit
08dbfce493
2 files changed
+15
-12
No files matched your search
@@ -100,13 +100,13 @@ func TestRunS3UserListIncludesSourceAndStatus(t *testing.T) {
|
||||
}
|
||||
|
||||
output := out.String()
|
||||
if !strings.Contains(output, "NAME\tSOURCE\tSTATUS\tACCESS KEYS\tPOLICIES") {
|
||||
if !strings.Contains(output, "NAME") || !strings.Contains(output, "SOURCE") || !strings.Contains(output, "STATUS") {
|
||||
t.Fatalf("expected header, got %q", output)
|
||||
}
|
||||
if !strings.Contains(output, "alice\tdynamic\tenabled\t1\t0") {
|
||||
if !strings.Contains(output, "alice") || !strings.Contains(output, "dynamic") || !strings.Contains(output, "enabled") {
|
||||
t.Fatalf("expected dynamic user row, got %q", output)
|
||||
}
|
||||
if !strings.Contains(output, "bootstrap-admin\tstatic\tdisabled\t0\t0") {
|
||||
if !strings.Contains(output, "bootstrap-admin") || !strings.Contains(output, "static") || !strings.Contains(output, "disabled") {
|
||||
t.Fatalf("expected static user row, got %q", output)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user