mirror of
https://github.com/status-im/sourcecred.git
synced 2025-02-23 17:58:06 +00:00
The `go` command performs a full load, running the following commands in sequence: - load - graph - score We don't include the `site` command, on the premise that the user might have reasons to not include the site (e.g. they just want to use the ouptut data for analysis), so we shouldn't add it for them. Also, if they installed the site in the past, it will still be setup. However, this does mean that downstream users who DO want a site should be sure to run `sourcecred site` manually whenever they update SourceCred versions. Test plan: In a SC instance, run `sourcecred go` and observe that: - in the success case, it runs the three commands in sequence - in the failure case, it prints a message showing which command failed (you can induce a failure by removing the cache, or unsetting GitHub/Discord tokens).
64 lines
1.8 KiB
Bash
Executable File
64 lines
1.8 KiB
Bash
Executable File
#!/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
|
|
:
|
|
|
|
# If this test is failing, it probably means you need to update snapshots.
|
|
# You can do so by setting your SOURCECRED_GITHUB_TOKEN (see README) and then
|
|
# running scripts/update_snapshots.sh.
|
|
|
|
test_description='test snapshot integrity for sourcecred instance loading'
|
|
|
|
export GIT_CONFIG_NOSYSTEM=1
|
|
export GIT_ATTR_NOSYSTEM=1
|
|
|
|
# shellcheck disable=SC1091
|
|
. ./sharness.sh
|
|
|
|
test_expect_success "environment and Node linking setup" '
|
|
toplevel="$(git -C "$(dirname "$0")" rev-parse --show-toplevel)" &&
|
|
snapshot_directory="${toplevel}/sharness/__snapshots__/test-instance/" &&
|
|
if [ -z "${SOURCECRED_BIN}" ]; then
|
|
printf >&2 "warn: missing environment variable SOURCECRED_BIN\n" &&
|
|
printf >&2 "warn: using repository bin directory as fallback\n" &&
|
|
export SOURCECRED_BIN="${toplevel}/bin"
|
|
fi &&
|
|
export NODE_PATH="${toplevel}/node_modules${NODE_PATH:+:${NODE_PATH}}" &&
|
|
test_set_prereq SETUP
|
|
'
|
|
|
|
if [ -n "${SOURCECRED_GITHUB_TOKEN:-}" ]; then
|
|
test_set_prereq HAVE_GITHUB_TOKEN
|
|
fi
|
|
|
|
test_expect_success EXPENSIVE,SETUP,HAVE_GITHUB_TOKEN \
|
|
"should load the example instance" '
|
|
cp -r "${snapshot_directory}" . &&
|
|
cd test-instance &&
|
|
node "${SOURCECRED_BIN}/sourcecred.js" go &&
|
|
rm -rf cache &&
|
|
test_set_prereq LOADED
|
|
'
|
|
|
|
if [ -n "${UPDATE_SNAPSHOT}" ]; then
|
|
test_set_prereq UPDATE_SNAPSHOT
|
|
fi
|
|
|
|
test_expect_success LOADED,UPDATE_SNAPSHOT \
|
|
"should update the snapshot" '
|
|
rm -rf "$snapshot_directory" &&
|
|
cp -r . "$snapshot_directory"
|
|
'
|
|
|
|
test_expect_success LOADED "should be identical to the snapshot" '
|
|
diff -qr . "$snapshot_directory"
|
|
'
|
|
|
|
test_done
|
|
|
|
# vim: ft=sh
|