Skip to content

Commit

Permalink
Added readme and commands
Browse files Browse the repository at this point in the history
  • Loading branch information
AkshayGadikar committed Mar 4, 2019
1 parent 2c5ff42 commit 15be89f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 16 deletions.
21 changes: 15 additions & 6 deletions README.md
Expand Up @@ -37,22 +37,31 @@ and then following the instructions [here](examples/api/basic-gateway) to build

## Testing

The commands supported include:
- clean
- build
- generate
- test
- test-short

To run tests issue the following command in the root of the project:

```bash
go test -p 1 ./...
go run build/build.go test
```
It cleans the cache, and runs all the tests in your directory.
The tests should take ~2 mintues. To re-run the tests first run the following:


The `-p 1` is needed to prevent tests from being run in parallel. The tests should take ~2 mintues. To re-run the tests first run the following:
To skip the integration tests use the `test-short` command:

```bash
go clean -testcache
go run build/build.go test-short
```

To skip the integration tests use the `-short` flag:

To know the USAGE and the list of commands supported:
```bash
go test -p 1 -short ./...
go run build/build.go help
```

# Resource
Expand Down
18 changes: 8 additions & 10 deletions build/build.go
@@ -1,17 +1,10 @@
// +build ignore

package main

import (
"flag"
"fmt"
//"io/ioutil"
"os"
"os/exec"
//"path/filepath"
//"reflect"
//"runtime"
//"strings"
)

func main() {
Expand All @@ -35,10 +28,13 @@ func main() {
case "generate":
generate()
case "help":
fmt.Println("[USAGE]: go run build.go [target]")
fmt.Println("target-list:")
fmt.Println(" clean - clean up")
fmt.Println(" test - run full test")
fmt.Println(" test-short - skip integration tests")
fmt.Println(" generate - generates code as per directives")
fmt.Println( "build - to build all files")
default:
fmt.Println("[USAGE]: go run build.go [target]")
}
Expand All @@ -50,14 +46,14 @@ func build(){
}

func test() {
clean()
build()
command("go", "clean", "-testcache")
command("go", "test","-p","1","./...")
}

func testshort() {
clean()
build()
command("go", "clean", "-testcache")
command("go", "test","-p","1","-short","./...")
}

Expand All @@ -77,5 +73,7 @@ func command(name string, arg ...string) {
if err != nil {
os.Stderr.WriteString(err.Error())
}
fmt.Println(string(output))
if output != nil {
fmt.Println(string(output))
}
}

0 comments on commit 15be89f

Please sign in to comment.