chore: adjust timeout for wait_for_port
This commit is contained in:
parent
f27f9e997f
commit
bc6c573acb
2 changed files with 13 additions and 8 deletions
15
README.md
15
README.md
|
@ -250,22 +250,27 @@ dufs -a user:pass@/:rw,/dir1 -a @/
|
||||||
|
|
||||||
DUFS supports the use of sha-512 hashed password.
|
DUFS supports the use of sha-512 hashed password.
|
||||||
|
|
||||||
Create hashed password
|
Create hashed password:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ openssl passwd -6 123456 # or `mkpasswd -m sha-512 123456`
|
$ openssl passwd -6 123456 # or `mkpasswd -m sha-512 123456`
|
||||||
$6$tWMB51u6Kb2ui3wd$5gVHP92V9kZcMwQeKTjyTRgySsYJu471Jb1I6iHQ8iZ6s07GgCIO69KcPBRuwPE5tDq05xMAzye0NxVKuJdYs/
|
$6$tWMB51u6Kb2ui3wd$5gVHP92V9kZcMwQeKTjyTRgySsYJu471Jb1I6iHQ8iZ6s07GgCIO69KcPBRuwPE5tDq05xMAzye0NxVKuJdYs/
|
||||||
```
|
```
|
||||||
|
|
||||||
Use hashed password
|
Use hashed password:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
dufs -a "admin:$(openssl passwd -6 123456)@/:rw"
|
|
||||||
dufs -a "admin:$(mkpasswd -m sha-512 123456)@/:rw"
|
|
||||||
dufs -a 'admin:$6$tWMB51u6Kb2ui3wd$5gVHP92V9kZcMwQeKTjyTRgySsYJu471Jb1I6iHQ8iZ6s07GgCIO69KcPBRuwPE5tDq05xMAzye0NxVKuJdYs/@/:rw'
|
dufs -a 'admin:$6$tWMB51u6Kb2ui3wd$5gVHP92V9kZcMwQeKTjyTRgySsYJu471Jb1I6iHQ8iZ6s07GgCIO69KcPBRuwPE5tDq05xMAzye0NxVKuJdYs/@/:rw'
|
||||||
```
|
```
|
||||||
|
|
||||||
> The hashed password contains `$6`, which can expand to a variable in some shells, so you have to use **single quotes** to wrap it.
|
> The hashed password contains `$6`, which can expand to a variable in some shells, so you have to use **single quotes** to wrap it.
|
||||||
|
|
||||||
|
Or embed a command to dynamically generate a hashed password:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
dufs -a admin:$(openssl passwd -6 123456)@/:rw
|
||||||
|
dufs -a admin:$(mkpasswd -m sha-512 123456)@/:rw
|
||||||
|
```
|
||||||
|
|
||||||
Two important things for hashed passwords:
|
Two important things for hashed passwords:
|
||||||
|
|
||||||
1. Dufs only supports sha-512 hashed passwords, so ensure that the password string always starts with `$6$`.
|
1. Dufs only supports sha-512 hashed passwords, so ensure that the password string always starts with `$6$`.
|
||||||
|
|
|
@ -146,14 +146,14 @@ where
|
||||||
TestServer::new(port, tmpdir, child, is_tls)
|
TestServer::new(port, tmpdir, child, is_tls)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Wait a max of 1s for the port to become available.
|
/// Wait a max of 2s for the port to become available.
|
||||||
pub fn wait_for_port(port: u16) {
|
pub fn wait_for_port(port: u16) {
|
||||||
let start_wait = Instant::now();
|
let start_wait = Instant::now();
|
||||||
|
|
||||||
while !port_check::is_port_reachable(format!("localhost:{port}")) {
|
while !port_check::is_port_reachable(format!("localhost:{port}")) {
|
||||||
sleep(Duration::from_millis(100));
|
sleep(Duration::from_millis(250));
|
||||||
|
|
||||||
if start_wait.elapsed().as_secs() > 1 {
|
if start_wait.elapsed().as_secs() > 2 {
|
||||||
panic!("timeout waiting for port {port}");
|
panic!("timeout waiting for port {port}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue