forked from DGNum/colmena
progress: Restore tty-detection after refactoring
This commit is contained in:
parent
ba16f50722
commit
dc57b489ea
5 changed files with 9 additions and 7 deletions
|
@ -6,7 +6,7 @@ in tools.makeTest {
|
||||||
bundle = ./.;
|
bundle = ./.;
|
||||||
|
|
||||||
testScript = ''
|
testScript = ''
|
||||||
deployer.succeed("cd /tmp/bundle && ${tools.colmenaExec} apply-local -v")
|
deployer.succeed("cd /tmp/bundle && ${tools.colmenaExec} apply-local")
|
||||||
deployer.succeed("grep SUCCESS /etc/deployment")
|
deployer.succeed("grep SUCCESS /etc/deployment")
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ deployer.succeed(f"sed -i 's|@poison@|{poison}|g' /tmp/bundle/hive.nix")
|
||||||
targets = [alpha, beta, gamma]
|
targets = [alpha, beta, gamma]
|
||||||
|
|
||||||
logs = deployer.succeed("cd /tmp/bundle &&" \
|
logs = deployer.succeed("cd /tmp/bundle &&" \
|
||||||
f"run-copy-stderr {colmena} apply -v --eval-node-limit 4 --on @target")
|
f"run-copy-stderr {colmena} apply --eval-node-limit 4 --on @target")
|
||||||
|
|
||||||
with subtest("Check that evaluation messages were logged correctly"):
|
with subtest("Check that evaluation messages were logged correctly"):
|
||||||
assert "must appear during evaluation" in logs
|
assert "must appear during evaluation" in logs
|
||||||
|
@ -66,7 +66,7 @@ with subtest("Check that we can correctly deploy to remaining nodes despite fail
|
||||||
|
|
||||||
deployer.succeed("sed -i s/FIRST/SECOND/g /tmp/bundle/hive.nix")
|
deployer.succeed("sed -i s/FIRST/SECOND/g /tmp/bundle/hive.nix")
|
||||||
deployer.fail("cd /tmp/bundle &&" \
|
deployer.fail("cd /tmp/bundle &&" \
|
||||||
f"{colmena} apply -v --eval-node-limit 4 --on @target")
|
f"{colmena} apply --eval-node-limit 4 --on @target")
|
||||||
|
|
||||||
alpha.succeed("grep SECOND /etc/deployment")
|
alpha.succeed("grep SECOND /etc/deployment")
|
||||||
beta.succeed("grep FIRST /etc/deployment")
|
beta.succeed("grep FIRST /etc/deployment")
|
||||||
|
|
|
@ -6,7 +6,7 @@ in tools.makeTest {
|
||||||
bundle = ./.;
|
bundle = ./.;
|
||||||
|
|
||||||
testScript = ''
|
testScript = ''
|
||||||
logs = deployer.succeed("cd /tmp/bundle && ${tools.colmenaExec} exec -v --on @target -- echo output from '$(hostname)' 2>&1")
|
logs = deployer.succeed("cd /tmp/bundle && ${tools.colmenaExec} exec --on @target -- echo output from '$(hostname)' 2>&1")
|
||||||
|
|
||||||
assert "output from alpha" in logs
|
assert "output from alpha" in logs
|
||||||
assert "output from beta" in logs
|
assert "output from beta" in logs
|
||||||
|
|
|
@ -7,10 +7,10 @@ in tools.makeTest {
|
||||||
|
|
||||||
testScript = ''
|
testScript = ''
|
||||||
deployer.succeed("cd /tmp/bundle &&" \
|
deployer.succeed("cd /tmp/bundle &&" \
|
||||||
"${tools.colmenaExec} apply push -v --eval-node-limit 4 --on @target")
|
"${tools.colmenaExec} apply push --eval-node-limit 4 --on @target")
|
||||||
|
|
||||||
logs = deployer.succeed("cd /tmp/bundle &&" \
|
logs = deployer.succeed("cd /tmp/bundle &&" \
|
||||||
"run-copy-stderr ${tools.colmenaExec} apply switch -v --eval-node-limit 4 --parallel 4 --on @target")
|
"run-copy-stderr ${tools.colmenaExec} apply switch --eval-node-limit 4 --parallel 4 --on @target")
|
||||||
|
|
||||||
for node in [alpha, beta, gamma]:
|
for node in [alpha, beta, gamma]:
|
||||||
node.succeed("grep SUCCESS /etc/deployment")
|
node.succeed("grep SUCCESS /etc/deployment")
|
||||||
|
|
|
@ -93,7 +93,9 @@ pub enum LineStyle {
|
||||||
|
|
||||||
impl SimpleProgressOutput {
|
impl SimpleProgressOutput {
|
||||||
pub fn new(verbose: bool) -> Self {
|
pub fn new(verbose: bool) -> Self {
|
||||||
if verbose {
|
let tty = atty::is(atty::Stream::Stdout);
|
||||||
|
|
||||||
|
if verbose || !tty {
|
||||||
Self::Plain(PlainOutput::new())
|
Self::Plain(PlainOutput::new())
|
||||||
} else {
|
} else {
|
||||||
Self::Spinner(SpinnerOutput::new())
|
Self::Spinner(SpinnerOutput::new())
|
||||||
|
|
Loading…
Reference in a new issue