Skip to content

Instantly share code, notes, and snippets.

View reiddraper's full-sized avatar
🍹

Reid Draper reiddraper

🍹
View GitHub Profile
git tag --contains 6f144b9208b8d5dc12cd75a2e5f9fcd1574ce670
1.2.0
1.3.0
1.3.3
1.3.3slf
1.4.0.1
1.4.0.2
Java-1.2.1-release
Python-1.2.1-release
@reiddraper
reiddraper / convenience.clj
Last active December 17, 2015 23:09
nested properties in simple-check
(defn gen-creator
[{:arbitrary arbitrary-fun :shrink shrink-fun}]
(reify Generator
(arbitrary [this]
(arbitrary-fun this)
(shrink [this value]
(shrink-fun this value)))
{-# LANGUAGE TemplateHaskell #-}
module Main
where
import System.Environment (getArgs)
import Data.ByteString.Char8 (pack)
import Control.Distributed.Process (say, Process(..), spawn, RemoteTable(..))
import Control.Distributed.Process.Node (newLocalNode, initRemoteTable, runProcess, localNodeId, LocalNode(..))
import Control.Distributed.Process.Internal.Types (NodeId(..))
{-# LANGUAGE TemplateHaskell #-}
module Main
where
import System.Environment (getArgs)
import Data.ByteString.Char8 (pack)
import Control.Distributed.Process (say, Process, spawnLink, RemoteTable)
import Control.Distributed.Process.Node (newLocalNode, initRemoteTable, runProcess, localNodeId, LocalNode(..))
import Control.Distributed.Process.Internal.Types (NodeId(..))
(require '[simple-check.core :as sc])
(require '[simple-check.generators :as gen])
(require '[simple-check.properties :as prop])
(use 'byte-transforms)
(def compression-type (gen/elements ["lz4" "snappy" "gzip" "zlib"]))
;; a simple round-trip compression property...
;; for all byte-arrays `b`, compressiong with
{
"props": {
"allow_mult": true,
"basic_quorum": false,
"big_vclock": 50,
"chash_keyfun": {
"fun": "chash_std_keyfun",
"mod": "riak_core_util"
},
"dw": "quorum",
@reiddraper
reiddraper / sort-idempotent.clj
Created October 23, 2013 00:32
Uses simple-check to test that sorting is idempotent.
(require '[simple-check.core :as sc])
(require '[simple-check.generators :as gen])
(require '[simple-check.properties :as prop])
(def sort-idempotent-prop
(prop/for-all [v (gen/vector gen/int)]
(= (sort v) (sort (sort v)))))
(sc/quick-check 100 sort-idempotent-prop)
;; => {:result true, :num-tests 100, :seed 1382488326530}
12:50:24 <{mochiweb_acceptor,init,3}> {riak_client,new,2}
12:50:24 <{mochiweb_acceptor,init,3}> {riak_client,instance,2}
12:50:24 <{mochiweb_acceptor,init,3}> {riak_client,get,4}
12:50:24 <{mochiweb_acceptor,init,3}> {riak_client,mk_reqid,1}
12:50:24 <{mochiweb_acceptor,init,3}> {riak_client,recv_timeout,2}
dd if=/dev/zero of=/tmp/output bs=25k count=1k
for i in {1..10}; do time curl -X PUT localhost:8098/riak/foo/a --data-binary @/tmp/output > foo; done
select(2, [0 1], NULL, NULL, {900, 0}) = 1 (in [0], left {899, 949910})
wait4(1401, 0x7fffe90edd0c, WNOHANG, NULL) = 0
read(0, "10:53:10.322 [error] Supervisor "..., 8192) = 438
lseek(2, 0, SEEK_END) = 90736
write(2, "10:53:10.322 [error] Supervisor "..., 438) = 438
select(2, [0 1], NULL, NULL, {900, 0}) = 1 (in [0], left {899, 958221})
wait4(1401, 0x7fffe90edd0c, WNOHANG, NULL) = 0
read(0, "10:53:14.135 [error] Supervisor "..., 8192) = 461
lseek(2, 0, SEEK_END)