Skip to content

Commit 25d970a

Browse files
authored
Merge pull request #19 from attogram/trending-report-fixes
Fix trending report and test suite
2 parents 027a17e + 27e2ee6 commit 25d970a

5 files changed

Lines changed: 11 additions & 8 deletions

File tree

reporters/trending.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,11 @@ if [ ${#TARGET_FILES[@]} -eq 0 ]; then
6464
exit 0
6565
fi
6666

67-
# Use awk to process the tsv files
67+
# Use awk to process the tsv files, then sort the results
6868
awk '
6969
BEGIN {
7070
FS="\t";
7171
OFS="\t";
72-
print "Change\tLast Value\tFirst Value\tMetrics";
73-
print "------\t----------\t-----------\t-------";
7472
}
7573
FNR == 1 { next; } # Skip header row of each file
7674
{
@@ -104,4 +102,9 @@ END {
104102
print change_str, last_value[metric], first_value[metric], metric;
105103
}
106104
}
107-
}' "${TARGET_FILES[@]}"
105+
}' "${TARGET_FILES[@]}" |
106+
(
107+
echo -e "Change\tLast\tFirst\tmodule\tchannels\tnamespace"
108+
echo -e "------\t----\t-----\t------\t--------\t---------"
109+
sort -k1,1nr
110+
)

test/dashboard.bats

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ EOL
1818

1919
teardown() {
2020
# This teardown function is run after each test.
21-
rm -rf config
21+
rm -f config/config.sh
2222
}
2323

2424
@test "dashboard.sh should be executable" {

test/discord.bats

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ EOF
2323

2424
teardown() {
2525
# This teardown function is run after each test.
26-
rm -rf config
26+
rm -f config/config.sh
2727
rm -rf "/tmp/bats_mocks_$$"
2828
}
2929

test/github.bats

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ EOL
1414

1515
teardown() {
1616
# This teardown function is run after each test.
17-
rm -rf config
17+
rm -f config/config.sh
1818
}
1919

2020
@test "github module produces valid tsv" {

test/hackernews.bats

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ EOL
1313

1414
teardown() {
1515
# This teardown function is run after each test.
16-
rm -rf config
16+
rm -f config/config.sh
1717
}
1818

1919
@test "hackernews module produces valid tsv" {

0 commit comments

Comments
 (0)