Skip to content

Commit

Permalink
add GA for push and pull-request & fixing code smells
Browse files Browse the repository at this point in the history
  • Loading branch information
rogerwelin committed Jan 15, 2021
1 parent 9e6d4d7 commit aca6aec
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 10 deletions.
23 changes: 23 additions & 0 deletions .github/pullrequest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: pipeline

on: [push, pull_request]
name: Test
jobs:
test:
strategy:
matrix:
go-version: [1.15.x]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}

steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}

- name: Checkout code
uses: actions/checkout@v2

- name: Unit-tests
run: go test -v ./...
12 changes: 6 additions & 6 deletions cmd/cassowary/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ import (

var (
version = "dev"
errConcurrencyLevel = errors.New("Error: Concurrency level cannot be set to: 0")
errRequestNo = errors.New("Error: No. of request cannot be set to: 0")
errNotValidURL = errors.New("Error: Not a valid URL. Must have the following format: http{s}://{host}")
errNotValidHeader = errors.New("Error: Not a valid header value. Did you forget : ?")
errDurationValue = errors.New("Error: Duration cannot be set to 0 or negative")
errConcurrencyLevel = errors.New("error: Concurrency level cannot be set to: 0")
errRequestNo = errors.New("error: No. of request cannot be set to: 0")
errNotValidURL = errors.New("error: Not a valid URL. Must have the following format: http{s}://{host}")
errNotValidHeader = errors.New("error: Not a valid header value. Did you forget : ?")
errDurationValue = errors.New("error: Duration cannot be set to 0 or negative")
)

func outPutResults(metrics client.ResultMetrics) {
Expand Down Expand Up @@ -121,7 +121,7 @@ func validateCLI(c *cli.Context) error {
}
}

if client.IsValidURL(c.String("url")) == false {
if !client.IsValidURL(c.String("url")) {
return errNotValidURL
}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/rogerwelin/cassowary

go 1.14
go 1.15

require (
github.com/aws/aws-sdk-go v1.30.24
Expand Down
6 changes: 3 additions & 3 deletions pkg/client/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func (c *Cassowary) runLoadTest(outPutChan chan<- durationMetrics, workerChan ch
resp.Body.Close()
}

if c.DisableTerminalOutput != true {
if !c.DisableTerminalOutput {
c.Bar.Add(1)
}

Expand Down Expand Up @@ -170,7 +170,7 @@ func (c *Cassowary) Coordinate() (ResultMetrics, error) {

c.Bar = progressbar.New(c.Requests)

if c.DisableTerminalOutput != true {
if !c.DisableTerminalOutput {
col := color.New(color.FgCyan).Add(color.Underline)
col.Printf("\nStarting Load Test with %d requests using %d concurrent users\n\n", c.Requests, c.ConcurrencyLevel)
}
Expand Down Expand Up @@ -232,7 +232,7 @@ func (c *Cassowary) Coordinate() (ResultMetrics, error) {
close(channel)

end := time.Since(start)
if c.DisableTerminalOutput != true {
if !c.DisableTerminalOutput {
fmt.Println(end)
}

Expand Down

0 comments on commit aca6aec

Please sign in to comment.