@harperfast/integration-testing 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/scripts/setup-loopback.sh +22 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@harperfast/integration-testing",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Integration testing utilities for Harper-based projects. Provides Harper instance lifecycle management, loopback address pooling, and a test runner script.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -3,22 +3,39 @@
|
|
|
3
3
|
# Prompt for password upfront
|
|
4
4
|
sudo -v
|
|
5
5
|
|
|
6
|
+
# The pool starts at 127.0.0.2 by default (127.0.0.1 is left for other services on localhost).
|
|
7
|
+
# Override via the HARPER_INTEGRATION_TEST_LOOPBACK_POOL_START environment variable.
|
|
8
|
+
START=${HARPER_INTEGRATION_TEST_LOOPBACK_POOL_START:-2}
|
|
9
|
+
|
|
10
|
+
# Validate START is a number between 1 and 255
|
|
11
|
+
if ! [[ "$START" =~ ^[0-9]+$ ]]; then
|
|
12
|
+
echo "Error: HARPER_INTEGRATION_TEST_LOOPBACK_POOL_START must be a number (got: $START)"
|
|
13
|
+
exit 1
|
|
14
|
+
fi
|
|
15
|
+
|
|
16
|
+
if [ "$START" -lt 1 ] || [ "$START" -gt 255 ]; then
|
|
17
|
+
echo "Error: HARPER_INTEGRATION_TEST_LOOPBACK_POOL_START must be between 1 and 255 (got: $START)"
|
|
18
|
+
exit 1
|
|
19
|
+
fi
|
|
20
|
+
|
|
6
21
|
# Use environment variable or default to 32
|
|
7
22
|
COUNT=${HARPER_INTEGRATION_TEST_LOOPBACK_POOL_COUNT:-32}
|
|
23
|
+
MAX=$((256 - START))
|
|
8
24
|
|
|
9
|
-
# Validate COUNT is a number between 1 and
|
|
25
|
+
# Validate COUNT is a number between 1 and MAX
|
|
10
26
|
if ! [[ "$COUNT" =~ ^[0-9]+$ ]]; then
|
|
11
27
|
echo "Error: HARPER_INTEGRATION_TEST_LOOPBACK_POOL_COUNT must be a number (got: $COUNT)"
|
|
12
28
|
exit 1
|
|
13
29
|
fi
|
|
14
30
|
|
|
15
|
-
if [ "$COUNT" -lt 1 ] || [ "$COUNT" -gt
|
|
16
|
-
echo "Error: HARPER_INTEGRATION_TEST_LOOPBACK_POOL_COUNT must be between 1 and
|
|
31
|
+
if [ "$COUNT" -lt 1 ] || [ "$COUNT" -gt "$MAX" ]; then
|
|
32
|
+
echo "Error: HARPER_INTEGRATION_TEST_LOOPBACK_POOL_COUNT must be between 1 and $MAX (got: $COUNT)"
|
|
17
33
|
exit 1
|
|
18
34
|
fi
|
|
19
35
|
|
|
20
|
-
|
|
36
|
+
END=$((START + COUNT - 1))
|
|
37
|
+
for i in $(seq $START $END); do
|
|
21
38
|
sudo ifconfig lo0 alias 127.0.0.$i up
|
|
22
39
|
done
|
|
23
40
|
|
|
24
|
-
echo "✓ Configured $COUNT loopback addresses (127.0.0
|
|
41
|
+
echo "✓ Configured $COUNT loopback addresses (127.0.0.$START-127.0.0.$END)"
|