@@ -15,7 +15,7 @@ this document carefully.
1515
1616- Git
1717- Golang
18- - One or all of the supported datastores (Zookeeper / Consul / Etcd / Redis / BoltDB)
18+ - One or all of the supported datastore (Zookeeper / Consul / Etcd / Redis / BoltDB)
1919
2020### Installing Golang
2121
@@ -25,144 +25,17 @@ following these [Guidelines](https://golang.org/doc/install).
2525An easy way to get started on mac OS is to use [ homebrew] ( https://brew.sh ) and type
2626` brew install go ` in a shell.
2727
28- In addition to the language runtime, make sure you install these tools locally using
29- ` go get ` :
30-
31- - ** fmt** (to format source code)
32- - ** goimports** (to automatically include and triage imports)
33-
34- Once you have a working Go installation, follow the next steps:
35-
36- - Get the repository:
37-
38- go get -u github.com/kvtools/valkeyrie
39-
40- - Checkout on a new branch from the master branch to start working on a patch
41-
42- git checkout -b mybranch
43-
4428### Local testing of key/value stores
4529
46- In addition to installing golang, you will need to install some or all of the key
47- value stores for testing.
30+ In addition to installing golang, you will need to install some or all of the key value stores for testing.
4831
4932Refer to each of these stores documentation in order to proceed with installation.
50- Generally, the tests are using the ** default configuration** with the ** default port**
51- to connect to a store and run the test suite.
52-
53- To test a change, you can proceed in two ways:
54-
55- - You installed a ** single key/value** store of your choice:
56-
57- - In this case, navigate to the store folder, for example ` valkeyrie/store/etcd/v3 ` and run:
58-
59- go test .
60-
61- - Finally, test for race conditions using the following command:
62-
63- go test -v -race .
64-
65- - You installed ** all key/value** stores and want to run the whole test suite:
66-
67- - At the base of the project directory, run:
68-
69- go test ./...
70-
71- - To test for race conditions, run:
72-
73- go test -v -race ./...
74-
75- ### Flush Key/Value pairs and Specific configurations
76-
77- Once in a while, you may need to flush key/value pairs from your local store installations:
78- for example if you stop the tests purposefully with keys still being locked. This section
79- describes how to easily start distributed backend storage locally and flush the key/value
80- pairs when needed.
81-
82- #### Consul
83-
84- To start consul, use the following command:
85-
86- consul agent -server -bootstrap -advertise=127.0.0.1 -data-dir /tmp/consul -config-file=/path/to/config.json
87-
88- This is pointing to a ` config.json ` file having the following configuration:
89-
90- {"session_ttl_min": "1s"}
91-
92- Finally, to flush the key/value pairs:
93-
94- rm -rf /tmp/consul
95-
96- #### Etcd
97-
98- To start etcd, use the following command:
33+ Generally, the tests are using the ** default configuration** with the ** default port** to connect to a store and run the test suite.
9934
100- etcd --data-dir=/tmp/default.etcd --listen-client-urls 'http://0.0.0.0:4001' --advertise-client-urls 'http://localhost:4001'
101-
102- To flush key/value pairs:
103-
104- rm -rf /tmp/default.etcd
105-
106- #### Zookeeper
107-
108- To start zookeeper, use:
109-
110- zkServer.sh start
111-
112- Make sure you modify the ` zoo.cfg ` file to change the default zookeeper directory for testing. For
113- example, to have the zookeeper director in the ` /tmp ` folder, modify the following line:
114-
115- dataDir=/tmp/zookeeper
116-
117- To flush the key/value pairs:
118-
119- rm -rf /tmp/zookeeper
120-
121- #### Redis
122-
123- To start redis:
124-
125- redis-server
126-
127- For redis, flushing the key/value pairs is as simple as:
128-
129- redis-cli flushall
130-
131- #### Convenient scripts
132-
133- You can group startup/stop/clean operations for every store with simple scripts:
134-
135- - ** Start** :
136-
137- ```
138- #!/bin/bash
139-
140- nohup etcd --data-dir=/tmp/default.etcd --listen-client-urls 'http://0.0.0.0:4001' --advertise-client-urls 'http://localhost:4001' &>/dev/null &
141- nohup consul agent -server -bootstrap -advertise=127.0.0.1 -data-dir /tmp/consul -config-file=/path/to/config.json &>/dev/null &
142- zkServer start &>/dev/null &
143- nohup redis-server &>/dev/null &
144- ```
145-
146- - ** Clean** :
147-
148- ```
149- #!/bin/bash
150-
151- rm -rf /tmp/default.etcd
152- rm -rf /tmp/consul
153- rm -rf /tmp/zookeeper
154- redis-cli flushall
155- ```
156-
157- - ** Stop** :
158-
159- ```
160- #!/bin/bash
35+ To test a change, you can run the test suite with the following command:
16136
162- pkill consul
163- pkill etcd
164- pkill -f zookeeper
165- pkill redis
37+ ``` bash
38+ make test
16639```
16740
16841## Before submitting a change
@@ -174,7 +47,7 @@ the change as soon as possible):
17447- ** Open an issue** to clearly state the problem. This will be helpful to keep track
17548of what needs to be fixed. This also helps triaging and prioritising issues.
17649
177- - ** Run the following command** : ` go fmt ./... ` , to ensure that your code is properly
50+ - ** Run the following command** : ` make validate ` , to ensure that your code is properly
17851formatted.
17952
18053- ** For non-trivial changes, write a test** : this is to ensure that we don't encounter
@@ -184,16 +57,18 @@ any regression in the future.
18457committing a change unless it is a trivial one).
18558
18659- ** Sign-off your commits** using the ` -s ` flag (you can configure an alias to
187- ` git commit ` adding ` -s ` for convenience).
60+ ` git commit ` adding ` -s ` for convenience).
18861
18962- ** Squash your commits** if the pull requests includes many commits that are related.
19063This is to maintain a clean history of the change and better identify faulty commits
19164if reverting a change is ever needed. We will tell you if squashing your commits is
19265necessary.
19366
194- - ** If the change is solving one or more issues listed on the repository** : you can reference
195- the issue in your comment with ` closes #XXX ` or ` fixes #XXX ` . This will automatically close
196- related issues on merging the change.
67+ - ** If the change is solving one or more issues listed on the repository** : you
68+ can reference the issue in your comment with ` closes #XXX ` or ` fixes #XXX ` .
69+ This will automatically close related issues on merging the change. See
70+ [ Github documentation] ( https://help.github.com/articles/closing-issues-using-keywords/ )
71+ for more details.
19772
19873Finally, submit your * Pull Request* .
19974
0 commit comments