Skip to content

Commit

Permalink
Merge pull request #5192 from oasisprotocol/kostko/fix/ci-txsource
Browse files Browse the repository at this point in the history
  • Loading branch information
kostko authored Feb 21, 2023
2 parents fbe929f + cb9ded1 commit 07995cd
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 12 deletions.
Empty file added .changelog/5192.trivial.md
Empty file.
8 changes: 8 additions & 0 deletions go/oasis-node/cmd/debug/txsource/workload/queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,14 @@ func (q *queries) Run(
for {
loopCtx, cancel := context.WithTimeout(ctx, queriesIterationTimeout)

// Ensure the node appears synced before doing queries. Given that nodes can be killed and
// held stopped for a while, they need to sync once they come back.
if isSynced, _ := q.control.IsSynced(loopCtx); !isSynced {
_ = q.control.WaitSync(loopCtx)
time.Sleep(1 * time.Second)
continue
}

err := q.doQueries(loopCtx, rng)
cancel()
switch {
Expand Down
13 changes: 8 additions & 5 deletions go/oasis-node/cmd/debug/txsource/workload/registration.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ import (
"math/rand"
"net"
"os"
"path/filepath"
"time"

"github.com/spf13/viper"
"google.golang.org/grpc"

beacon "github.com/oasisprotocol/oasis-core/go/beacon/api"
Expand Down Expand Up @@ -181,11 +179,11 @@ func (r *registration) Run( // nolint: gocyclo
panic(err)
}

baseDir := viper.GetString(CfgDataDir)
nodeIdentitiesDir := filepath.Join(baseDir, "node-identities")
if err = common.Mkdir(nodeIdentitiesDir); err != nil {
nodeIdentitiesDir, err := os.MkdirTemp("", "oasis-e2e-registration")
if err != nil {
return fmt.Errorf("txsource/registration: failed to create node-identities dir: %w", err)
}
defer os.RemoveAll(nodeIdentitiesDir)

type runtimeInfo struct {
entityIdx int
Expand Down Expand Up @@ -256,6 +254,9 @@ func (r *registration) Run( // nolint: gocyclo

entityAccs[i].nodeIdentities = append(entityAccs[i].nodeIdentities, &nodeAcc{ident, nodeDesc, nodeAccNonce})
ent.Nodes = append(ent.Nodes, ident.NodeSigner.Public())

// Cleanup temporary node identity directory after generation.
_ = os.RemoveAll(dataDir)
}

// Register entity.
Expand Down Expand Up @@ -302,6 +303,8 @@ func (r *registration) Run( // nolint: gocyclo
}
}
}
// Cleanup temporary identities directory after generation.
_ = os.RemoveAll(nodeIdentitiesDir)

iteration := 0
var loopCtx context.Context
Expand Down
6 changes: 0 additions & 6 deletions go/oasis-node/cmd/debug/txsource/workload/workload.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"time"

flag "github.com/spf13/pflag"
"github.com/spf13/viper"
"google.golang.org/grpc"

"github.com/oasisprotocol/oasis-core/go/common/crypto/signature"
Expand All @@ -20,8 +19,6 @@ import (
)

const (
CfgDataDir = "datadir"

maxSubmissionRetryElapsedTime = 120 * time.Second

fundAccountAmount = 10000000000
Expand Down Expand Up @@ -197,9 +194,6 @@ func FundAccountFromTestEntity(
}

func init() {
Flags.String(CfgDataDir, "", "data directory")
_ = viper.BindPFlags(Flags)

Flags.AddFlagSet(QueriesFlags)
Flags.AddFlagSet(RuntimeFlags)
}
1 change: 0 additions & 1 deletion go/oasis-test-runner/scenario/e2e/runtime/txsource.go
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,6 @@ func (sc *txSourceImpl) startWorkload(childEnv *env.Env, errCh chan error, name
"debug", "txsource",
"--address", "unix:" + node.SocketPath(),
"--" + common.CfgDebugAllowTestKeys,
"--" + workload.CfgDataDir, d.String(),
"--" + flags.CfgDebugDontBlameOasis,
"--" + flags.CfgDebugTestEntity,
"--" + commonGrpc.CfgLogDebug,
Expand Down

0 comments on commit 07995cd

Please sign in to comment.