From 833d42212856662e6f5da35d660d613f69c4feaf Mon Sep 17 00:00:00 2001 From: Rasmus Dahlberg Date: Sun, 27 Mar 2022 21:18:09 +0200 Subject: integration: add a valid leaf test --- integration/test.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'integration') 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 -- cgit v1.2.3