Skip to content

Instantly share code, notes, and snippets.

@kevinkassimo
Last active March 5, 2018 00:54
Show Gist options
  • Save kevinkassimo/5e9552058b539dfdd94dcfe104585572 to your computer and use it in GitHub Desktop.
Save kevinkassimo/5e9552058b539dfdd94dcfe104585572 to your computer and use it in GitHub Desktop.
Testing twitter.edges results for Project 5
#!/bin/bash
rm -rf ./output
echo "====== Testing part B results..."
echo "====== Running scala-shell..."
spark-shell -i topUsers.scala
echo "====== Validating results..."
[ $(grep -Rh 40981798 ./output | cut -d, -f 2 | tr -d '()') -eq 8569 ] || echo "ERROR: Case 1 failed"
[ $(grep -Rh 3359851 ./output | cut -d, -f 2 | tr -d '()') -eq 3905 ] || echo "ERROR: Case 2 failed"
[ $(grep -Rh 88323281 ./output | cut -d, -f 2 | tr -d '()') -eq 2315 ] || echo "ERROR: Case 3 failed"
[ $(grep -Rh 18742444 ./output | cut -d, -f 2 | tr -d '()') -eq 1585 ] || echo "ERROR: Case 4 failed"
[ $(grep -Rh 9451052 ./output | cut -d, -f 2 | tr -d '()') -eq 1184 ] || echo "ERROR: Case 5 failed"
[ $(grep -Rh 302847930 ./output | cut -d, -f 2 | tr -d '()') -eq 1182 ] || echo "ERROR: Case 6 failed"
[ $(grep -Rh 12925072 ./output | cut -d, -f 2 | tr -d '()') -eq 1002 ] || echo "ERROR: Case 7 failed"
[ $(ls -l output | grep part-* | rev | cut -d' ' -f1 | rev | sed -e 's/^/output\//' | xargs cat | wc -l) -eq 177 ] || echo "Total lines mismatch"
echo "====== Part B test passed!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment