Install Sable from path provided with --sable-bin
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@ -5,6 +5,7 @@ pom.xml.asc
|
||||
*.class
|
||||
/lib/
|
||||
/classes/
|
||||
/store/
|
||||
/target/
|
||||
/checkouts/
|
||||
.lein-deps-sum
|
||||
|
3
doc/intro.md
Normal file
3
doc/intro.md
Normal file
@ -0,0 +1,3 @@
|
||||
# Introduction to jable
|
||||
|
||||
TODO: write [great documentation](http://jacobian.org/writing/what-to-write/)
|
9
project.clj
Normal file
9
project.clj
Normal file
@ -0,0 +1,9 @@
|
||||
(defproject jable "0.1.0-SNAPSHOT"
|
||||
:description "Jepsen tests for the Sable IRCd"
|
||||
:url "https://git.tf/val/jable/"
|
||||
:license {:name "AGPL-3.0-only"
|
||||
:url "https://www.gnu.org/licenses/agpl-3.0.txt"}
|
||||
:dependencies [[org.clojure/clojure "1.11.1"]
|
||||
[jepsen "0.3.3"]]
|
||||
:repl-options {:init-ns jable.core}
|
||||
:main jable.cli)
|
42
src/jable/cli.clj
Normal file
42
src/jable/cli.clj
Normal file
@ -0,0 +1,42 @@
|
||||
; Copyright (C) 2023 Val Lorentz
|
||||
;
|
||||
; This program is free software: you can redistribute it and/or modify it under the
|
||||
; terms of the GNU Affero General Public License version 3, as published by the Free
|
||||
; Software Foundation.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
; WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
; PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU Affero General Public License along with
|
||||
; this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
(ns jable.cli
|
||||
(:require [jepsen.cli :as cli]
|
||||
[jepsen.tests :as tests]
|
||||
[jepsen.os.debian :as debian]
|
||||
[jable.db :as db]))
|
||||
|
||||
(defn sable-test
|
||||
"Given an options map from the command line runner (e.g. :nodes, :ssh,
|
||||
:concurrency, ...), constructs a test map."
|
||||
[opts]
|
||||
(merge tests/noop-test
|
||||
opts
|
||||
{:name "etcd"
|
||||
:os debian/os
|
||||
:db (db/sable (:sable-bin opts))
|
||||
:pure-generators true}))
|
||||
|
||||
(def cli-opts
|
||||
"Additional command line options."
|
||||
[[nil "--sable-bin SABLE/BIN/" "Path to a directory containing Sable's binary (eg. ~/sable/target/debug/)"]])
|
||||
|
||||
(defn -main
|
||||
"Handles command line arguments. Can either run a test, or a web server for
|
||||
browsing results."
|
||||
[& args]
|
||||
(cli/run! (merge (cli/single-test-cmd {:test-fn sable-test
|
||||
:opt-spec cli-opts})
|
||||
(cli/serve-cmd))
|
||||
args))
|
6
src/jable/core.clj
Normal file
6
src/jable/core.clj
Normal file
@ -0,0 +1,6 @@
|
||||
(ns jable.core)
|
||||
|
||||
(defn foo
|
||||
"I don't do a whole lot."
|
||||
[x]
|
||||
(println x "Hello, World!"))
|
39
src/jable/db.clj
Normal file
39
src/jable/db.clj
Normal file
@ -0,0 +1,39 @@
|
||||
; Copyright (C) 2023 Val Lorentz
|
||||
;
|
||||
; This program is free software: you can redistribute it and/or modify it under the
|
||||
; terms of the GNU Affero General Public License version 3, as published by the Free
|
||||
; Software Foundation.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
; WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
; PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU Affero General Public License along with
|
||||
; this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
(ns jable.db
|
||||
(:require [clojure.tools.logging :refer :all]
|
||||
[clojure.string :as str]
|
||||
[jepsen [control :as c]
|
||||
[db :as db]]
|
||||
[jepsen.control.util :as cu]
|
||||
[jepsen.control.core :as cc]
|
||||
[jepsen.control.scp :as scp]
|
||||
[jepsen.os.debian :as debian]))
|
||||
|
||||
(defn sable
|
||||
"Sable IRCd install from binaries in a local directory."
|
||||
[sable_bin_path]
|
||||
(reify db/DB
|
||||
(setup! [_ test node]
|
||||
(info node "installing Sable from" sable_bin_path)
|
||||
(c/exec "rm" "-rf" "/tmp/sable_upload")
|
||||
(c/exec "mkdir" "/tmp/sable_upload")
|
||||
(let [remote_bin_path (c/upload (map (fn [file] (str sable_bin_path file))
|
||||
["auth_client" "listener_process" "sable_ircd"])
|
||||
"/tmp/sable_upload")]
|
||||
(c/su
|
||||
(c/exec* "cp" (str remote_bin_path "/*") "/usr/local/bin"))))
|
||||
|
||||
(teardown! [_ test node]
|
||||
(info node "tearing down Sable"))))
|
7
test/jable/core_test.clj
Normal file
7
test/jable/core_test.clj
Normal file
@ -0,0 +1,7 @@
|
||||
(ns jable.core-test
|
||||
(:require [clojure.test :refer :all]
|
||||
[jable.core :refer :all]))
|
||||
|
||||
(deftest a-test
|
||||
(testing "FIXME, I fail."
|
||||
(is (= 0 1))))
|
Reference in New Issue
Block a user