Integration tests: Basic Whisper version test and disable old

This commit is contained in:
Oskar Thorén 2017-11-20 21:07:43 +01:00
parent ff0f5b5d56
commit 91a0d40ceb
2 changed files with 25 additions and 6 deletions

View File

@ -1,12 +1,16 @@
(ns status-im.test.protocol.core
(:require [cljs.test :refer-macros [deftest is testing run-tests async]]
[cljs.nodejs :as nodejs]
[status-im.protocol.web3.utils :as web3.utils]
[status-im.test.protocol.node :as node]
[status-im.test.protocol.utils :as utils]
[status-im.protocol.core :as protocol]))
;; NOTE(oskarth): All these tests are evaluated in NodeJS
(nodejs/enable-util-print!)
;; NOTE(oskarth): If status-go has already been built correctly, comment this out
(node/prepare-env!)
(def rpc-url "http://localhost:8645")
@ -37,7 +41,10 @@
:contacts contacts
:post-error-callback (post-error-callback id)})
(deftest test-send-message!
;; NOTE(oskarth): Test assumes callback is always called, otherwise it won't terminate
;; TODO(oskarth): Add a timeout async function where we fail test if it takes too long to finish
;; TODO(oskarth): Fix this test, issue with private key not being persisted
#_(deftest test-send-message!
(async done
(node/start!)
(let [web3 (make-web3)
@ -63,3 +70,15 @@
:content-type "text/plain"
:content "123"
:timestamp 1498723691404}}}))))
;; TODO(oskarth): Add fixtures to start node before running tests against node
(deftest test-whisper-version!
(testing "Whisper version supported"
(async done
(node/start!)
(let [web3 (make-web3)
shh (web3.utils/shh web3)]
(.version shh
(fn [& args]
(is (= "5.0" (second args)))
(done)))))))

View File

@ -13,18 +13,18 @@
(let [dir (s/join "/" [build-dir "status-go"])
opts #js {:cwd dir}]
(if-not (utils/exist? dir)
(utils/exec-sync "git clone https://github.com/status-im/status-go.git -b bug/whisper-on-geth1.6.1" #js {:cwd build-dir})
(utils/exec-sync "git pull origin bug/whisper-on-geth1.6.1" opts))
(utils/exec-sync "git clone https://github.com/status-im/status-go.git -b develop" #js {:cwd build-dir})
(utils/exec-sync "git pull origin develop" opts))
(println "Compile statusgo...")
(utils/exec-sync "make statusgo" opts)
(println "Done.")))
(defn start! []
(when-not @node-process
(println "Start wnode...")
(println "Start statusd...")
(let [dir (s/join "/" [build-dir "status-go" "build" "bin"])]
(let [proc (utils/spawn "./statusd"
["wnode" "--http" "--httpport" "8645"]
["--http" "--httpport" "8645" "-shh" "-logfile" "statusd.log"]
{:cwd dir})]
(reset! node-process proc)
(utils/sleep 5)
@ -32,7 +32,7 @@
(defn stop! []
(println "Stop wnode...")
(println "Stop statusd...")
(.kill @node-process)
(println "Done.")
(reset! node-process nil))