Skip to content

Commit

Permalink
oasis-test-runner: add scenario-specific Clone() methods
Browse files Browse the repository at this point in the history
  • Loading branch information
matevz committed Feb 25, 2020
1 parent 48cea0a commit 80d946a
Show file tree
Hide file tree
Showing 17 changed files with 105 additions and 2 deletions.
9 changes: 9 additions & 0 deletions go/oasis-test-runner/scenario/e2e/byzantine.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,15 @@ func newByzantineImpl(script string, logWatcherHandlerFactories []log.WatcherHan
}
}

func (sc *byzantineImpl) Clone() scenario.Scenario {
return &byzantineImpl{
basicImpl: *sc.basicImpl.Clone().(*basicImpl),
script: sc.script,
identitySeed: sc.identitySeed,
logWatcherHandlerFactories: sc.logWatcherHandlerFactories,
}
}

func (sc *byzantineImpl) Fixture() (*oasis.NetworkFixture, error) {
f, err := sc.basicImpl.Fixture()
if err != nil {
Expand Down
6 changes: 6 additions & 0 deletions go/oasis-test-runner/scenario/e2e/dump_restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ func newDumpRestoreImpl() scenario.Scenario {
return sc
}

func (sc *dumpRestoreImpl) Clone() scenario.Scenario {
return &dumpRestoreImpl{
basicImpl: *sc.basicImpl.Clone().(*basicImpl),
}
}

func (sc *dumpRestoreImpl) Run(childEnv *env.Env) error {
clientErrCh, cmd, err := sc.basicImpl.start(childEnv)
if err != nil {
Expand Down
6 changes: 6 additions & 0 deletions go/oasis-test-runner/scenario/e2e/gas_fees_runtimes.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ type gasFeesRuntimesImpl struct {
basicImpl
}

func (sc *gasFeesRuntimesImpl) Clone() scenario.Scenario {
return &gasFeesRuntimesImpl{
basicImpl: *sc.basicImpl.Clone().(*basicImpl),
}
}

func (sc *gasFeesRuntimesImpl) Fixture() (*oasis.NetworkFixture, error) {
f, err := sc.basicImpl.Fixture()
if err != nil {
Expand Down
6 changes: 6 additions & 0 deletions go/oasis-test-runner/scenario/e2e/halt_restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ func newHaltRestoreImpl() scenario.Scenario {
}
}

func (sc *haltRestoreImpl) Clone() scenario.Scenario {
return &haltRestoreImpl{
basicImpl: *sc.basicImpl.Clone().(*basicImpl),
}
}

func (sc *haltRestoreImpl) Fixture() (*oasis.NetworkFixture, error) {
f, err := sc.basicImpl.Fixture()
if err != nil {
Expand Down
4 changes: 3 additions & 1 deletion go/oasis-test-runner/scenario/e2e/identity_cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ type identityCLIImpl struct {

func (ident *identityCLIImpl) Clone() scenario.Scenario {
return &identityCLIImpl{
logger: logging.GetLogger("scenario/e2e/identity-cli"),
nodeBinary: ident.nodeBinary,
dataDir: ident.dataDir,
logger: logging.GetLogger("scenario/e2e/identity-cli"),
}
}

Expand Down
6 changes: 6 additions & 0 deletions go/oasis-test-runner/scenario/e2e/keymanager_restart.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ func newKmRestartImpl() scenario.Scenario {
}
}

func (sc *kmRestartImpl) Clone() scenario.Scenario {
return &kmRestartImpl{
basicImpl: *sc.basicImpl.Clone().(*basicImpl),
}
}

func (sc *kmRestartImpl) Run(childEnv *env.Env) error {
clientErrCh, cmd, err := sc.basicImpl.start(childEnv)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion go/oasis-test-runner/scenario/e2e/multiple_runtimes.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ type multipleRuntimesImpl struct {

func (mr *multipleRuntimesImpl) Clone() scenario.Scenario {
return &multipleRuntimesImpl{
basicImpl: *newBasicImpl("multiple-runtimes", "simple-keyvalue-client", nil),
basicImpl: *mr.basicImpl.Clone().(*basicImpl),
logger: logging.GetLogger("scenario/e2e/multiple_runtimes"),

numComputeRuntimes: mr.numComputeRuntimes,
Expand Down
6 changes: 6 additions & 0 deletions go/oasis-test-runner/scenario/e2e/node_shutdown.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ func newNodeShutdownImpl() scenario.Scenario {
return sc
}

func (sc *nodeShutdownImpl) Clone() scenario.Scenario {
return &nodeShutdownImpl{
basicImpl: *sc.basicImpl.Clone().(*basicImpl),
}
}

func (sc *nodeShutdownImpl) Name() string {
return "node-shutdown"
}
Expand Down
6 changes: 6 additions & 0 deletions go/oasis-test-runner/scenario/e2e/registry_cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ type registryCLIImpl struct {
basicImpl
}

func (r *registryCLIImpl) Clone() scenario.Scenario {
return &registryCLIImpl{
basicImpl: *r.basicImpl.Clone().(*basicImpl),
}
}

func (r *registryCLIImpl) Fixture() (*oasis.NetworkFixture, error) {
f, err := r.basicImpl.Fixture()
if err != nil {
Expand Down
7 changes: 7 additions & 0 deletions go/oasis-test-runner/scenario/e2e/runtime_dynamic.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ func newRuntimeDynamicImpl() scenario.Scenario {
}
}

func (sc *runtimeDynamicImpl) Clone() scenario.Scenario {
return &runtimeDynamicImpl{
basicImpl: *sc.basicImpl.Clone().(*basicImpl),
epoch: sc.epoch,
}
}

func (sc *runtimeDynamicImpl) Fixture() (*oasis.NetworkFixture, error) {
f, err := sc.basicImpl.Fixture()
if err != nil {
Expand Down
6 changes: 6 additions & 0 deletions go/oasis-test-runner/scenario/e2e/runtime_prune.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ func newRuntimePruneImpl() scenario.Scenario {
}
}

func (sc *runtimePruneImpl) Clone() scenario.Scenario {
return &runtimePruneImpl{
basicImpl: *sc.basicImpl.Clone().(*basicImpl),
}
}

func (sc *runtimePruneImpl) Fixture() (*oasis.NetworkFixture, error) {
f, err := sc.basicImpl.Fixture()
if err != nil {
Expand Down
6 changes: 6 additions & 0 deletions go/oasis-test-runner/scenario/e2e/sentry.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ func newSentryImpl(name, clientBinary string, clientArgs []string) scenario.Scen
}
}

func (s *sentryImpl) Clone() scenario.Scenario {
return &sentryImpl{
basicImpl: *s.basicImpl.Clone().(*basicImpl),
}
}

func (s *sentryImpl) Fixture() (*oasis.NetworkFixture, error) {
f, err := s.basicImpl.Fixture()
if err != nil {
Expand Down
6 changes: 6 additions & 0 deletions go/oasis-test-runner/scenario/e2e/stake_cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ type stakeCLIImpl struct {
basicImpl
}

func (s *stakeCLIImpl) Clone() scenario.Scenario {
return &stakeCLIImpl{
basicImpl: *s.basicImpl.Clone().(*basicImpl),
}
}

func (s *stakeCLIImpl) Fixture() (*oasis.NetworkFixture, error) {
f, err := s.basicImpl.Fixture()
if err != nil {
Expand Down
6 changes: 6 additions & 0 deletions go/oasis-test-runner/scenario/e2e/storage_sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ func newStorageSyncImpl() scenario.Scenario {
}
}

func (s *storageSyncImpl) Clone() scenario.Scenario {
return &storageSyncImpl{
basicImpl: *s.basicImpl.Clone().(*basicImpl),
}
}

func (sc *storageSyncImpl) Fixture() (*oasis.NetworkFixture, error) {
f, err := sc.basicImpl.Fixture()
if err != nil {
Expand Down
11 changes: 11 additions & 0 deletions go/oasis-test-runner/scenario/e2e/txsource.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,17 @@ func (sc *txSourceImpl) startWorkload(childEnv *env.Env, errCh chan error, name
return nil
}

func (s *txSourceImpl) Clone() scenario.Scenario {
return &txSourceImpl{
basicImpl: *s.basicImpl.Clone().(*basicImpl),
workloads: s.workloads,
timeLimit: s.timeLimit,
nodeRestartInterval: s.nodeRestartInterval,
livenessCheckInterval: s.livenessCheckInterval,
rng: s.rng,
}
}

func (sc *txSourceImpl) Run(childEnv *env.Env) error {
if err := sc.net.Start(); err != nil {
return fmt.Errorf("scenario net Start: %w", err)
Expand Down
7 changes: 7 additions & 0 deletions go/oasis-test-runner/scenario/e2e/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,13 @@ func (sc *nodeUpgradeImpl) Name() string {
return "node-upgrade"
}

func (s *nodeUpgradeImpl) Clone() scenario.Scenario {
return &nodeUpgradeImpl{
basicImpl: *s.basicImpl.Clone().(*basicImpl),
ctx: s.ctx,
}
}

func (sc *nodeUpgradeImpl) Fixture() (*oasis.NetworkFixture, error) {
var tee node.TEEHardware
err := tee.FromString(viper.GetString(cfgTEEHardware))
Expand Down
7 changes: 7 additions & 0 deletions go/oasis-test-runner/scenario/e2e/upgrade_cancel.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ func newNodeUpgradeCancelImpl() scenario.Scenario {
return sc
}

func (s *nodeUpgradeCancelImpl) Clone() scenario.Scenario {
return &nodeUpgradeCancelImpl{
basicImpl: *s.basicImpl.Clone().(*basicImpl),
ctx: s.ctx,
}
}

func (sc *nodeUpgradeCancelImpl) Name() string {
return "node-upgrade-cancel"
}
Expand Down

0 comments on commit 80d946a

Please sign in to comment.