From 67f2852ac72b4603369dda28bf5d880e2def238e Mon Sep 17 00:00:00 2001 From: Alessio Date: Sun, 15 Sep 2024 15:18:54 -0700 Subject: [PATCH] Put `pkg/persistence` and `cmd/data` in tmpfs --- cmd/tests.sh | 14 +++++++------- persistence_test_sqlite_memory.sh | 3 +++ 2 files changed, 10 insertions(+), 7 deletions(-) create mode 100755 persistence_test_sqlite_memory.sh diff --git a/cmd/tests.sh b/cmd/tests.sh index 2d7928a..2ef3552 100755 --- a/cmd/tests.sh +++ b/cmd/tests.sh @@ -13,7 +13,7 @@ fi FAKE_VERSION="1.100.3489" ./compile.sh $FAKE_VERSION -test -e data && rm -r data +test -e data/profile && rm -r data/profile PATH=`pwd`:$PATH @@ -22,8 +22,8 @@ test "$(tw --version)" = "v$FAKE_VERSION" tw --help test $? -eq 0 -tw create_profile data -cd data +tw create_profile data/profile +cd data/profile # Should only contain default profile image test $(find profile_images | wc -l) = "2" @@ -203,10 +203,10 @@ test $(find profile_images/RememberAfghan1* | grep banner | wc -l) = "0" # Test that the `--profile` flag works -cd .. -tw --profile data fetch_user elonmusk -test $(sqlite3 data/twitter.db "select count(*) from users where handle = 'elonmusk'") = "1" -cd data +cd ../.. +tw --profile data/profile fetch_user elonmusk +test $(sqlite3 data/profile/twitter.db "select count(*) from users where handle = 'elonmusk'") = "1" +cd - # Test that fetching tweets with ID only (not full URL) works test $(sqlite3 twitter.db "select count(*) from tweets where id = 1433713164546293767") = "0" # Check it's not already there diff --git a/persistence_test_sqlite_memory.sh b/persistence_test_sqlite_memory.sh new file mode 100755 index 0000000..e3cc9aa --- /dev/null +++ b/persistence_test_sqlite_memory.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +mount -t tmpfs -o size=100M tmpfs pkg/persistence/test_profiles