Merge pull request #233 from NixOS/tagged-comments-fixup

Fixup comment formatting
This commit is contained in:
Graham Christensen 2018-08-31 16:50:27 -04:00 committed by GitHub
commit 626d96b672
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -98,9 +98,8 @@ fn result_to_comment(result: &BuildResult) -> String {
Some(ref s) => s,
};
reply.push(format!(
"<!--REQUEST_ID={}-->{} on {}{}",
result.request_id,
reply.push(format!("<!--REQUEST_ID={}-->", result.request_id));
reply.push(format!("{} on {}{}",
(match *status {
BuildStatus::Skipped => "No attempt".into(),
BuildStatus::Success => "Success".into(),
@ -206,7 +205,8 @@ mod tests {
assert_eq!(
&result_to_comment(&result),
"<!--REQUEST_ID=bogus-request-id-->Success on x86_64-linux [(full log)](https://logs.nix.ci/?key=nixos/nixpkgs.2345&attempt_id=neatattemptid)
"<!--REQUEST_ID=bogus-request-id-->
Success on x86_64-linux [(full log)](https://logs.nix.ci/?key=nixos/nixpkgs.2345&attempt_id=neatattemptid)
Attempted: foo
@ -269,7 +269,8 @@ patching script interpreter paths in /nix/store/pcja75y9isdvgz5i00pkrpif9rxzxc29
assert_eq!(
&result_to_comment(&result),
"<!--REQUEST_ID=bogus-request-id-->Failure on x86_64-linux [(full log)](https://logs.nix.ci/?key=nixos/nixpkgs.2345&attempt_id=neatattemptid)
"<!--REQUEST_ID=bogus-request-id-->
Failure on x86_64-linux [(full log)](https://logs.nix.ci/?key=nixos/nixpkgs.2345&attempt_id=neatattemptid)
Attempted: foo
@ -329,7 +330,8 @@ patching script interpreter paths in /nix/store/pcja75y9isdvgz5i00pkrpif9rxzxc29
assert_eq!(
&result_to_comment(&result),
"<!--REQUEST_ID=bogus-request-id-->Timed out, unknown build status on x86_64-linux [(full log)](https://logs.nix.ci/?key=nixos/nixpkgs.2345&attempt_id=neatattemptid)
"<!--REQUEST_ID=bogus-request-id-->
Timed out, unknown build status on x86_64-linux [(full log)](https://logs.nix.ci/?key=nixos/nixpkgs.2345&attempt_id=neatattemptid)
Attempted: foo
@ -389,7 +391,8 @@ error: build of '/nix/store/l1limh50lx2cx45yb2gqpv7k8xl1mik2-gdb-8.1.drv' failed
assert_eq!(
&result_to_comment(&result),
"<!--REQUEST_ID=bogus-request-id-->Success on x86_64-linux [(full log)](https://logs.nix.ci/?key=nixos/nixpkgs.2345&attempt_id=neatattemptid)
"<!--REQUEST_ID=bogus-request-id-->
Success on x86_64-linux [(full log)](https://logs.nix.ci/?key=nixos/nixpkgs.2345&attempt_id=neatattemptid)
<details><summary>Partial log (click to expand)</summary><p>
@ -448,7 +451,8 @@ patching script interpreter paths in /nix/store/pcja75y9isdvgz5i00pkrpif9rxzxc29
assert_eq!(
&result_to_comment(&result),
"<!--REQUEST_ID=bogus-request-id-->Failure on x86_64-linux [(full log)](https://logs.nix.ci/?key=nixos/nixpkgs.2345&attempt_id=neatattemptid)
"<!--REQUEST_ID=bogus-request-id-->
Failure on x86_64-linux [(full log)](https://logs.nix.ci/?key=nixos/nixpkgs.2345&attempt_id=neatattemptid)
<details><summary>Partial log (click to expand)</summary><p>
@ -496,7 +500,8 @@ patching script interpreter paths in /nix/store/pcja75y9isdvgz5i00pkrpif9rxzxc29
assert_eq!(
&result_to_comment(&result),
"<!--REQUEST_ID=bogus-request-id-->No attempt on x86_64-linux [(full log)](https://logs.nix.ci/?key=nixos/nixpkgs.2345&attempt_id=foo)
"<!--REQUEST_ID=bogus-request-id-->
No attempt on x86_64-linux [(full log)](https://logs.nix.ci/?key=nixos/nixpkgs.2345&attempt_id=foo)
The following builds were skipped because they don't evaluate on x86_64-linux: not-attempted
@ -537,7 +542,8 @@ foo
assert_eq!(
&result_to_comment(&result),
"<!--REQUEST_ID=bogus-request-id-->No attempt on x86_64-linux
"<!--REQUEST_ID=bogus-request-id-->
No attempt on x86_64-linux
The following builds were skipped because they don't evaluate on x86_64-linux: not-attempted
@ -583,7 +589,8 @@ No partial log is available.
assert_eq!(
&result_to_comment(&result),
"<!--REQUEST_ID=bogus-request-id-->Success on x86_64-linux [(full log)](https://logs.nix.ci/?key=nixos/nixpkgs.2345&attempt_id=neatattemptid)
"<!--REQUEST_ID=bogus-request-id-->
Success on x86_64-linux [(full log)](https://logs.nix.ci/?key=nixos/nixpkgs.2345&attempt_id=neatattemptid)
Attempted: foo