Skip to content

Commit

Permalink
Merge PR #1281: Don't run defers if it would result in an NPE
Browse files Browse the repository at this point in the history
* Don't run defers if it would result in an NPE
* Nuke CircleCI caches
  • Loading branch information
ValarDragon authored and cwgoes committed Jun 16, 2018
1 parent 364bb08 commit 1f88b0b
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 29 deletions.
24 changes: 12 additions & 12 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- checkout
- restore_cache:
keys:
- v2-pkg-cache
- v1-pkg-cache
- run:
name: tools
command: |
Expand All @@ -39,11 +39,11 @@ jobs:
- bin
- profiles
- save_cache:
key: v2-pkg-cache
key: v1-pkg-cache
paths:
- /go/pkg
- save_cache:
key: v2-tree-{{ .Environment.CIRCLE_SHA1 }}
key: v1-tree-{{ .Environment.CIRCLE_SHA1 }}
paths:
- /go/src/github.com/cosmos/cosmos-sdk

Expand All @@ -54,9 +54,9 @@ jobs:
- attach_workspace:
at: /tmp/workspace
- restore_cache:
key: v2-pkg-cache
key: v1-pkg-cache
- restore_cache:
key: v2-tree-{{ .Environment.CIRCLE_SHA1 }}
key: v1-tree-{{ .Environment.CIRCLE_SHA1 }}
- run:
name: Get metalinter
command: |
Expand All @@ -76,9 +76,9 @@ jobs:
- attach_workspace:
at: /tmp/workspace
- restore_cache:
key: v2-pkg-cache
key: v1-pkg-cache
- restore_cache:
key: v2-tree-{{ .Environment.CIRCLE_SHA1 }}
key: v1-tree-{{ .Environment.CIRCLE_SHA1 }}
- run:
name: Test unit
command: |
Expand All @@ -92,9 +92,9 @@ jobs:
- attach_workspace:
at: /tmp/workspace
- restore_cache:
key: v2-pkg-cache
key: v1-pkg-cache
- restore_cache:
key: v2-tree-{{ .Environment.CIRCLE_SHA1 }}
key: v1-tree-{{ .Environment.CIRCLE_SHA1 }}
- run:
name: Test cli
command: |
Expand All @@ -108,9 +108,9 @@ jobs:
- attach_workspace:
at: /tmp/workspace
- restore_cache:
key: v2-pkg-cache
key: v1-pkg-cache
- restore_cache:
key: v2-tree-{{ .Environment.CIRCLE_SHA1 }}
key: v1-tree-{{ .Environment.CIRCLE_SHA1 }}
- run:
name: Run tests
command: |
Expand All @@ -132,7 +132,7 @@ jobs:
- attach_workspace:
at: /tmp/workspace
- restore_cache:
key: v2-tree-{{ .Environment.CIRCLE_SHA1 }}
key: v1-tree-{{ .Environment.CIRCLE_SHA1 }}
- run:
name: gather
command: |
Expand Down
7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@

## 0.20.0

*TBD*
*TBD*

BREAKING CHANGES
* Change default ports from 466xx to 266xx

FIXES
* \#1259 - fix bug where certain tests that could have a nil pointer in defer

## 0.19.0

*June 13, 2018*
Expand Down Expand Up @@ -42,7 +45,7 @@ FEATURES
* [docs] Reorganize documentation
* [docs] Update staking spec, create WIP spec for slashing, and fees

## 0.18.0
## 0.18.0

*June 9, 2018*

Expand Down
28 changes: 14 additions & 14 deletions client/lcd/lcd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func TestKeys(t *testing.T) {

// update key
jsonStr = []byte(fmt.Sprintf(`{
"old_password":"%s",
"old_password":"%s",
"new_password":"12345678901"
}`, newPassword))

Expand Down Expand Up @@ -347,8 +347,8 @@ func TestTxs(t *testing.T) {

func TestValidatorsQuery(t *testing.T) {
cleanup, pks, port := InitializeTestLCD(t, 2, []sdk.Address{})
require.Equal(t, 2, len(pks))
defer cleanup()
require.Equal(t, 2, len(pks))

validators := getValidators(t, port)
assert.Equal(t, len(validators), 2)
Expand Down Expand Up @@ -448,12 +448,12 @@ func doSend(t *testing.T, port, seed, name, password string, addr sdk.Address) (
}

jsonStr := []byte(fmt.Sprintf(`{
"name":"%s",
"name":"%s",
"password":"%s",
"account_number":%d,
"sequence":%d,
"account_number":%d,
"sequence":%d,
"gas": 10000,
"amount":[%s]
"amount":[%s]
}`, name, password, accnum, sequence, coinbz))
res, body := Request(t, port, "POST", "/accounts/"+receiveAddrBech+"/send", jsonStr)
require.Equal(t, http.StatusOK, res.StatusCode, body)
Expand All @@ -478,18 +478,18 @@ func doIBCTransfer(t *testing.T, port, seed, name, password string, addr sdk.Add
sequence := acc.GetSequence()

// send
jsonStr := []byte(fmt.Sprintf(`{
"name":"%s",
"password": "%s",
jsonStr := []byte(fmt.Sprintf(`{
"name":"%s",
"password": "%s",
"account_number":%d,
"sequence": %d,
"sequence": %d,
"gas": 100000,
"amount":[
{
"denom": "%s",
"amount": 1
{
"denom": "%s",
"amount": 1
}
]
]
}`, name, password, accnum, sequence, "steak"))
res, body := Request(t, port, "POST", "/ibc/testchain/"+receiveAddrBech+"/send", jsonStr)
require.Equal(t, http.StatusOK, res.StatusCode, body)
Expand Down
1 change: 1 addition & 0 deletions server/start_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (

func TestStartStandAlone(t *testing.T) {
home, err := ioutil.TempDir("", "mock-sdk-cmd")
require.Nil(t, err)
defer func() {
os.RemoveAll(home)
}()
Expand Down
2 changes: 1 addition & 1 deletion server/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ import (
// protocol is either tcp, http, etc
func FreeTCPAddr() (addr, port string, err error) {
l, err := net.Listen("tcp", "0.0.0.0:0")
defer l.Close()
if err != nil {
return "", "", err
}
defer l.Close()

portI := l.Addr().(*net.TCPAddr).Port
port = fmt.Sprintf("%d", portI)
Expand Down

0 comments on commit 1f88b0b

Please sign in to comment.