diff options
author | Rasmus Dahlberg <rasmus@mullvad.net> | 2022-03-27 21:18:09 +0200 |
---|---|---|
committer | Rasmus Dahlberg <rasmus.dahlberg@kau.se> | 2022-04-21 19:20:05 +0200 |
commit | 833d42212856662e6f5da35d660d613f69c4feaf (patch) | |
tree | 968c285a374f9a92d87c7c0951f6e4faaf937435 /integration | |
parent | 51d6c9e91c7f8a927f678a3227e75deb5d9aebea (diff) |
integration: add a valid leaf test
Diffstat (limited to 'integration')
-rwxr-xr-x | integration/test.sh | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/integration/test.sh b/integration/test.sh index 5305f20..8826d4b 100755 --- a/integration/test.sh +++ b/integration/test.sh @@ -148,6 +148,7 @@ function run_tests() { log_url=$ssrv_endpoint/$ssrv_prefix/sigsum/v0 test_alive + test_add_leaf warn "many tests are missing" } @@ -159,6 +160,26 @@ function test_alive() { pass "get an HTTP 200 OK response" } +function test_add_leaf() { + desc="add one leaf" + output=$(leaf_req $desc | curl -s -w "%{http_code}" --data-binary @- $log_url/add-leaf) + if [[ $output != 200 ]]; then + fail "$desc: valid ($output)" + return + fi + + pass $desc +} + +function leaf_req() { + data=$1 + echo "shard_hint=$ssrv_shard_start" + echo "checksum=$(openssl dgst -binary <(echo $data) | base16)" + echo "signature=$(echo $data | sigsum-debug sign -k $cli_priv -s $ssrv_shard_start)" + echo "verification_key=$cli_pub" + echo "domain_hint=$cli_domain_hint" +} + function die() { echo -e "\e[37m$(date +"%y-%m-%d %H:%M:%S %Z")\e[0m [\e[31mFATA\e[0m] $@" >&2 exit 1 |