From: Chris Duncan Date: Sat, 26 Apr 2025 22:37:42 +0000 (-0700) Subject: Extend test startup sleep a little bit. Add shebang to properly indicate environment... X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=2b603fcc1f27ab1412462c72f0093a54651ac0c1;p=nano-pow.git Extend test startup sleep a little bit. Add shebang to properly indicate environment. Replace now-invalid max threshold checks with lower custom difficulties. Make all generate test hashes unique. Remove unnecessary parallelization of curl requests that do not work well in a non-interactive shell. --- diff --git a/test/script.sh b/test/script.sh index 65bd8ce..33694c0 100755 --- a/test/script.sh +++ b/test/script.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env bash # SPDX-FileCopyrightText: 2025 Chris Duncan # SPDX-License-Identifier: GPL-3.0-or-later @@ -11,7 +12,7 @@ export NANO_POW_EFFORT=4 export NANO_POW_PORT=3001 "$SCRIPT_DIR"/../dist/bin/nano-pow.sh --server -sleep 2s +sleep 3s printf '\nGet documentation\n' curl localhost:3001 @@ -19,29 +20,28 @@ curl localhost:3001 printf '\nExpect errors. Server should not crash when bad data is received like missing end quote or requests exceeding max size\n' curl -d '{ "action": "work_validate", "work": "47c83266398728cf", "hash: "92BA74A7D6DC7557F3EDA95ADC6341D51AC777A0A6FF0688A5C492AB2B2CB40D" }' localhost:3001 curl -d '{ "action": "work_validate", "work": "47c83266398728cf", "hash": "92BA74A7D6DC7557F3EDA95ADC6341D51AC777A0A6FF0688A5C492AB2B2CB40D }' localhost:3001 -curl -d '{ "action": "work_validate", "work": "47c83266398728cf", "hash": "92BA74A7D6DC7557F3EDA95ADC6341D51AC777A0A6FF0688A5C492AB2B2CB40D", "difficulty": "0000000000000000", "foo": "bar" }' localhost:3001 +curl -d '{ "action": "work_validate", "work": "47c83266398728cf", "hash": "92BA74A7D6DC7557F3EDA95ADC6341D51AC777A0A6FF0688A5C492AB2B2CB40D", "difficulty": "-1", "foo": "bar" }' localhost:3001 printf '\nValidate good hashes\n' curl -d '{ "action": "work_validate", "work": "47c83266398728cf", "hash": "92BA74A7D6DC7557F3EDA95ADC6341D51AC777A0A6FF0688A5C492AB2B2CB40D" }' localhost:3001 curl -d '{ "action": "work_validate", "work": "4a8fb104eebbd336", "hash": "8797585D56B8AEA3A62899C31FC088F9BE849BA8298A88E94F6E3112D4E55D01" }' localhost:3001 curl -d '{ "action": "work_validate", "work": "c5d5d6f7c5d6ccd1", "hash": "281E89AC73B1082B464B9C3C1168384F846D39F6DF25105F8B4A22915E999117" }' localhost:3001 -curl -d '{ "action": "work_validate", "work": "326f310d629a8a98", "hash": "204076E3364D16A018754FF67D418AB2FBEB38799FF9A29A1D5F9E34F16BEEEA", "difficulty": "ffffffff00000000" }' localhost:3001 +curl -d '{ "action": "work_validate", "work": "326f310d629a8a98", "hash": "204076E3364D16A018754FF67D418AB2FBEB38799FF9A29A1D5F9E34F16BEEEA", "difficulty": "fffffff700000000" }' localhost:3001 curl -d '{ "action": "work_validate", "work": "6866c1ac3831a891", "hash": "7069D9CD1E85D6204301D254B0927F06ACC794C9EA5DF70EA5578458FB597090", "difficulty": "fffffe0000000000" }' localhost:3001 printf '\nValidate bad hashes\n' curl -d '{ "action": "work_validate", "work": "0000000000000000", "hash": "0000000000000000000000000000000000000000000000000000000000000000" }' localhost:3001 curl -d '{ "action": "work_validate", "work": "c5d5d6f7c5d6ccd1", "hash": "BA1E946BA3D778C2F30A83D44D2132CC6EEF010D8D06FF10A8ABD0100D8FB47E" }' localhost:3001 curl -d '{ "action": "work_validate", "work": "29a9ae0236990e2e", "hash": "32721F4BD2AFB6F6A08D41CD0DF3C0D9C0B5294F68D0D12422F52B28F0800B5F" }' localhost:3001 -curl -d '{ "action": "work_validate", "work": "ae238556213c3624", "hash": "BF41D87DA3057FDC6050D2B00C06531F89F4AA6195D7C6C2EAAF15B6E703F8F6", "difficulty": "ffffffff00000000" }' localhost:3001 +curl -d '{ "action": "work_validate", "work": "ae238556213c3624", "hash": "BF41D87DA3057FDC6050D2B00C06531F89F4AA6195D7C6C2EAAF15B6E703F8F6", "difficulty": "fffffff700000000" }' localhost:3001 curl -d '{ "action": "work_validate", "work": "7d903b18d03f9820", "hash": "39C57C28F904DFE4012288FFF64CE80C0F42601023A9C82108E8F7B2D186C150", "difficulty": "fffffe0000000000" }' localhost:3001 -curl -d '{ "action": "work_validate", "work": "e45835c3b291c3d1", "hash": "9DCD89E2B92FD59D7358C2C2E4C225DF94C88E187B27882F50FEFC3760D3994F", "difficulty": "ffffffff00000000" }' localhost:3001 - +curl -d '{ "action": "work_validate", "work": "e45835c3b291c3d1", "hash": "9DCD89E2B92FD59D7358C2C2E4C225DF94C88E187B27882F50FEFC3760D3994F", "difficulty": "fffffff700000000" }' localhost:3001 printf '\nGenerate\n' -curl -d '{ "action": "work_generate", "hash": "92BA74A7D6DC7557F3EDA95ADC6341D51AC777A0A6FF0688A5C492AB2B2CB40D" }' localhost:3001 & -curl -d '{ "action": "work_generate", "hash": "8797585D56B8AEA3A62899C31FC088F9BE849BA8298A88E94F6E3112D4E55D01" }' localhost:3001 & -curl -d '{ "action": "work_generate", "hash": "281E89AC73B1082B464B9C3C1168384F846D39F6DF25105F8B4A22915E999117" }' localhost:3001 & -curl -d '{ "action": "work_generate", "hash": "204076E3364D16A018754FF67D418AB2FBEB38799FF9A29A1D5F9E34F16BEEEA", "difficulty": "ffffffff00000000" }' localhost:3001 & -curl -d '{ "action": "work_generate", "hash": "7069D9CD1E85D6204301D254B0927F06ACC794C9EA5DF70EA5578458FB597090", "difficulty": "fffffe0000000000" }' localhost:3001 & -wait +curl -d '{ "action": "work_generate", "hash": "0D653EBFE692CA655449B301DBCEEF4E4A47454E3DFDF8C87B87C50DB6530A25" }' localhost:3001 +curl -d '{ "action": "work_generate", "hash": "E93104CFC1CE40B2A29F0E85807E7E51E521C30E2B79A8EDDDB2D771DCF5C06B" }' localhost:3001 +curl -d '{ "action": "work_generate", "hash": "472F8F5D908AF51E9583950D50BAE6A8C5FD66D6984FA62D4D31ADDEA5AA3AC7" }' localhost:3001 +curl -d '{ "action": "work_generate", "hash": "B349DA23CB6979DF5894C22C427D19DD8B54B94F1F9A1F82EF74495993C750D7", "difficulty": "fffffff700000000" }' localhost:3001 +curl -d '{ "action": "work_generate", "hash": "93C2252F4D4F3EF84BFF88233289046F82245245C00A064C370BAF9889824DE9", "difficulty": "fffffe0000000000" }' localhost:3001 + kill $(cat "$HOME"/.nano-pow/server.pid) && rm "$HOME"/.nano-pow/server.pid