@@ -15,25 +15,16 @@ Integration test for hyper cli
1515 - [hyper only](#hyper-only)
1616 - [both](#both)
1717 - [docker only](#docker-only)
18- - [ Prepare] ( #prepare )
19- - [clone hypercli repo](#clone-hypercli-repo)
20- - [build docker image](#build-docker-image)
21- - [make hyper cli in container](#make-hyper-cli-in-container)
22- - [common info in container](#common-info-in-container)
2318- [ Run test case] ( #run-test-case )
24- - [enter container](#enter-container)
25- - [run test in container](#run-test-in-container)
26- - [(optional)test connection to apirouter service](#optionaltest-connection-to-apirouter-service)
27- - [prepare test case](#prepare-test-case)
28- - [adjust test case code](#adjust-test-case-code)
29- - [start test](#start-test)
30- - [ Check test result] ( #check-test-result )
31- - [if test case passed](#if-test-case-passed)
32- - [if find issues](#if-find-issues)
33- - [if test case will be supported in the future](#if-test-case-will-be-supported-in-the-future)
34- - [ After issues fixed] ( #after-issues-fixed )
35-
36- - [ Run test on localhost] ( #run-test-on-localhost )
19+ - [clone hypercli repo](#clone-hypercli-repo)
20+ - [run test in docker container](#run-test-in-docker-container)
21+ - [build docker image](#build-docker-image)
22+ - [make hyper cli](#make-hyper-cli)
23+ - [enter container](#enter-container)
24+ - [run test in container](#run-test-in-container)
25+ - [Run test on localhost](#run-test-on-localhost)
26+ - [prepare](#prepare)
27+ - [run test case](#run-test-case)
3728
3829<!-- /TOC -->
3930
@@ -168,16 +159,16 @@ push save tag top unpause
168159update wait
169160```
170161
171-
172-
173- # Prepare
162+ # Run test case
174163
175164## clone hypercli repo
176165```
177- $ git clone https://github.com/hyperhq/hypercli.git -b integration-test
166+ $ git clone https://github.com/hyperhq/hypercli.git
178167```
179168
180- ## build docker image
169+ ## run test in docker container
170+
171+ ### build docker image
181172
182173> build docker image in host OS
183174> Use ` CentOS ` as test env
@@ -187,7 +178,7 @@ $ git clone https://github.com/hyperhq/hypercli.git -b integration-test
187178$ ./util.sh build
188179```
189180
190- ## make hyper cli in container
181+ ### make hyper cli
191182
192183> build hyper cli binary from source code
193184
@@ -196,25 +187,7 @@ $ ./util.sh build
196187$ ./util.sh make
197188```
198189
199- ## common info in container
200-
201- - work dir : ` /go/src/github.com/hyperhq/hypercli `
202- - hyper config : ` /root/.hyper/config.json `
203- - hyper cli binary: ` /usr/bin/hyper ` -> ` /go/src/github.com/hyperhq/hypercli/hyper/hyper `
204- - hyper cli alias : ` hypercli ` => ` hyper -H ${DOCKER_HOST} `
205- - test case dir : ` /go/src/github.com/hyperhq/hypercli/integration-cli `
206- ```
207- integration-cli
208- ├── skip => test cases to be ignored
209- ├── todo => test cases to be tested
210- ├── issue => test cases have issue/bug
211- └── passed => test cases have passed
212- ```
213-
214-
215- # Run test case
216-
217- ## enter container
190+ ### enter container
218191
219192> update ` ACCESS_KEY ` and ` SECRET_KEY ` in ` integration-cli/util.conf `
220193
@@ -223,82 +196,14 @@ integration-cli
223196$ ./util.sh enter
224197```
225198
226- ## run test in container
227-
228- ### (optional)test connection to apirouter service
229- ```
230- // run in any dir in container
231- $ hypercli version
232- $ hypercli info | grep "ID" #tenant id
233- $ hypercli pull busybox
234- $ hypercli images
235- ```
236-
237- ### prepare test case
238-
239- - ** test new case** : move test case from ` integration-cli/todo ` to ` integration-cli `
240- - ** test issue case after fixed** : move test case from ` integration-cli/issue ` to ` integration-cli `
241-
242- ### adjust test case code
243-
244- - add ` printTestCaseName(); defer printTestDuration(time.Now()) ` in function start with ` Test `
245- - hyper cli source will be mapped in to the container, so the test case code can be modified out of container
246-
199+ ### run test in container
247200```
248- //example:
249- func (s *DockerSuite) TestVersionEnsureSucceeds(c *check.C) {
250- printTestCaseName(); defer printTestDuration(time.Now()) <<<<<<======
251- out, _ := dockerCmd(c, "version")
252-
253- //test result will be output like:
254- [2016-04-26 03:21:52] github.com/hyperhq/hypercli/integration-cli.(*DockerSuite).TestVersionEnsureSucceeds - 1.952121 sec
255- ```
256-
257- ### start test
258-
259- ```
260- // run in dir hypercli/integration-cli in container
261- $ go test
262- ```
263-
264- # Check test result
265-
266- > Check the ` passed ` number of ` go test ` result
267-
268- ```
269- ...
270- INFO: Testing against a remote daemon
271- ...
272- OK: ? passed, ? skipped
273- PASS
274- ok github.com/hyperhq/hypercli/integration-cli ?s
201+ $ ./util.sh test all
275202```
276203
277- ## if test case passed
278-
279- - move the test case to ` integration-cli/passed ` dir
280- - continue next test case
281-
282- ## if find issues
283-
284- - move the test case to ` integration-cli/issue ` dir
285- - please create a new issue here: https://github.com/hyperhq/hypercli/issues
286- - continue next test case
287-
288- ## if test case will be supported in the future
289-
290- - move the test case to ` integration-cli/future ` dir
291- - continue next test case
292-
293- # After issues fixed
294-
295- - move the test case from ` integration-cli/issue ` to ` integration-cli ` dir
296- - go to [ start test] ( #start-test )
297-
298-
299- # Run test on localhost
204+ ## Run test on localhost
300205
301- ## prepare
206+ ### prepare
302207
303208```
304209// ensure hyperhq and docker dir
@@ -325,12 +230,11 @@ $ ./util.sh
325230
326231// config util.conf
327232$ vi util.conf
328- HYPER_CONFIG=<$HOME/.hyper>
329233ACCESS_KEY="<hyper access key>"
330234SECRET_KEY="<hyper secret key>"
331235```
332236
333- ## run test case
237+ ### run test case
334238
335239```
336240// run all test cases
0 commit comments