progress: Restore tty-detection after refactoring

This commit is contained in:
Zhaofeng Li 2021-12-04 01:03:26 -08:00
parent ba16f50722
commit dc57b489ea
5 changed files with 9 additions and 7 deletions

View file

@ -6,7 +6,7 @@ in tools.makeTest {
bundle = ./.;
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")
'';
}

View file

@ -7,7 +7,7 @@ deployer.succeed(f"sed -i 's|@poison@|{poison}|g' /tmp/bundle/hive.nix")
targets = [alpha, beta, gamma]
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"):
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.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")
beta.succeed("grep FIRST /etc/deployment")

View file

@ -6,7 +6,7 @@ in tools.makeTest {
bundle = ./.;
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 beta" in logs

View file

@ -7,10 +7,10 @@ in tools.makeTest {
testScript = ''
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 &&" \
"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]:
node.succeed("grep SUCCESS /etc/deployment")

View file

@ -93,7 +93,9 @@ pub enum LineStyle {
impl SimpleProgressOutput {
pub fn new(verbose: bool) -> Self {
if verbose {
let tty = atty::is(atty::Stream::Stdout);
if verbose || !tty {
Self::Plain(PlainOutput::new())
} else {
Self::Spinner(SpinnerOutput::new())