Compare commits
2 commits
41dfa0e443
...
8858abb1a6
Author | SHA1 | Date | |
---|---|---|---|
8858abb1a6 | |||
ef619eca99 |
|
@ -101,7 +101,7 @@ sub new {
|
||||||
$opts{'before_init'}->($self);
|
$opts{'before_init'}->($self);
|
||||||
}
|
}
|
||||||
|
|
||||||
expectOkay(5, ("hydra-init"));
|
expectOkay(30, ("hydra-init"));
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ sub add_user {
|
||||||
my $email = $opts{'email'} // "$name\@example";
|
my $email = $opts{'email'} // "$name\@example";
|
||||||
my $password = $opts{'password'} // rand_chars();
|
my $password = $opts{'password'} // rand_chars();
|
||||||
|
|
||||||
my ($res, $stdout, $stderr) = captureStdoutStderr(1, ("slappasswd", "-s", $password));
|
my ($res, $stdout, $stderr) = captureStdoutStderr(5, ("slappasswd", "-s", $password));
|
||||||
if ($res) {
|
if ($res) {
|
||||||
die "Failed to execute slappasswd ($res): $stderr, $stdout";
|
die "Failed to execute slappasswd ($res): $stderr, $stdout";
|
||||||
}
|
}
|
||||||
|
@ -178,7 +178,7 @@ sub start {
|
||||||
sub validateConfig {
|
sub validateConfig {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
|
||||||
expectOkay(1, ("slaptest", "-u", "-F", $self->{"_slapd_dir"}));
|
expectOkay(5, ("slaptest", "-u", "-F", $self->{"_slapd_dir"}));
|
||||||
}
|
}
|
||||||
|
|
||||||
sub _spawn {
|
sub _spawn {
|
||||||
|
@ -218,7 +218,7 @@ sub load_ldif {
|
||||||
|
|
||||||
my $path = "${\$self->{'_tmpdir'}}/load.ldif";
|
my $path = "${\$self->{'_tmpdir'}}/load.ldif";
|
||||||
write_file($path, $content);
|
write_file($path, $content);
|
||||||
expectOkay(1, ("slapadd", "-F", $self->{"_slapd_dir"}, "-b", $suffix, "-l", $path));
|
expectOkay(5, ("slapadd", "-F", $self->{"_slapd_dir"}, "-b", $suffix, "-l", $path));
|
||||||
$self->validateConfig();
|
$self->validateConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ subtest "Building, caching, and then garbage collecting the underlying job" => s
|
||||||
|
|
||||||
ok(unlink(Hydra::Helper::Nix::gcRootFor($path)), "Unlinking the GC root for underlying Dependency succeeds");
|
ok(unlink(Hydra::Helper::Nix::gcRootFor($path)), "Unlinking the GC root for underlying Dependency succeeds");
|
||||||
|
|
||||||
(my $ret, my $stdout, my $stderr) = captureStdoutStderr(5, "nix-store", "--delete", $path);
|
(my $ret, my $stdout, my $stderr) = captureStdoutStderr(15, "nix-store", "--delete", $path);
|
||||||
is($ret, 0, "Deleting the underlying dependency should succeed");
|
is($ret, 0, "Deleting the underlying dependency should succeed");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ my $db = $ctx->db();
|
||||||
|
|
||||||
subtest "Handling password and password hash creation" => sub {
|
subtest "Handling password and password hash creation" => sub {
|
||||||
subtest "Creating a user with a plain text password (insecure) stores the password securely" => sub {
|
subtest "Creating a user with a plain text password (insecure) stores the password securely" => sub {
|
||||||
my ($res, $stdout, $stderr) = captureStdoutStderr(5, ("hydra-create-user", "plain-text-user", "--password", "foobar"));
|
my ($res, $stdout, $stderr) = captureStdoutStderr(15, ("hydra-create-user", "plain-text-user", "--password", "foobar"));
|
||||||
is($res, 0, "hydra-create-user should exit zero");
|
is($res, 0, "hydra-create-user should exit zero");
|
||||||
like($stderr, qr/Submitting plaintext passwords as arguments is deprecated and will be removed/, "Submitting a plain text password is deprecated.");
|
like($stderr, qr/Submitting plaintext passwords as arguments is deprecated and will be removed/, "Submitting a plain text password is deprecated.");
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ subtest "Handling password and password hash creation" => sub {
|
||||||
};
|
};
|
||||||
|
|
||||||
subtest "Creating a user with a sha1 password (still insecure) stores the password as a hashed sha1" => sub {
|
subtest "Creating a user with a sha1 password (still insecure) stores the password as a hashed sha1" => sub {
|
||||||
my ($res, $stdout, $stderr) = captureStdoutStderr(5, ("hydra-create-user", "old-password-hash-user", "--password-hash", "8843d7f92416211de9ebb963ff4ce28125932878"));
|
my ($res, $stdout, $stderr) = captureStdoutStderr(15, ("hydra-create-user", "old-password-hash-user", "--password-hash", "8843d7f92416211de9ebb963ff4ce28125932878"));
|
||||||
is($res, 0, "hydra-create-user should exit zero");
|
is($res, 0, "hydra-create-user should exit zero");
|
||||||
|
|
||||||
my $user = $db->resultset('Users')->find({ username => "old-password-hash-user" });
|
my $user = $db->resultset('Users')->find({ username => "old-password-hash-user" });
|
||||||
|
@ -36,7 +36,7 @@ subtest "Handling password and password hash creation" => sub {
|
||||||
};
|
};
|
||||||
|
|
||||||
subtest "Creating a user with an argon2 password stores the password as given" => sub {
|
subtest "Creating a user with an argon2 password stores the password as given" => sub {
|
||||||
my ($res, $stdout, $stderr) = captureStdoutStderr(5, ("hydra-create-user", "argon2-hash-user", "--password-hash", '$argon2id$v=19$m=262144,t=3,p=1$tMnV5paYjmIrUIb6hylaNA$M8/e0i3NGrjhOliVLa5LqQ'));
|
my ($res, $stdout, $stderr) = captureStdoutStderr(15, ("hydra-create-user", "argon2-hash-user", "--password-hash", '$argon2id$v=19$m=262144,t=3,p=1$tMnV5paYjmIrUIb6hylaNA$M8/e0i3NGrjhOliVLa5LqQ'));
|
||||||
is($res, 0, "hydra-create-user should exit zero");
|
is($res, 0, "hydra-create-user should exit zero");
|
||||||
|
|
||||||
my $user = $db->resultset('Users')->find({ username => "argon2-hash-user" });
|
my $user = $db->resultset('Users')->find({ username => "argon2-hash-user" });
|
||||||
|
@ -50,7 +50,7 @@ subtest "Handling password and password hash creation" => sub {
|
||||||
|
|
||||||
subtest "Creating a user by prompting for the password" => sub {
|
subtest "Creating a user by prompting for the password" => sub {
|
||||||
subtest "with the same password twice" => sub {
|
subtest "with the same password twice" => sub {
|
||||||
my ($res, $stdout, $stderr) = captureStdoutStderrWithStdin(5, ["hydra-create-user", "prompted-pass-user", "--password-prompt"], "my-password\nmy-password\n");
|
my ($res, $stdout, $stderr) = captureStdoutStderrWithStdin(15, ["hydra-create-user", "prompted-pass-user", "--password-prompt"], "my-password\nmy-password\n");
|
||||||
is($res, 0, "hydra-create-user should exit zero");
|
is($res, 0, "hydra-create-user should exit zero");
|
||||||
|
|
||||||
my $user = $db->resultset('Users')->find({ username => "prompted-pass-user" });
|
my $user = $db->resultset('Users')->find({ username => "prompted-pass-user" });
|
||||||
|
@ -62,7 +62,7 @@ subtest "Handling password and password hash creation" => sub {
|
||||||
};
|
};
|
||||||
|
|
||||||
subtest "With mismatched password confirmation" => sub {
|
subtest "With mismatched password confirmation" => sub {
|
||||||
my ($res, $stdout, $stderr) = captureStdoutStderrWithStdin(5, ["hydra-create-user", "prompted-pass-user", "--password-prompt"], "my-password\nnot-my-password\n");
|
my ($res, $stdout, $stderr) = captureStdoutStderrWithStdin(15, ["hydra-create-user", "prompted-pass-user", "--password-prompt"], "my-password\nnot-my-password\n");
|
||||||
isnt($res, 0, "hydra-create-user should exit non-zero");
|
isnt($res, 0, "hydra-create-user should exit non-zero");
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -76,7 +76,7 @@ subtest "Handling password and password hash creation" => sub {
|
||||||
);
|
);
|
||||||
|
|
||||||
for my $case (@cases) {
|
for my $case (@cases) {
|
||||||
my ($res, $stdout, $stderr) = captureStdoutStderr(5, (
|
my ($res, $stdout, $stderr) = captureStdoutStderr(15, (
|
||||||
"hydra-create-user", "bogus-password-options", @{$case}));
|
"hydra-create-user", "bogus-password-options", @{$case}));
|
||||||
like($stderr, qr/please specify only one of --password-prompt or --password-hash/, "We get an error about specifying the password");
|
like($stderr, qr/please specify only one of --password-prompt or --password-hash/, "We get an error about specifying the password");
|
||||||
isnt($res, 0, "hydra-create-user should exit non-zero with conflicting " . join(" ", @{$case}));
|
isnt($res, 0, "hydra-create-user should exit non-zero with conflicting " . join(" ", @{$case}));
|
||||||
|
@ -84,7 +84,7 @@ subtest "Handling password and password hash creation" => sub {
|
||||||
};
|
};
|
||||||
|
|
||||||
subtest "A password is not required for creating a Google-based account" => sub {
|
subtest "A password is not required for creating a Google-based account" => sub {
|
||||||
my ($res, $stdout, $stderr) = captureStdoutStderr(5, (
|
my ($res, $stdout, $stderr) = captureStdoutStderr(15, (
|
||||||
"hydra-create-user", "google-account", "--type", "google"));
|
"hydra-create-user", "google-account", "--type", "google"));
|
||||||
is($res, 0, "hydra-create-user should exit zero");
|
is($res, 0, "hydra-create-user should exit zero");
|
||||||
};
|
};
|
||||||
|
|
|
@ -28,7 +28,7 @@ subtest "hydra-init upgrades user's password hashes from sha1 to sha1 inside Arg
|
||||||
$janet->setPassword("foobar");
|
$janet->setPassword("foobar");
|
||||||
|
|
||||||
is($alice->password, "8843d7f92416211de9ebb963ff4ce28125932878", "Alices's sha1 is stored in the database");
|
is($alice->password, "8843d7f92416211de9ebb963ff4ce28125932878", "Alices's sha1 is stored in the database");
|
||||||
my ($res, $stdout, $stderr) = captureStdoutStderr(5, ("hydra-init"));
|
my ($res, $stdout, $stderr) = captureStdoutStderr(30, ("hydra-init"));
|
||||||
if ($res != 0) {
|
if ($res != 0) {
|
||||||
is($stdout, "");
|
is($stdout, "");
|
||||||
is($stderr, "");
|
is($stderr, "");
|
||||||
|
@ -55,7 +55,7 @@ subtest "hydra-init upgrades user's password hashes from sha1 to sha1 inside Arg
|
||||||
};
|
};
|
||||||
|
|
||||||
subtest "Running hydra-init don't break Alice or Janet's passwords" => sub {
|
subtest "Running hydra-init don't break Alice or Janet's passwords" => sub {
|
||||||
my ($res, $stdout, $stderr) = captureStdoutStderr(5, ("hydra-init"));
|
my ($res, $stdout, $stderr) = captureStdoutStderr(30, ("hydra-init"));
|
||||||
is($res, 0, "hydra-init should exit zero");
|
is($res, 0, "hydra-init should exit zero");
|
||||||
|
|
||||||
my $updatedAlice = $db->resultset('Users')->find({ username => "alice" });
|
my $updatedAlice = $db->resultset('Users')->find({ username => "alice" });
|
||||||
|
|
|
@ -21,7 +21,7 @@ if (defined($ENV{"NIX_BUILD_CORES"})
|
||||||
print STDERR "test.pl: Defaulting \$YATH_JOB_COUNT to \$NIX_BUILD_CORES (${\$ENV{'NIX_BUILD_CORES'}})\n";
|
print STDERR "test.pl: Defaulting \$YATH_JOB_COUNT to \$NIX_BUILD_CORES (${\$ENV{'NIX_BUILD_CORES'}})\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
system($^X, find_yath(), '-D', 'test', '--default-search' => './', @ARGV);
|
system($^X, find_yath(), '-D', 'test', '--qvf', '--event-timeout', 240, '--default-search' => './', @ARGV);
|
||||||
my $exit = $?;
|
my $exit = $?;
|
||||||
|
|
||||||
# This makes sure it works with prove.
|
# This makes sure it works with prove.
|
||||||
|
|
Loading…
Reference in a new issue