aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/clean_test_env.sh3
-rw-r--r--scripts/mock_feed.xml22
-rwxr-xr-xscripts/run_e2e_safe.sh19
3 files changed, 42 insertions, 2 deletions
diff --git a/scripts/clean_test_env.sh b/scripts/clean_test_env.sh
index 6edef41..f6b6867 100755
--- a/scripts/clean_test_env.sh
+++ b/scripts/clean_test_env.sh
@@ -10,9 +10,10 @@ pkill -x "neko_server" || true
pkill -f "vite" || true
pkill -f "playwright" || true
-# Kill anything on ports 4994 and 5173
+# Kill anything on ports 4994 and 5173 and 9090
fuser -k 4994/tcp || true
fuser -k 5173/tcp || true
+fuser -k 9090/tcp || true
# Remove test databases
rm -f neko_test.db .data/test.db
diff --git a/scripts/mock_feed.xml b/scripts/mock_feed.xml
new file mode 100644
index 0000000..6bbe1c3
--- /dev/null
+++ b/scripts/mock_feed.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<rss version="2.0">
+<channel>
+ <title>Mock Feed</title>
+ <link>http://localhost:9000/mock_feed.xml</link>
+ <description>A mock feed for testing purposes</description>
+ <item>
+ <title>Mock Item 1</title>
+ <link>http://localhost:9000/item1</link>
+ <description>This is the first mock item.</description>
+ <pubDate>Mon, 06 Sep 2024 16:45:00 +0000</pubDate>
+ <guid>http://localhost:9000/item1</guid>
+ </item>
+ <item>
+ <title>Mock Item 2</title>
+ <link>http://localhost:9000/item2</link>
+ <description>This is the second mock item.</description>
+ <pubDate>Mon, 06 Sep 2024 16:40:00 +0000</pubDate>
+ <guid>http://localhost:9000/item2</guid>
+ </item>
+</channel>
+</rss>
diff --git a/scripts/run_e2e_safe.sh b/scripts/run_e2e_safe.sh
index a68e7be..a24455c 100755
--- a/scripts/run_e2e_safe.sh
+++ b/scripts/run_e2e_safe.sh
@@ -10,8 +10,22 @@ go build -o neko_server ./cmd/neko
echo "Creating data directory..."
mkdir -p .data
+echo "Starting mock feed server on port 9090..."
+python3 -m http.server 9090 --directory scripts > mock_server.log 2>&1 &
+MOCK_PID=$!
+echo "Mock Server PID: $MOCK_PID"
+
+# Verify mock server
+sleep 2
+if ! curl -s --head http://localhost:9090/mock_feed.xml > /dev/null; then
+ echo "Mock server failed to start!"
+ cat mock_server.log
+ exit 1
+fi
+echo "Mock server is up."
+
echo "Starting backend on port 4994..."
-./neko_server --http=4994 --database=.data/test.db > backend.log 2>&1 &
+./neko_server --verbose --allow-local --http=4994 --database=.data/test.db > backend.log 2>&1 &
SERVER_PID=$!
echo "Backend PID: $SERVER_PID"
@@ -41,12 +55,15 @@ if npm run test:e2e; then
EXIT_CODE=0
else
echo "Tests failed!"
+ echo "Backend Logs:"
+ cat ../backend.log
EXIT_CODE=1
fi
cd ..
echo "Cleaning up..."
kill $SERVER_PID || true
+kill $MOCK_PID || true
scripts/clean_test_env.sh
exit $EXIT_CODE