Merge PR #1281: Don't run defers if it would result in an NPE

* Don't run defers if it would result in an NPE
* Nuke CircleCI caches
This commit is contained in:
Dev Ojha 2018-06-16 00:49:55 -07:00 committed by Christopher Goes
parent 364bb0813f
commit 1f88b0bf8f
5 changed files with 33 additions and 29 deletions

View File

@ -16,7 +16,7 @@ jobs:
- checkout
- restore_cache:
keys:
- v2-pkg-cache
- v1-pkg-cache
- run:
name: tools
command: |
@ -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
@ -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: |
@ -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: |
@ -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: |
@ -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: |
@ -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: |

View File

@ -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*
@ -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*

View File

@ -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))
@ -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)
@ -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)
@ -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)

View File

@ -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)
}()

View File

@ -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)