mirror of
https://github.com/status-im/sourcecred.git
synced 2025-01-12 21:54:37 +00:00
Snapshot the results of running sourcecred load
(#949)
This will enable us to test code that needs to consume the results of running `sourcecred load`, e.g. plugin adapter code. If you need to update the snapshot, run (cd sharness; UPDATE_SHAPSHOT=1 ./test_load_example_github.t) Test plan: `yarn sharness-full` passes. Paired with @wchargin
This commit is contained in:
parent
c4e2ec8839
commit
4fdb65b866
@ -0,0 +1 @@
|
||||
[{"type":"sourcecred/graph","version":"0.4.0"},{"edges":[{"address":["sourcecred","git","HAS_PARENT","2","COMMIT","0a223346b4e6dec0127b1e6aa892c4ee0424b66a","2","COMMIT","ec91adb718a6045b492303f00d8e8beb957dc780"],"dstIndex":4,"srcIndex":0},{"address":["sourcecred","git","HAS_PARENT","2","COMMIT","0a223346b4e6dec0127b1e6aa892c4ee0424b66a","2","COMMIT","ecc889dc94cf6da17ae6eab5bb7b7155f577519d"],"dstIndex":5,"srcIndex":0},{"address":["sourcecred","git","HAS_PARENT","2","COMMIT","6bd1b4c0b719c22c688a74863be07a699b7b9b34","2","COMMIT","c430bd74455105f77215ece51945094ceeee6c86"],"dstIndex":3,"srcIndex":1},{"address":["sourcecred","git","HAS_PARENT","2","COMMIT","6d5b3aa31ebb68a06ceb46bbd6cf49b6ccd6f5e6","2","COMMIT","0a223346b4e6dec0127b1e6aa892c4ee0424b66a"],"dstIndex":0,"srcIndex":2},{"address":["sourcecred","git","HAS_PARENT","2","COMMIT","c430bd74455105f77215ece51945094ceeee6c86","2","COMMIT","6d5b3aa31ebb68a06ceb46bbd6cf49b6ccd6f5e6"],"dstIndex":2,"srcIndex":3},{"address":["sourcecred","git","HAS_PARENT","2","COMMIT","ecc889dc94cf6da17ae6eab5bb7b7155f577519d","2","COMMIT","ec91adb718a6045b492303f00d8e8beb957dc780"],"dstIndex":4,"srcIndex":5}],"nodes":[["sourcecred","git","COMMIT","0a223346b4e6dec0127b1e6aa892c4ee0424b66a"],["sourcecred","git","COMMIT","6bd1b4c0b719c22c688a74863be07a699b7b9b34"],["sourcecred","git","COMMIT","6d5b3aa31ebb68a06ceb46bbd6cf49b6ccd6f5e6"],["sourcecred","git","COMMIT","c430bd74455105f77215ece51945094ceeee6c86"],["sourcecred","git","COMMIT","ec91adb718a6045b492303f00d8e8beb957dc780"],["sourcecred","git","COMMIT","ecc889dc94cf6da17ae6eab5bb7b7155f577519d"]]}]
|
@ -0,0 +1 @@
|
||||
{"commitToRepoId":{"0a223346b4e6dec0127b1e6aa892c4ee0424b66a":{"sourcecred/example-github":true},"6bd1b4c0b719c22c688a74863be07a699b7b9b34":{"sourcecred/example-github":true},"6d5b3aa31ebb68a06ceb46bbd6cf49b6ccd6f5e6":{"sourcecred/example-github":true},"c430bd74455105f77215ece51945094ceeee6c86":{"sourcecred/example-github":true},"ec91adb718a6045b492303f00d8e8beb957dc780":{"sourcecred/example-github":true},"ecc889dc94cf6da17ae6eab5bb7b7155f577519d":{"sourcecred/example-github":true}},"commits":{"0a223346b4e6dec0127b1e6aa892c4ee0424b66a":{"hash":"0a223346b4e6dec0127b1e6aa892c4ee0424b66a","parentHashes":["ec91adb718a6045b492303f00d8e8beb957dc780","ecc889dc94cf6da17ae6eab5bb7b7155f577519d"],"shortHash":"0a22334","summary":"Merge pull request #3 from sourcecred/add-readme"},"6bd1b4c0b719c22c688a74863be07a699b7b9b34":{"hash":"6bd1b4c0b719c22c688a74863be07a699b7b9b34","parentHashes":["c430bd74455105f77215ece51945094ceeee6c86"],"shortHash":"6bd1b4c","summary":"A commit from someone with no GitHub account"},"6d5b3aa31ebb68a06ceb46bbd6cf49b6ccd6f5e6":{"hash":"6d5b3aa31ebb68a06ceb46bbd6cf49b6ccd6f5e6","parentHashes":["0a223346b4e6dec0127b1e6aa892c4ee0424b66a"],"shortHash":"6d5b3aa","summary":"This pull request will be more contentious. I can feel it... (#5)"},"c430bd74455105f77215ece51945094ceeee6c86":{"hash":"c430bd74455105f77215ece51945094ceeee6c86","parentHashes":["6d5b3aa31ebb68a06ceb46bbd6cf49b6ccd6f5e6"],"shortHash":"c430bd7","summary":"Hello from credbot!"},"ec91adb718a6045b492303f00d8e8beb957dc780":{"hash":"ec91adb718a6045b492303f00d8e8beb957dc780","parentHashes":[],"shortHash":"ec91adb","summary":"Commit without pull request."},"ecc889dc94cf6da17ae6eab5bb7b7155f577519d":{"hash":"ecc889dc94cf6da17ae6eab5bb7b7155f577519d","parentHashes":["ec91adb718a6045b492303f00d8e8beb957dc780"],"shortHash":"ecc889d","summary":"Add README, merge via PR."}}}
|
Binary file not shown.
@ -0,0 +1 @@
|
||||
[{"type":"REPO_ID_REGISTRY","version":"0.1.0"},[{"name":"example-github","owner":"sourcecred"}]]
|
50
sharness/test_load_example_github.t
Executable file
50
sharness/test_load_example_github.t
Executable file
@ -0,0 +1,50 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Disable these lint rules globally:
|
||||
# 2034 = unused variable (used by sharness)
|
||||
# 2016 = parameter expansion in single quotes
|
||||
# 1004 = backslash-newline in single quotes
|
||||
# shellcheck disable=SC2034,SC2016,SC1004
|
||||
:
|
||||
|
||||
test_description='test snapshot integrity for sourcecred load'
|
||||
|
||||
export GIT_CONFIG_NOSYSTEM=1
|
||||
export GIT_ATTR_NOSYSTEM=1
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
. ./sharness.sh
|
||||
|
||||
toplevel="$(git -C "$(dirname "$0")" rev-parse --show-toplevel)"
|
||||
|
||||
if [ -n "${SOURCECRED_GITHUB_TOKEN:-}" ]; then
|
||||
test_set_prereq HAVE_GITHUB_TOKEN
|
||||
fi
|
||||
|
||||
test_expect_success EXPENSIVE,HAVE_GITHUB_TOKEN \
|
||||
"should load sourcecred/example-github" '
|
||||
SOURCECRED_DIRECTORY=. node "$toplevel/bin/sourcecred.js" \
|
||||
load sourcecred/example-github &&
|
||||
rm -rf cache &&
|
||||
test_set_prereq LOADED_GITHUB
|
||||
'
|
||||
|
||||
if [ -n "${UPDATE_SNAPSHOT}" ]; then
|
||||
test_set_prereq UPDATE_SNAPSHOT
|
||||
fi
|
||||
|
||||
snapshot_directory="$toplevel/sharness/__snapshots__/example-github-load"
|
||||
|
||||
test_expect_success LOADED_GITHUB,UPDATE_SNAPSHOT \
|
||||
"should update the snapshot" '
|
||||
rm -rf "$snapshot_directory" &&
|
||||
cp -r . "$snapshot_directory"
|
||||
'
|
||||
|
||||
test_expect_success LOADED_GITHUB "should be identical to the snapshot" '
|
||||
diff -qr . "$snapshot_directory"
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
# vim: ft=sh
|
Loading…
x
Reference in New Issue
Block a user