Skip to content

Commit

Permalink
Merge pull request #1240 from threefoldtech/development_fix_alice_not…
Browse files Browse the repository at this point in the history
…_verified

use our mnemonic instead if alice
  • Loading branch information
rawdaGastan authored Oct 31, 2024
2 parents 9a8a160 + 4a63eb6 commit b8e2b4a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
12 changes: 10 additions & 2 deletions farmerbot/internal/farmerbot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ package internal

import (
"context"
"os"
"testing"

"github.com/centrifuge/go-substrate-rpc-client/v4/types"
"github.com/golang/mock/gomock"
"github.com/pkg/errors"
"github.com/rs/zerolog/log"
"github.com/stretchr/testify/assert"
substrate "github.com/threefoldtech/tfchain/clients/tfchain-client-go"
"github.com/threefoldtech/tfgrid-sdk-go/farmerbot/mocks"
Expand Down Expand Up @@ -41,7 +43,13 @@ func TestFarmerbot(t *testing.T) {
}},
}

farmerbot, err := NewFarmerBot(ctx, inputs, "dev", aliceSeed, peer.KeyTypeSr25519)
mnemonic := os.Getenv("MNEMONICS")
log.Debug().Str("MNEMONICS", mnemonic).Send()
if len(mnemonic) == 0 {
mnemonic = aliceSeed
}

farmerbot, err := NewFarmerBot(ctx, inputs, "dev", mnemonic, peer.KeyTypeSr25519)
assert.Error(t, err)
farmerbot.rmbNodeClient = rmb
farmerbot.gridProxyClient = proxy
Expand All @@ -63,7 +71,7 @@ func TestFarmerbot(t *testing.T) {
})

t.Run("test serve", func(t *testing.T) {
farmerbot.substrateManager = substrate.NewManager(SubstrateURLs[DevNetwork]...)
farmerbot.substrateManager = substrate.NewManager(SubstrateURLs[QaNetwork]...)
identity, err := substrate.NewIdentityFromSr25519Phrase(aliceSeed)
assert.NoError(t, err)
farmerbot.identity = identity
Expand Down
9 changes: 8 additions & 1 deletion grid-client/deployer/deployer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,21 @@ var (
)

func setup() (TFPluginClient, error) {
mnemonic := os.Getenv("MNEMONICS")
log.Debug().Str("MNEMONICS", mnemonic).Send()
if len(mnemonic) == 0 {
mnemonic = "//Alice"
}

network := os.Getenv("NETWORK")
if len(network) == 0 {
network = "dev"
}

log.Debug().Msgf("network: %s", network)

// Alice identity
aliceIdentity, err := substrate.NewIdentityFromSr25519Phrase("//Alice")
aliceIdentity, err := substrate.NewIdentityFromSr25519Phrase(mnemonic)
if err != nil {
return TFPluginClient{}, err
}
Expand Down
8 changes: 7 additions & 1 deletion tfrobot/internal/parser/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,17 @@ import (
)

func TestParseConfig(t *testing.T) {
mnemonic := os.Getenv("MNEMONICS")
log.Debug().Str("MNEMONICS", mnemonic).Send()
if len(mnemonic) == 0 {
mnemonic = "//Alice"
}

log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr})
validFlist := "https://hub.grid.tf/tf-official-apps/base:latest.flist"

// Alice identity
aliceIdentity, err := substrate.NewIdentityFromSr25519Phrase("//Alice")
aliceIdentity, err := substrate.NewIdentityFromSr25519Phrase(mnemonic)
assert.NoError(t, err)

keyPair, err := aliceIdentity.KeyPair()
Expand Down

0 comments on commit b8e2b4a

Please sign in to comment.