Skip to content

Commit

Permalink
fix: keyring unit test when using OS keyring
Browse files Browse the repository at this point in the history
  • Loading branch information
maxim-inj committed Sep 11, 2024
1 parent 20919a1 commit 973cf13
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ jobs:
with:
go-version-file: "go.mod"
check-latest: true
- name: Install pass helper
run: sudo apt-get update && sudo apt-get install -y pass
- name: Generate GPG key
run: "
echo \"%no-protection\nKey-Type: 1\nKey-Length: 4096\nSubkey-Type: 1\nSubkey-Length: 4096\nName-Comment: keyring_test\nExpire-Date: 0\" > genkey && gpg --gen-key --batch genkey"
- name: Setup OS keystore
run: pass init keyring_test
- name: Run test and calculate coverage
run: make coverage
- name: Upload coverage to Codecov
Expand Down
4 changes: 2 additions & 2 deletions client/keyring/keyring_errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func (s *KeyringTestSuite) TestErrKeyIncompatible() {
})

testKeyring, err := cosmkeyring.New(
"keyring_test",
KeyringAppName,
cosmkeyring.BackendTest,
kbDir,
nil,
Expand All @@ -128,7 +128,7 @@ func (s *KeyringTestSuite) TestErrKeyIncompatible() {
s.cdc,
WithKeyringBackend(BackendTest),
WithKeyringDir(kbDir),
WithKeyringAppName("keyring_test"),
WithKeyringAppName(KeyringAppName),
WithKey(
WithKeyFrom("test_pubkey"),
),
Expand Down
6 changes: 4 additions & 2 deletions client/keyring/keyring_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import (
"github.com/InjectiveLabs/sdk-go/client/chain"
)

const KeyringAppName = "keyring_test"

type KeyringTestSuite struct {
suite.Suite

Expand Down Expand Up @@ -151,7 +153,7 @@ func (s *KeyringTestSuite) TestKeyringOsWithAppName() {
requireT := require.New(s.T())

osKeyring, err := cosmkeyring.New(
"keyring_test",
KeyringAppName,
cosmkeyring.BackendOS,
"",
nil,
Expand Down Expand Up @@ -188,7 +190,7 @@ func (s *KeyringTestSuite) TestKeyringOsWithAppName() {
accAddr, kb, err := NewCosmosKeyring(
s.cdc,
WithKeyringBackend(BackendOS),
WithKeyringAppName("keyring_test"),
WithKeyringAppName(KeyringAppName),
WithKey(
WithKeyFrom("test"),
),
Expand Down

0 comments on commit 973cf13

Please sign in to comment.