Skip to content

Commit

Permalink
[e2] Run e2e with debug mode logs (#317)
Browse files Browse the repository at this point in the history
* run e2e with debug mode logs

* fix config load during e2e

* update tokenvm

* increase sleep for stae sync
  • Loading branch information
patrick-ogrady authored Aug 1, 2023
1 parent 8e00cca commit 0f0793c
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 6 deletions.
3 changes: 3 additions & 0 deletions examples/morpheusvm/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ type Config struct {
// State Sync
StateSyncServerDelay time.Duration `json:"stateSyncServerDelay"` // for testing

loaded bool
nodeID ids.NodeID
parsedExemptPayers [][]byte
}
Expand All @@ -68,6 +69,7 @@ func New(nodeID ids.NodeID, b []byte) (*Config, error) {
if err := json.Unmarshal(b, c); err != nil {
return nil, fmt.Errorf("failed to unmarshal config %s: %w", string(b), err)
}
c.loaded = true
}

// Parse any exempt payers (usually used when a single account is
Expand Down Expand Up @@ -127,3 +129,4 @@ func (c *Config) GetContinuousProfilerConfig() *profiler.Config {
}
func (c *Config) GetVerifySignatures() bool { return c.VerifySignatures }
func (c *Config) GetStoreTransactions() bool { return c.StoreTransactions }
func (c *Config) Loaded() bool { return c.loaded }
2 changes: 1 addition & 1 deletion examples/morpheusvm/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (c *Controller) Initialize(
return nil, nil, nil, nil, nil, nil, nil, nil, nil, err
}
c.snowCtx.Log.SetLevel(c.config.GetLogLevel())
snowCtx.Log.Info("loaded config", zap.Any("contents", c.config))
snowCtx.Log.Info("initialized config", zap.Bool("loaded", c.config.Loaded()), zap.Any("contents", c.config))

c.genesis, err = genesis.New(genesisBytes, upgradeBytes)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions examples/morpheusvm/scripts/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ fi
VERSION=6e97e33e06422ef6e03a765729aaa90eb26d01a5
MODE=${MODE:-run}
LOGLEVEL=${LOGLEVEL:-info}
AVALANCHE_LOG_LEVEL=${AVALANCHE_LOG_LEVEL:-INFO}
STATESYNC_DELAY=${STATESYNC_DELAY:-0}
MIN_BLOCK_GAP=${MIN_BLOCK_GAP:-100}
if [[ ${MODE} != "run" ]]; then
STATESYNC_DELAY=50000000 # 50ms
LOGLEVEL=debug
STATESYNC_DELAY=100000000 # 100ms
MIN_BLOCK_GAP=250 #ms
fi

Expand Down
20 changes: 20 additions & 0 deletions examples/morpheusvm/tests/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"context"
"flag"
"fmt"
"os"
"testing"
"time"

Expand Down Expand Up @@ -52,6 +53,7 @@ var (

vmGenesisPath string
vmConfigPath string
vmConfig string
subnetConfigPath string
outputPath string

Expand Down Expand Up @@ -187,6 +189,15 @@ var _ = ginkgo.BeforeSuite(func() {
consts.ID,
)

// Load config data
if len(vmConfigPath) > 0 {
configData, err := os.ReadFile(vmConfigPath)
gomega.Expect(err).Should(gomega.BeNil())
vmConfig = string(configData)
} else {
vmConfig = "{}"
}

// Start cluster
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
resp, err := anrCli.Start(
Expand Down Expand Up @@ -472,6 +483,9 @@ var _ = ginkgo.Describe("[Test]", func() {
"bootstrap",
execPath,
trackSubnetsOpt,
runner_sdk.WithChainConfigs(map[string]string{
blockchainID: vmConfig,
}),
)
gomega.Expect(err).To(gomega.BeNil())
awaitHealthy(anrCli, []instance{instances[0]})
Expand Down Expand Up @@ -513,6 +527,9 @@ var _ = ginkgo.Describe("[Test]", func() {
"sync",
execPath,
trackSubnetsOpt,
runner_sdk.WithChainConfigs(map[string]string{
blockchainID: vmConfig,
}),
)
gomega.Expect(err).To(gomega.BeNil())

Expand Down Expand Up @@ -585,6 +602,9 @@ var _ = ginkgo.Describe("[Test]", func() {
"sync_concurrent",
execPath,
trackSubnetsOpt,
runner_sdk.WithChainConfigs(map[string]string{
blockchainID: vmConfig,
}),
)
gomega.Expect(err).To(gomega.BeNil())
awaitHealthy(anrCli, []instance{instances[0]})
Expand Down
3 changes: 3 additions & 0 deletions examples/tokenvm/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ type Config struct {
// State Sync
StateSyncServerDelay time.Duration `json:"stateSyncServerDelay"` // for testing

loaded bool
nodeID ids.NodeID
parsedExemptPayers [][]byte
}
Expand All @@ -84,6 +85,7 @@ func New(nodeID ids.NodeID, b []byte) (*Config, error) {
if err := json.Unmarshal(b, c); err != nil {
return nil, fmt.Errorf("failed to unmarshal config %s: %w", string(b), err)
}
c.loaded = true
}

// Parse any exempt payers (usually used when a single account is
Expand Down Expand Up @@ -150,3 +152,4 @@ func (c *Config) GetContinuousProfilerConfig() *profiler.Config {
}
func (c *Config) GetVerifySignatures() bool { return c.VerifySignatures }
func (c *Config) GetStoreTransactions() bool { return c.StoreTransactions }
func (c *Config) Loaded() bool { return c.loaded }
2 changes: 1 addition & 1 deletion examples/tokenvm/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func (c *Controller) Initialize(
return nil, nil, nil, nil, nil, nil, nil, nil, nil, err
}
c.snowCtx.Log.SetLevel(c.config.GetLogLevel())
snowCtx.Log.Info("loaded config", zap.Any("contents", c.config))
snowCtx.Log.Info("initialized config", zap.Bool("loaded", c.config.Loaded()), zap.Any("contents", c.config))

c.genesis, err = genesis.New(genesisBytes, upgradeBytes)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions examples/tokenvm/scripts/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ fi
VERSION=6e97e33e06422ef6e03a765729aaa90eb26d01a5
MODE=${MODE:-run}
LOGLEVEL=${LOGLEVEL:-info}
AVALANCHE_LOG_LEVEL=${AVALANCHE_LOG_LEVEL:-INFO}
STATESYNC_DELAY=${STATESYNC_DELAY:-0}
MIN_BLOCK_GAP=${MIN_BLOCK_GAP:-100}
if [[ ${MODE} != "run" && ${MODE} != "run-single" ]]; then
STATESYNC_DELAY=50000000 # 50ms
LOGLEVEL=debug
STATESYNC_DELAY=100000000 # 100ms
MIN_BLOCK_GAP=250 #ms
fi

Expand Down
20 changes: 20 additions & 0 deletions examples/tokenvm/tests/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"context"
"flag"
"fmt"
"os"
"testing"
"time"

Expand Down Expand Up @@ -53,6 +54,7 @@ var (

vmGenesisPath string
vmConfigPath string
vmConfig string
subnetConfigPath string
outputPath string

Expand Down Expand Up @@ -181,6 +183,15 @@ var _ = ginkgo.BeforeSuite(func() {
consts.ID,
)

// Load config data
if len(vmConfigPath) > 0 {
configData, err := os.ReadFile(vmConfigPath)
gomega.Expect(err).Should(gomega.BeNil())
vmConfig = string(configData)
} else {
vmConfig = "{}"
}

// Start cluster
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
resp, err := anrCli.Start(
Expand Down Expand Up @@ -1331,6 +1342,9 @@ var _ = ginkgo.Describe("[Test]", func() {
"bootstrap",
execPath,
trackSubnetsOpt,
runner_sdk.WithChainConfigs(map[string]string{
blockchainIDA: vmConfig,
}),
)
gomega.Expect(err).To(gomega.BeNil())
awaitHealthy(anrCli, []instance{instancesA[0]})
Expand Down Expand Up @@ -1372,6 +1386,9 @@ var _ = ginkgo.Describe("[Test]", func() {
"sync",
execPath,
trackSubnetsOpt,
runner_sdk.WithChainConfigs(map[string]string{
blockchainIDA: vmConfig,
}),
)
gomega.Expect(err).To(gomega.BeNil())

Expand Down Expand Up @@ -1444,6 +1461,9 @@ var _ = ginkgo.Describe("[Test]", func() {
"sync_concurrent",
execPath,
trackSubnetsOpt,
runner_sdk.WithChainConfigs(map[string]string{
blockchainIDA: vmConfig,
}),
)
gomega.Expect(err).To(gomega.BeNil())
awaitHealthy(anrCli, []instance{instancesA[0]})
Expand Down

0 comments on commit 0f0793c

Please sign in to comment.