From 75cf2a9c3cd925d2d8de4b5ef98bdd55c29e9861 Mon Sep 17 00:00:00 2001 From: yo momma Date: Wed, 4 Feb 2026 19:25:03 +0000 Subject: Rebrand: rename dump assets/templates to hump --- test/dumpfm/load_test.clj | 112 ---------------------------------------------- 1 file changed, 112 deletions(-) delete mode 100755 test/dumpfm/load_test.clj (limited to 'test/dumpfm/load_test.clj') diff --git a/test/dumpfm/load_test.clj b/test/dumpfm/load_test.clj deleted file mode 100755 index 3196f1c..0000000 --- a/test/dumpfm/load_test.clj +++ /dev/null @@ -1,112 +0,0 @@ -(ns humpfm.load-test - (:import org.postgresql.ds.PGPoolingDataSource) - (:use clojure.contrib.json.read - clojure.contrib.json.write - clojure.contrib.seq-utils - clojure.contrib.sql - humpfm.millstone)) - - -(let [db-host "localhost" - db-name "humpfm" - db-user "postgres" - db-pass "root"] - (def *db* {:datasource (doto (new PGPoolingDataSource) - (.setServerName db-host) - (.setDatabaseName db-name) - (.setUser db-user) - (.setPassword db-pass) - (.setMaxConnections 3))})) - -(def userlist-query " -select u.nick, u.hash -from users u, messages m -where u.user_id = m.user_id -and u.user_id not in - (select user_id from mutes where (set_on + duration < now())) -group by u.nick, u.hash -having count(*) > 50 -order by count(*) desc -") - -(print "Fetching userlist: ") -(def userlist (time - (with-connection *db* - (with-query-results rs [userlist-query] - (doall rs))))) - - -(def sample-messages-query " -select content -from messages -order by random() -limit 100 -") - -(print "Fetching messages: ") -(def message-contents (time - (with-connection *db* - (with-query-results rs [sample-messages-query] - (doall (map :content rs)))))) - -(defn login-client [] - (let [user-info (rand-elt userlist) - params (select-keys user-info [:nick :hash])] - (do-setup-request! "/login" - :params params - :method "GET"))) - -(defn rand-nick [] - (:nick (rand-elt userlist))) - -(defn load-profile [] - (do-request! (str "/" (rand-nick)) - :label "profile")) - -(defn load-popular-profile [] - (do-request! (str "/" (rand-nick)) - :label "popular-profile")) - -(defn load-popular-popular [] - (do-request! (str "/" (rand-elt ["ryder" "jeanette"]) "/popular") - :label "popular-popular")) - -(defn load-popular [] - (do-request! (str "/" (rand-nick) "/popular") - :label "popular")) - -(defn chat [] - (do-request! "/test/chat")) - -(defn refresh [] - (let [params {:since (- (System/currentTimeMillis) 2000) - :room "test"}] - (do-request! "/refresh" - :params params - :method "GET") - (Thread/sleep 1000))) - -(defn post-msg [] - (let [params {:content (rand-elt message-contents) - :room "test"}] - (do-request! "/msg" - :params params - :method "POST"))) - -(def test-spec {:server "http://localhost:8080" - :clients 75 - :requests 10000 - :max-latency 1000 - :setup-func login-client - :funcs [[55 refresh] - [10 load-popular] - [10 load-profile] - [3 load-popular-popular] - [3 load-popular-profile] - [3 chat] - [5 post-msg]] - :frequency 1 - }) - -(grind! test-spec) -(System/exit 0) \ No newline at end of file -- cgit v1.2.3-70-g09d2