diff --git a/.github/workflows/cla-check.yml b/.github/workflows/cla-check.yml deleted file mode 100644 index b49bbeb..0000000 --- a/.github/workflows/cla-check.yml +++ /dev/null @@ -1,11 +0,0 @@ -name: Canonical CLA - -on: - - pull_request - -jobs: - cla-check: - runs-on: ubuntu-20.04 - steps: - - name: Check if CLA signed - uses: canonical/has-signed-canonical-cla@v1 diff --git a/.github/workflows/test-build-run.yml b/.github/workflows/test-build-run.yml index b5401a8..fdd4fc3 100644 --- a/.github/workflows/test-build-run.yml +++ b/.github/workflows/test-build-run.yml @@ -1,25 +1,25 @@ -name: Callable Dqlite Jepsen tests +name: Callable Cowsql Jepsen tests on: workflow_dispatch: inputs: raft-repo: description: 'raft repo' - default: 'canonical/raft' + default: 'cowsql/raft' raft-ref: description: 'raft branch or ref' default: 'master' - dqlite-repo: - description: 'dqlite repo' - default: 'canonical/dqlite' - dqlite-ref: - description: 'dqlite branch or ref' + cowsql-repo: + description: 'cowsql repo' + default: 'cowsql/cowsql' + cowsql-ref: + description: 'cowsql branch or ref' default: 'master' - go-dqlite-repo: - description: 'go-dqlite repo' - default: 'canonical/go-dqlite' - go-dqlite-ref: - description: 'go-dqlite branch or ref' + go-cowsql-repo: + description: 'go-cowsql repo' + default: 'cowsql/go-cowsql' + go-cowsql-ref: + description: 'go-cowsql branch or ref' default: 'master' workloads: description: 'Jepsen workloads as JSON, e.g. [ append, bank ]' @@ -28,18 +28,18 @@ on: description: "Jepsen nemesis as JSON, e.g. [ 'pause,disk' ]" required: true disk: - description: "Enable or disable dqlite's disk-mode e.g. [ '0', '1' ]" + description: "Enable or disable cowsql's disk-mode e.g. [ '0', '1' ]" required: true cli-opts: description: 'Jepsen cli opts, e.g. --node-targets primaries' required: false workflow_call: inputs: - jepsen-dqlite-repo: + jepsen-cowsql-repo: type: string required: false - default: 'canonical/jepsen.dqlite' - jepsen-dqlite-ref: + default: 'cowsql/jepsen.ribon' + jepsen-cowsql-ref: type: string required: false default: 'master' @@ -55,16 +55,16 @@ on: raft-ref: type: string required: false - dqlite-repo: + cowsql-repo: type: string required: false - dqlite-ref: + cowsql-ref: type: string required: false - go-dqlite-repo: + go-cowsql-repo: type: string required: false - go-dqlite-ref: + go-cowsql-ref: type: string required: false workloads: @@ -81,12 +81,12 @@ on: required: false env: - RAFT_REPO: 'canonical/raft' + RAFT_REPO: 'cowsql/raft' RAFT_BRANCH: 'master' - DQLITE_REPO: 'canonical/dqlite' - DQLITE_BRANCH: 'master' - GO_DQLITE_REPO: 'canonical/go-dqlite' - GO_DQLITE_BRANCH: 'master' + COWSQL_REPO: 'cowsql/cowsql' + COWSQL_BRANCH: 'master' + GO_COWSQL_REPO: 'cowsql/go-cowsql' + GO_COWSQL_BRANCH: 'master' jobs: test: @@ -102,8 +102,8 @@ jobs: - name: Checkout code uses: actions/checkout@v3 with: - repository: ${{ inputs.jepsen-dqlite-repo || github.repository }} - ref: ${{ inputs.jepsen-dqlite-ref || github.ref }} + repository: ${{ inputs.jepsen-cowsql-repo || github.repository }} + ref: ${{ inputs.jepsen-cowsql-ref || github.ref }} - name: Cache Go modules uses: actions/cache@v3 @@ -170,16 +170,16 @@ jobs: sudo make install sudo ldconfig - - name: Check out dqlite + - name: Check out cowsql uses: actions/checkout@v3 with: - repository: ${{ inputs.dqlite-repo || env.DQLITE_REPO }} - ref: ${{ inputs.dqlite-ref || env.DQLITE_REF }} - path: dqlite + repository: ${{ inputs.cowsql-repo || env.COWSQL_REPO }} + ref: ${{ inputs.cowsql-ref || env.COWSQL_REF }} + path: cowsql - - name: Build dqlite + - name: Build cowsql run: | - cd dqlite + cd cowsql git log -n 1 autoreconf -i ./configure --enable-debug --enable-backtrace @@ -193,7 +193,7 @@ jobs: timeout-minutes: 8 run: | go get golang.org/x/sync/semaphore - go get -tags libsqlite3 github.com/canonical/go-dqlite/app@master + go get -tags libsqlite3 github.com/cowsql/go-cowsql/app go build -tags libsqlite3 -o resources/app resources/app.go sudo ufw disable sleep 0.200 @@ -219,9 +219,9 @@ jobs: with: name: jepsen-data-${{ matrix.workload }}-${{ matrix.nemesis }}-summary path: | - store/dqlite*/**/results.edn - store/dqlite*/**/latency-raw.png - store/dqlite*/**/tail-jepsen.log + store/cowsql*/**/results.edn + store/cowsql*/**/latency-raw.png + store/cowsql*/**/tail-jepsen.log !**/current/ !**/latest/ @@ -231,6 +231,6 @@ jobs: with: name: jepsen-data-${{ matrix.workload }}-${{ matrix.nemesis }}-failure path: | - store/dqlite* + store/cowsql* !**/current/ !**/latest/ diff --git a/.github/workflows/test-custom.yml b/.github/workflows/test-custom.yml index a2c4720..077d53e 100644 --- a/.github/workflows/test-custom.yml +++ b/.github/workflows/test-custom.yml @@ -1,19 +1,19 @@ -name: Dqlite Jepsen tests - custom dispatch +name: Cowsql Jepsen tests - custom dispatch on: workflow_dispatch: inputs: raft-repo: description: raft repo - default: canonical/raft + default: cowsql/raft raft-ref: description: raft branch or ref default: master - dqlite-repo: - description: dqlite repo - default: canonical/dqlite - dqlite-ref: - description: dqlite branch or ref + cowsql-repo: + description: cowsql repo + default: cowsql/cowsql + cowsql-ref: + description: cowsql branch or ref default: master workloads: description: Workloads as a JSON array, e.g. [ 'append' ] @@ -22,7 +22,7 @@ on: description: Nemeses as a JSON array, e.g. [ 'pause', 'disk' ] required: true disk: - description: "Enable or disable dqlite's disk-mode e.g. [ '0', '1 ]" + description: "Enable or disable cowsql's disk-mode e.g. [ '0', '1 ]" required: true cli-opts: description: Jepsen cli opts, e.g. --node-targets primaries @@ -30,15 +30,15 @@ on: jobs: custom-dispatch: - uses: canonical/jepsen.dqlite/.github/workflows/test-build-run.yml@master + uses: cowsql/jepsen.ribon/.github/workflows/test-build-run.yml with: workloads: ${{ inputs.workloads }} nemeses: ${{ inputs.nemeses }} disk: ${{ inputs.disk }} cli-opts: ${{ inputs.cli-opts }} - jepsen-dqlite-repo: canonical/jepsen.dqlite - jepsen-dqlite-ref: master - raft-repo: ${{ inputs.raft-repo || 'canonical/raft' }} + jepsen-cowsql-repo: cowsql/jepsen.ribon + jepsen-cowsql-ref: master + raft-repo: ${{ inputs.raft-repo || 'cowsql/raft' }} raft-ref: ${{ inputs.raft-ref || 'master' }} - dqlite-repo: ${{ inputs.dqlite-repo || 'canonical/dqlite' }} - dqlite-ref: ${{ inputs.dqlite-ref || 'master' }} + cowsql-repo: ${{ inputs.cowsql-repo || 'cowsql/cowsql' }} + cowsql-ref: ${{ inputs.cowsql-ref || 'master' }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f46ea0a..09ddd2c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: Dqlite Jepsen tests - expected pass +name: Cowsql Jepsen tests - expected pass on: push: @@ -9,15 +9,15 @@ on: inputs: raft-repo: description: raft repo - default: canonical/raft + default: cowsql/raft raft-ref: description: raft branch or ref default: master - dqlite-repo: - description: dqlite repo - default: canonical/dqlite - dqlite-ref: - description: dqlite branch or ref + cowsql-repo: + description: cowsql repo + default: cowsql/cowsql + cowsql-ref: + description: cowsql branch or ref default: master jobs: @@ -31,10 +31,10 @@ jobs: 'partition,stop', 'partition,kill', 'partition,member', 'packet,stop', 'pause', 'partition,disk', 'pause,disk' ] disk: > - [ '0', '1' ] - jepsen-dqlite-repo: ${{ github.repository }} - jepsen-dqlite-ref: ${{ github.ref }} - raft-repo: ${{ inputs.raft-repo || 'canonical/raft' }} + [ '0' ] + jepsen-cowsql-repo: ${{ github.repository }} + jepsen-cowsql-ref: ${{ github.ref }} + raft-repo: ${{ inputs.raft-repo || 'cowsql/raft' }} raft-ref: ${{ inputs.raft-ref || 'master' }} - dqlite-repo: ${{ inputs.dqlite-repo || 'canonical/dqlite' }} - dqlite-ref: ${{ inputs.dqlite-ref || 'master' }} + cowsql-repo: ${{ inputs.cowsql-repo || 'cowsql/cowsql' }} + cowsql-ref: ${{ inputs.cowsql-ref || 'master' }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f239f1..a1d55cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,5 +20,5 @@ All notable changes to this project will be documented in this file. This change - Files from the new template. - Widget maker public API - `make-widget-sync`. -[Unreleased]: https://github.com/your-name/jepsen.dqlite/compare/0.1.1...HEAD -[0.1.1]: https://github.com/your-name/jepsen.dqlite/compare/0.1.0...0.1.1 +[Unreleased]: https://github.com/your-name/jepsen.cowsql/compare/0.1.1...HEAD +[0.1.1]: https://github.com/your-name/jepsen.cowsql/compare/0.1.0...0.1.1 diff --git a/README.md b/README.md index 1cf4487..98c92d8 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ -# Dqlite Jepsen Test +# CowSQL Jepsen Test -A Clojure library designed to test Dqlite, an embedded SQL database with Raft +A Clojure library designed to test CowSQL, an embedded SQL database with Raft consensus. ## What is being tested? The tests run concurrent operations to some shared data from different nodes in -a Dqlite cluster, checking that the operations preserve the consistency +a CowSQL cluster, checking that the operations preserve the consistency properties defined in each test. During the tests, various combinations of nemeses can be added to interfere with the database operations and exercise the database's consistency protocols. @@ -35,7 +35,7 @@ See `lein run test --help` and `lein run test-all --help` for options. #### Nemeses + **none** no nemesis -+ **kill** kills random Dqlite test application processes ++ **kill** kills random CowSQL test application processes + **partition** network partitions + **pause** process pauses + **member** remove or re-add a node diff --git a/doc/intro.md b/doc/intro.md index 0582822..2560df4 100644 --- a/doc/intro.md +++ b/doc/intro.md @@ -1,3 +1,3 @@ -# Introduction to jepsen.dqlite +# Introduction to jepsen.cowsql TODO: write [great documentation](http://jacobian.org/writing/what-to-write/) diff --git a/go.mod b/go.mod index 2d5c8b8..cf8776d 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,8 @@ -module jepsen.dqlite +module jepsen.cowsql go 1.13 require ( - github.com/canonical/go-dqlite v1.11.7 + github.com/cowsql/go-cowsql v1.21.0 golang.org/x/sync v0.1.0 ) diff --git a/project.clj b/project.clj index 99718fa..cc578f4 100644 --- a/project.clj +++ b/project.clj @@ -1,18 +1,18 @@ -(defproject jepsen.dqlite "0.1.0" - :description "Jepsen tests for Dqlite, a SQLite-based system with Raft consensus." - :url "https://dqlite.io" +(defproject jepsen.cowsql "0.1.0" + :description "Jepsen tests for Cowsql, a SQLite-based system with Raft consensus." + :url "https://cowsql.io" :license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0" :url "https://www.eclipse.org/legal/epl-2.0/"} :dependencies [[org.clojure/clojure "1.11.1"] [jepsen "0.3.2"] [clj-http "3.10.1"]] - :main jepsen.dqlite + :main jepsen.cowsql :jvm-opts ["-Djava.awt.headless=true" "-server" ;"-XX:+PrintGCDetails" ;"-verbose:gc" ] - :repl-options {:init-ns jepsen.dqlite} + :repl-options {:init-ns jepsen.cowsql} :plugins [[lein-codox "0.10.8"] [lein-localrepo "0.5.4"]] :codox {:output-path "target/doc/" diff --git a/resources/app.go b/resources/app.go index db26fb8..2a59224 100644 --- a/resources/app.go +++ b/resources/app.go @@ -21,18 +21,18 @@ import ( "golang.org/x/sync/semaphore" - "github.com/canonical/go-dqlite" - "github.com/canonical/go-dqlite/app" - "github.com/canonical/go-dqlite/client" - "github.com/canonical/go-dqlite/driver" + "github.com/cowsql/go-cowsql" + "github.com/cowsql/go-cowsql/app" + "github.com/cowsql/go-cowsql/client" + "github.com/cowsql/go-cowsql/driver" ) const ( - port = 8080 // This is the API port, the internal dqlite port+1 + port = 8080 // This is the API port, the internal cowsql port+1 schema = "CREATE TABLE IF NOT EXISTS map (key INT, value INT)" ) -func dqliteLog(l client.LogLevel, format string, a ...interface{}) { +func cowsqlLog(l client.LogLevel, format string, a ...interface{}) { log.Printf(fmt.Sprintf("%s: %s\n", l.String(), format), a...) } @@ -40,7 +40,7 @@ func makeAddress(host string, port int) string { return fmt.Sprintf("%s:%d", host, port) } -// Return the dqlite addresses of all nodes preceeding the given one. +// Return the cowsql addresses of all nodes preceeding the given one. // // E.g. with node="n2" and cluster="n1,n2,n3" return ["n1:8081"] func preceedingAddresses(node string, nodes []string) []string { @@ -57,7 +57,7 @@ func preceedingAddresses(node string, nodes []string) []string { return preceeding } -// Return the dqlite addresses of all nodes different from the given one. +// Return the cowsql addresses of all nodes different from the given one. func otherAddresses(node string, nodes []string) []string { others := []string{} for _, name := range nodes { @@ -91,7 +91,7 @@ func withTx(db *sql.DB, f func(tx *sql.Tx) error) error { // Probe all given nodes for connectivity and metadata, then return a // RolesChanges object. // -// Adapted from the private method of the same name in go-dqlite/app. +// Adapted from the private method of the same name in go-cowsql/app. func makeRolesChanges(a *app.App, nodes []client.NodeInfo, roles app.RolesConfig) app.RolesChanges { state := map[client.NodeInfo]*client.NodeMetadata{} for _, node := range nodes { @@ -120,7 +120,7 @@ func makeRolesChanges(a *app.App, nodes []client.NodeInfo, roles app.RolesConfig ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second) defer cancel() - cli, err := client.New(ctx, node.Address, client.WithLogFunc(dqliteLog)) + cli, err := client.New(ctx, node.Address, client.WithLogFunc(cowsqlLog)) if err == nil { metadata, err := cli.Describe(ctx) if err == nil { @@ -616,10 +616,10 @@ func main() { nodes := strings.Split(*cluster, ",") options := []app.Option{ app.WithAddress(makeAddress(addr.IP.String(), port+1)), - app.WithLogFunc(dqliteLog), + app.WithLogFunc(cowsqlLog), app.WithNetworkLatency(time.Duration(*latency) * time.Millisecond), app.WithRolesAdjustmentFrequency(time.Second), - app.WithSnapshotParams(dqlite.SnapshotParams{Threshold: 128, Trailing: 1024}), + app.WithSnapshotParams(cowsql.SnapshotParams{Threshold: 128, Trailing: 1024}), app.WithDiskMode(*disk != 0), app.WithAutoRecovery(false), } @@ -632,7 +632,7 @@ func main() { options = append(options, app.WithCluster(preceedingAddresses(*node, nodes))) } - // Spawn the dqlite server thread. + // Spawn the cowsql server thread. a, err := app.New(*dir, options...) if err != nil { log.Fatalf("create app: %v", err) diff --git a/src/jepsen/dqlite.clj b/src/jepsen/cowsql.clj similarity index 98% rename from src/jepsen/dqlite.clj rename to src/jepsen/cowsql.clj index 75f9f4f..f16c163 100644 --- a/src/jepsen/dqlite.clj +++ b/src/jepsen/cowsql.clj @@ -1,4 +1,4 @@ -(ns jepsen.dqlite +(ns jepsen.cowsql (:gen-class) (:refer-clojure :exclude [test]) (:require [clojure.java.shell :refer [sh]] @@ -12,7 +12,7 @@ [util :as u]] [jepsen.os.ubuntu :as ubuntu] [jepsen.os.container :as container] - [jepsen.dqlite [db :as db] + [jepsen.cowsql [db :as db] [control :as c] [bank :as bank] [set :as set] @@ -77,7 +77,7 @@ (map name) (str/join "-")) num-nodes (count nodes)] - (str "dqlite" + (str "cowsql" "-" workload "-" nemesis "-" num-nodes "n" concurrency "c" @@ -166,7 +166,7 @@ (def cli-opts "Command line options for tools.cli" - [["-v" "--version VERSION" "What version of Dqlite should to install" + [["-v" "--version VERSION" "What version of Cowsql should to install" :default "master"] [nil "--nemesis FAULTS" "A comma-separated list of nemesis faults to enable" @@ -204,7 +204,7 @@ :parse-fn parse-long :validate [pos? "Must be a positive number."]] - ["-b" "--binary BINARY" "Use the given pre-built dqlite test application binary." + ["-b" "--binary BINARY" "Use the given pre-built cowsql test application binary." :default nil] [nil "--cluster-setup-timeout SECS" "How long to wait for the cluster to be ready." diff --git a/src/jepsen/dqlite/append.clj b/src/jepsen/cowsql/append.clj similarity index 94% rename from src/jepsen/dqlite/append.clj rename to src/jepsen/cowsql/append.clj index c0c9007..c708d42 100644 --- a/src/jepsen/dqlite/append.clj +++ b/src/jepsen/cowsql/append.clj @@ -1,8 +1,8 @@ -(ns jepsen.dqlite.append +(ns jepsen.cowsql.append "Test for transactional list append." (:require [jepsen [client :as client]] [jepsen.tests.cycle.append :as append] - [jepsen.dqlite [client :as c]])) + [jepsen.cowsql [client :as c]])) (defrecord Client [conn] client/Client diff --git a/src/jepsen/dqlite/bank.clj b/src/jepsen/cowsql/bank.clj similarity index 95% rename from src/jepsen/dqlite/bank.clj rename to src/jepsen/cowsql/bank.clj index 85172bb..01a92da 100644 --- a/src/jepsen/dqlite/bank.clj +++ b/src/jepsen/cowsql/bank.clj @@ -1,7 +1,7 @@ -(ns jepsen.dqlite.bank +(ns jepsen.cowsql.bank "Implements a bank-account test, where we transfer amounts between a pool of accounts, and verify that reads always see a constant amount." - (:require [jepsen.dqlite [client :as c]] + (:require [jepsen.cowsql [client :as c]] [jepsen [client :as client] [generator :as gen]] [jepsen.tests.bank :as bank])) diff --git a/src/jepsen/dqlite/client.clj b/src/jepsen/cowsql/client.clj similarity index 92% rename from src/jepsen/dqlite/client.clj rename to src/jepsen/cowsql/client.clj index e9f14e1..7b74410 100644 --- a/src/jepsen/dqlite/client.clj +++ b/src/jepsen/cowsql/client.clj @@ -1,5 +1,5 @@ -(ns jepsen.dqlite.client - "Helper functions for interacting with the test Dqlite application." +(ns jepsen.cowsql.client + "Helper functions for interacting with the test Cowsql application." (:require [clojure.tools.logging :refer [info warn]] [clojure.string :as str] [clojure.edn :as edn] @@ -9,7 +9,7 @@ (:import (java.net ConnectException SocketException SocketTimeoutException))) (defn endpoint - "The root HTTP URL of the test Dqlite application API endpoint on a node." + "The root HTTP URL of the test Cowsql application API endpoint on a node." [node] (str "http://" (name node) ":" 8080)) @@ -38,7 +38,7 @@ (edn/read-string response))))) (defn leader - "Return the node name of the current Dqlite leader." + "Return the node name of the current Cowsql leader." [test node] (let [conn (open test node) leader (request conn "GET" "/leader")] @@ -90,7 +90,7 @@ (assoc ~op :type :info, :error :timeout)) (catch [:msg "Error: disk I/O error"] e# (assoc ~op :type :info, :error :disk-io-error)) - (catch [:msg "Error: failed to create dqlite connection: no available dqlite leader server found"] e# + (catch [:msg "Error: failed to create cowsql connection: no available cowsql leader server found"] e# (assoc ~op :type :fail, :error :unavailable)) (catch [:msg "Error: driver: bad connection"] e# (assoc ~op :type (if (= (:f ~op) :read) :fail :info), :error :bad-connection)) diff --git a/src/jepsen/dqlite/control.clj b/src/jepsen/cowsql/control.clj similarity index 98% rename from src/jepsen/dqlite/control.clj rename to src/jepsen/cowsql/control.clj index 79c9430..665c0dd 100644 --- a/src/jepsen/dqlite/control.clj +++ b/src/jepsen/cowsql/control.clj @@ -1,4 +1,4 @@ -(ns jepsen.dqlite.control +(ns jepsen.cowsql.control "Implements the Remote protocol to run commands locally." (:require [clojure.tools.logging :refer :all] [clojure.string :as str] diff --git a/src/jepsen/dqlite/db.clj b/src/jepsen/cowsql/db.clj similarity index 90% rename from src/jepsen/dqlite/db.clj rename to src/jepsen/cowsql/db.clj index eb58d0a..ea1dce5 100644 --- a/src/jepsen/dqlite/db.clj +++ b/src/jepsen/cowsql/db.clj @@ -1,4 +1,4 @@ -(ns jepsen.dqlite.db +(ns jepsen.cowsql.db (:require [clojure.tools.logging :refer :all] [clojure.string :as str] [jepsen [control :as c] @@ -6,10 +6,10 @@ [util :as util :refer [timeout meh]]] [jepsen.control.util :as cu] [jepsen.os.debian :as debian] - [jepsen.dqlite [client :as client]] + [jepsen.cowsql [client :as client]] [slingshot.slingshot :refer [try+ throw+]])) -(def dir "/opt/dqlite") +(def dir "/opt/cowsql") (def bin "app") (def binary (str dir "/" bin)) (def logfile (str dir "/app.log")) @@ -18,24 +18,24 @@ (def core-dump-glob (str data-dir "/core*")) (defn setup-ppa! - "Adds the Dqlite PPA to the APT sources" + "Adds the Cowsql PPA to the APT sources" [version] (let [keyserver "keyserver.ubuntu.com" key "392A47B5A84EACA9B2C43CDA06CD096F50FB3D04" - line (str "deb http://ppa.launchpad.net/dqlite/" + line (str "deb http://ppa.launchpad.net/cowsql/" version "/ubuntu focal main")] - (debian/add-repo! "dqlite" line keyserver key))) + (debian/add-repo! "cowsql" line keyserver key))) (defn install! - "Install the Go dqlite test application." + "Install the Go cowsql test application." [test node] - ;; If we're not running in local mode, install libdqlite from the PPA. + ;; If we're not running in local mode, install libcowsql from the PPA. (when-not (:local test) - (info "Installing libdqlite from PPA") + (info "Installing libcowsql from PPA") (c/su (setup-ppa! (:version test)) - (debian/install [:libdqlite0]))) + (debian/install [:libcowsql0]))) ;; Create the test directory. (let [user (c/exec :whoami)] @@ -48,20 +48,20 @@ (if-let [pre-built-binary (:binary test)] (c/upload pre-built-binary binary) (let [source (str dir "/app.go")] - (info "Building test dqlite application from source") - (c/su (debian/install [:libdqlite-dev :golang])) + (info "Building test cowsql application from source") + (c/su (debian/install [:libcowsql-dev :golang])) (c/upload "resources/app.go" source) - (c/exec "go" "get" "-tags" "libsqlite3" "github.com/canonical/go-dqlite/app") + (c/exec "go" "get" "-tags" "libsqlite3" "github.com/cowsql/go-cowsql/app") (c/exec "go" "build" "-tags" "libsqlite3" "-o" binary source)))) (defn start! - "Start the Go dqlite test application" + "Start the Go cowsql test application" [test node] (if (cu/daemon-running? pidfile) :already-running (c/su (c/exec :mkdir :-p data-dir) - (cu/start-daemon! {:env {:LIBDQLITE_TRACE "1" + (cu/start-daemon! {:env {:LIBCOWSQL_TRACE "1" :LIBRAFT_TRACE "1"} :logfile logfile :pidfile pidfile @@ -74,7 +74,7 @@ :-cluster (str/join "," (:nodes test)))))) (defn kill! - "Gracefully kill, `SIGTERM`, the Go dqlite test application." + "Gracefully kill, `SIGTERM`, the Go cowsql test application." [_test node] (let [signal :SIGTERM] (info "Killing" bin "with" signal "on" node) @@ -83,7 +83,7 @@ :killed)) (defn stop! - "Stop the Go dqlite test application with `stop-daemon!`, + "Stop the Go cowsql test application with `stop-daemon!`, which will `SIGKILL`." [_test _node] (if (not (cu/daemon-running? pidfile)) @@ -213,7 +213,7 @@ set)) (defn db - "Dqlite test application. Takes a tmpfs DB which is set up prior to setting + "Cowsql test application. Takes a tmpfs DB which is set up prior to setting up this DB." [tmpfs] (let [primary-cache (atom []) @@ -255,7 +255,7 @@ (kill! test node) (when tmpfs (db/teardown! tmpfs test node)) - (Thread/sleep 200) ; avoid race: rm: cannot remove '/opt/dqlite/data': Directory not empty + (Thread/sleep 200) ; avoid race: rm: cannot remove '/opt/cowsql/data': Directory not empty (c/su (c/exec :rm :-rf dir))) db/LogFiles diff --git a/src/jepsen/dqlite/nemesis.clj b/src/jepsen/cowsql/nemesis.clj similarity index 93% rename from src/jepsen/dqlite/nemesis.clj rename to src/jepsen/cowsql/nemesis.clj index b0155df..626f0b1 100644 --- a/src/jepsen/dqlite/nemesis.clj +++ b/src/jepsen/cowsql/nemesis.clj @@ -1,10 +1,10 @@ -(ns jepsen.dqlite.nemesis - "Nemeses for Dqlite" +(ns jepsen.cowsql.nemesis + "Nemeses for Cowsql" (:require [jepsen [control :as c] [nemesis :as n] [generator :as gen]] - [jepsen.dqlite.db :as db] + [jepsen.cowsql.db :as db] [jepsen.nemesis.combined :as nc])) (defn member-nemesis @@ -51,7 +51,7 @@ (defn stop-nemesis "A nemesis which responds to `:stop-node` and `:start-node` by politely - stopping and starting the dqlite app." + stopping and starting the cowsql app." [db] (reify n/Nemesis @@ -71,7 +71,7 @@ #{:start-node :stop-node}))) (defn stop-package - "A nemesis package for politely stopping and restarting the dqlite app." + "A nemesis package for politely stopping and restarting the cowsql app." [{:keys [faults stop db interval] :as _opts}] (when (:stop faults) (let [targets (:targets stop) @@ -126,7 +126,7 @@ :color "#90EE90"}}}) (defn nemesis-package - "Constructs a nemesis and generators for dqlite." + "Constructs a nemesis and generators for cowsql." [opts] (let [opts (update opts :faults set)] (->> (concat [(nc/partition-package opts) diff --git a/src/jepsen/dqlite/set.clj b/src/jepsen/cowsql/set.clj similarity index 95% rename from src/jepsen/dqlite/set.clj rename to src/jepsen/cowsql/set.clj index 7a0f9b0..96ab169 100644 --- a/src/jepsen/dqlite/set.clj +++ b/src/jepsen/cowsql/set.clj @@ -1,9 +1,9 @@ -(ns jepsen.dqlite.set +(ns jepsen.cowsql.set (:require [clojure.string :as str] [jepsen [client :as client] [checker :as checker] [generator :as gen]] - [jepsen.dqlite [client :as c]]) + [jepsen.cowsql [client :as c]]) (:import (java.net ConnectException SocketException))) (defn parse-list diff --git a/src/jepsen/dqlite/tmpfs.clj b/src/jepsen/cowsql/tmpfs.clj similarity index 99% rename from src/jepsen/dqlite/tmpfs.clj rename to src/jepsen/cowsql/tmpfs.clj index 0d41e32..7662516 100644 --- a/src/jepsen/dqlite/tmpfs.clj +++ b/src/jepsen/cowsql/tmpfs.clj @@ -1,4 +1,4 @@ -(ns jepsen.dqlite.tmpfs +(ns jepsen.cowsql.tmpfs "Provides a database and nemesis package which can work together to fill up disk space." (:require [clojure.tools.logging :refer [info warn]] diff --git a/test.sh b/test.sh index 8113212..4518d91 100755 --- a/test.sh +++ b/test.sh @@ -9,8 +9,8 @@ # # `setup` should be run only once to launch and initialize the jepsen container. # JEPSEN_ARGS are passed directly to Jepsen (you can omit --no-ssh and --binary). -# For `./test.sh run`, set the env vars RAFT_BRANCH and DQLITE_BRANCH to control -# which raft/dqlite are built, e.g. RAFT_BRANCH=mathieu/fix will build the `fix` +# For `./test.sh run`, set the env vars RAFT_BRANCH and COWSQL_BRANCH to control +# which raft/cowsql are built, e.g. RAFT_BRANCH=mathieu/fix will build the `fix` # branch of https://github.com/MathieuBordere/raft. set -o errexit -o pipefail -o nounset @@ -20,7 +20,7 @@ workspace=/root/workspace push-this-repo() { parent="$(dirname "${BASH_SOURCE[0]}")" - lxc file push -p -r "$parent"/* "$jepsen$workspace/jepsen.dqlite" + lxc file push -p -r "$parent"/* "$jepsen$workspace/jepsen.cowsql" } setup-inner() { @@ -48,18 +48,18 @@ setup-inner() { pushd "$workspace" - git clone -o canonical https://github.com/canonical/raft + git clone -o cowsql https://github.com/cowsql/raft pushd raft git remote add cole https://github.com/cole-miller/raft git remote add mathieu https://github.com/MathieuBordere/raft git remote add mohamed https://github.com/mwnsiri/raft popd - git clone -o canonical https://github.com/canonical/dqlite - pushd dqlite - git remote add cole https://github.com/cole-miller/dqlite - git remote add mathieu https://github.com/MathieuBordere/dqlite - git remote add mohamed https://github.com/mwnsiri/dqlite + git clone -o cowsql https://github.com/cowsql/cowsql + pushd cowsql + git remote add cole https://github.com/cole-miller/cowsql + git remote add mathieu https://github.com/MathieuBordere/cowsql + git remote add mohamed https://github.com/mwnsiri/cowsql popd popd @@ -69,7 +69,7 @@ setup() { lxc launch images:ubuntu/22.04 jepsen -c limits.kernel.core=-1 sleep 5 push-this-repo - lxc exec "$jepsen" -- "$workspace/jepsen.dqlite/test.sh" setup-inner "$@" + lxc exec "$jepsen" -- "$workspace/jepsen.cowsql/test.sh" setup-inner "$@" } run-inner() { @@ -84,19 +84,19 @@ run-inner() { make install popd - pushd dqlite + pushd cowsql git fetch --all - git checkout "$DQLITE_BRANCH" + git checkout "$COWSQL_BRANCH" autoreconf -i ./configure --enable-debug make -j"$(nproc)" make install popd - pushd jepsen.dqlite + pushd jepsen.cowsql ip link show jepsen-br >/dev/null 2>&1 || resources/network.sh setup 5 go get golang.org/x/sync/semaphore - go get -tags libsqlite3 github.com/canonical/go-dqlite/app + go get -tags libsqlite3 github.com/cowsql/go-cowsql/app ldconfig CGO_LDFLAGS_ALLOW='-Wl,-z,now' go build -tags libsqlite3 -o resources/app resources/app.go lein run test --no-ssh --binary "$(pwd)/resources/app" "$@" @@ -110,9 +110,9 @@ run() { test "$(sysctl -n fs.suid_dumpable)" -gt 0 || exit 1 push-this-repo lxc exec $jepsen -- \ - env RAFT_BRANCH="${RAFT_BRANCH:-canonical/master}" \ - DQLITE_BRANCH="${DQLITE_BRANCH:-canonical/master}" \ - "$workspace/jepsen.dqlite/test.sh" run-inner "$@" + env RAFT_BRANCH="${RAFT_BRANCH:-cowsql/master}" \ + COWSQL_BRANCH="${COWSQL_BRANCH:-cowsql/master}" \ + "$workspace/jepsen.cowsql/test.sh" run-inner "$@" } "$@"