Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jepsen.generator

This library provides the compositional generator system at the heart of Jepsen.

clojars badge cljdoc badge

Generators produce a series of operations Jepsen would like to perform against a system, like "Set key x to 3". They also react to operations as they happen. For example, if a write fails, the generator could decide to retry it.

In addition to the generators themselves, this library provides:

  • jepsen.random: Pluggable random values
  • jepsen.generator.test: Helpers for testing generators
  • jepsen.generator.context: A high-performance, pure data structure which keeps track of the state used by generators
  • jepsen.generator.translation-table: Maps worker threads to integers

Example

(gen/phases (->> (gen/mix [(repeat {:f :read})
                           (map (fn [x] {:f :write, :value x}) (range))])
                 (gen/stagger 1/10)
                 (gen/nemesis (->> (cycle [{:f :break}
                                           {:f :repair}])
                                   (gen/stagger 5)))
                 (gen/time-limit 30))
            (gen/log "Recovering")
            (gen/nemesis {:f :repair})
            (gen/sleep 10)
            (gen/log "Final read")
            (gen/clients (gen/each-thread (gen/until-ok {:f :read}))))

License

Copyright © Jepsen, LLC

This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at https://www.eclipse.org/legal/epl-2.0.

This Source Code may also be made available under the following Secondary Licenses when the conditions for such availability set forth in the Eclipse Public License, v. 2.0 are satisfied: GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version, with the GNU Classpath Exception which is available at https://www.gnu.org/software/classpath/license.html.

About

Functional, composable, generators of random operations for database testing

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages