turbo-getgroup: the primary users should not be returned

This commit is contained in:
Motiejus Jakštys 2022-07-12 14:05:43 +03:00
parent 2cdc2ae6c6
commit de1ab2d0d1
2 changed files with 31 additions and 1 deletions

View File

@ -270,7 +270,7 @@ pub fn testCorpus(allocator: Allocator) !Corpus {
allocator,
100000,
"service-account",
&[_][]const u8{ "svc-bar", "vidmantas" },
&[_][]const u8{ "svc-bar", "vidmantas", "root" },
);
defer group0.deinit(allocator);
defer group1.deinit(allocator);

View File

@ -249,3 +249,33 @@ test "turbo-getent passwd_all" {
i += 1;
}
}
test "turbo-getent group" {
var tf = try File.TestDB.init(testing.allocator);
defer tf.deinit();
var stdout = ArrayList(u8).init(testing.allocator);
defer stdout.deinit();
var stderr = ArrayList(u8).init(testing.allocator);
defer stderr.deinit();
{
const args = &[_][*:0]const u8{
"--db",
tf.path,
"group",
"root",
"doesnotexist",
"svc-bar",
"0",
"1",
};
const got = execute(stdout.writer(), stderr.writer(), args);
try testing.expectEqual(got, 2);
const want =
\\root:x:0:
\\svc-bar:x:128:root,vidmantas
\\
;
try testing.expectEqualStrings(want, stdout.items);
}
}