-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: test-race failure * chore: to increase codecov * chore: increase codecov
- Loading branch information
Woosang Son
authored
May 3, 2021
1 parent
e72bc53
commit a79c132
Showing
5 changed files
with
136 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -198,80 +198,78 @@ jobs: | |
file: ./coverage.txt | ||
if: env.GIT_DIFF | ||
|
||
# TODO: disable test-race. please enable this after fixing concurrent checkTx | ||
# | ||
# test-race: | ||
# runs-on: ubuntu-latest | ||
# needs: split-test-files | ||
# strategy: | ||
# fail-fast: false | ||
# matrix: | ||
# part: ["00", "01", "02", "03"] | ||
# steps: | ||
# - name: Configure git for private modules | ||
# env: | ||
# TOKEN: ${{ secrets.TOKEN }} | ||
# run: git config --global url."https://${TOKEN}:[email protected]".insteadOf "https://github.com" | ||
# - uses: actions/checkout@v2 | ||
# - uses: actions/[email protected] | ||
# with: | ||
# go-version: 1.15 | ||
# - uses: technote-space/get-diff-action@v4 | ||
# with: | ||
# PATTERNS: | | ||
# **/**.go | ||
# go.mod | ||
# go.sum | ||
# - uses: actions/download-artifact@v2 | ||
# with: | ||
# name: "${{ github.sha }}-${{ matrix.part }}" | ||
# if: env.GIT_DIFF | ||
# - name: test & coverage report creation | ||
# run: | | ||
# xargs --arg-file=pkgs.txt.part.${{ matrix.part }} go test -mod=readonly -json -timeout 30m -race -tags='cgo ledger test_ledger_mock goleveldb' | tee ${{ matrix.part }}-race-output.txt | ||
# if: env.GIT_DIFF | ||
# - uses: actions/upload-artifact@v2 | ||
# with: | ||
# name: "${{ github.sha }}-${{ matrix.part }}-race-output" | ||
# path: ./${{ matrix.part }}-race-output.txt | ||
test-race: | ||
runs-on: ubuntu-latest | ||
needs: split-test-files | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
part: ["00", "01", "02", "03"] | ||
steps: | ||
- name: Configure git for private modules | ||
env: | ||
TOKEN: ${{ secrets.TOKEN }} | ||
run: git config --global url."https://${TOKEN}:[email protected]".insteadOf "https://github.com" | ||
- uses: actions/checkout@v2 | ||
- uses: actions/[email protected] | ||
with: | ||
go-version: 1.15 | ||
- uses: technote-space/get-diff-action@v4 | ||
with: | ||
PATTERNS: | | ||
**/**.go | ||
go.mod | ||
go.sum | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: "${{ github.sha }}-${{ matrix.part }}" | ||
if: env.GIT_DIFF | ||
- name: test & coverage report creation | ||
run: | | ||
xargs --arg-file=pkgs.txt.part.${{ matrix.part }} go test -mod=readonly -json -timeout 30m -race -tags='cgo ledger test_ledger_mock goleveldb' | tee ${{ matrix.part }}-race-output.txt | ||
if: env.GIT_DIFF | ||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: "${{ github.sha }}-${{ matrix.part }}-race-output" | ||
path: ./${{ matrix.part }}-race-output.txt | ||
|
||
# race-detector-report: | ||
# runs-on: ubuntu-latest | ||
# needs: [test-race, install-tparse] | ||
# timeout-minutes: 5 | ||
# steps: | ||
# - uses: actions/checkout@v2 | ||
# - uses: technote-space/get-diff-action@v4 | ||
# id: git_diff | ||
# with: | ||
# PATTERNS: | | ||
# **/**.go | ||
# go.mod | ||
# go.sum | ||
# - uses: actions/download-artifact@v2 | ||
# with: | ||
# name: "${{ github.sha }}-00-race-output" | ||
# if: env.GIT_DIFF | ||
# - uses: actions/download-artifact@v2 | ||
# with: | ||
# name: "${{ github.sha }}-01-race-output" | ||
# if: env.GIT_DIFF | ||
# - uses: actions/download-artifact@v2 | ||
# with: | ||
# name: "${{ github.sha }}-02-race-output" | ||
# if: env.GIT_DIFF | ||
# - uses: actions/download-artifact@v2 | ||
# with: | ||
# name: "${{ github.sha }}-03-race-output" | ||
# if: env.GIT_DIFF | ||
# - uses: actions/[email protected] | ||
# with: | ||
# path: ~/go/bin | ||
# key: ${{ runner.os }}-go-tparse-binary | ||
# if: env.GIT_DIFF | ||
# - name: Generate test report (go test -race) | ||
# run: cat ./*-race-output.txt | ~/go/bin/tparse | ||
# if: env.GIT_DIFF | ||
race-detector-report: | ||
runs-on: ubuntu-latest | ||
needs: [test-race, install-tparse] | ||
timeout-minutes: 5 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: technote-space/get-diff-action@v4 | ||
id: git_diff | ||
with: | ||
PATTERNS: | | ||
**/**.go | ||
go.mod | ||
go.sum | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: "${{ github.sha }}-00-race-output" | ||
if: env.GIT_DIFF | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: "${{ github.sha }}-01-race-output" | ||
if: env.GIT_DIFF | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: "${{ github.sha }}-02-race-output" | ||
if: env.GIT_DIFF | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: "${{ github.sha }}-03-race-output" | ||
if: env.GIT_DIFF | ||
- uses: actions/[email protected] | ||
with: | ||
path: ~/go/bin | ||
key: ${{ runner.os }}-go-tparse-binary | ||
if: env.GIT_DIFF | ||
- name: Generate test report (go test -race) | ||
run: cat ./*-race-output.txt | ~/go/bin/tparse | ||
if: env.GIT_DIFF | ||
|
||
# TODO ebony: enable this test | ||
# liveness-test: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package keys | ||
|
||
import ( | ||
"bytes" | ||
"testing" | ||
|
||
"github.com/line/lbm-sdk/v2/client" | ||
"github.com/line/lbm-sdk/v2/crypto/hd" | ||
"github.com/line/lbm-sdk/v2/crypto/keyring" | ||
"github.com/line/lbm-sdk/v2/testutil" | ||
"github.com/line/lbm-sdk/v2/types" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func Test_printInfos(t *testing.T) { | ||
cmd := ListKeysCmd() | ||
cmd.Flags().AddFlagSet(Commands("home").PersistentFlags()) | ||
|
||
kbHome := t.TempDir() | ||
|
||
mockIn := testutil.ApplyMockIODiscardOutErr(cmd) | ||
kb, err := keyring.New(types.KeyringServiceName(), keyring.BackendTest, kbHome, mockIn) | ||
require.NoError(t, err) | ||
|
||
kb.NewAccount("something", testutil.TestMnemonic, "", "", hd.Secp256k1) | ||
|
||
clientCtx := client.Context{}.WithKeyring(kb) | ||
require.NoError(t, err) | ||
|
||
infos, err := clientCtx.Keyring.List() | ||
require.NoError(t, err) | ||
buf := bytes.NewBufferString("") | ||
printInfos(buf, infos, OutputFormatJSON) | ||
require.Equal(t, buf.String(), "[{\"name\":\"something\",\"type\":\"local\",\"address\":\"link1jyyxx9phqw6tarnxanhyx7ecr992d6yrztj4d0\",\"pubkey\":\"linkpub1cqmsrdepqg8qdahungt0uladr5g4v6kh56x4wx7auws5rfxunyrapnqn7kfkyrszyvh\"}]") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters