Skip to content

Commit

Permalink
go/oasis-test-runner/scenario/e2e: Test bundles clean-up
Browse files Browse the repository at this point in the history
  • Loading branch information
martintomazic committed Jan 14, 2025
1 parent effb8ba commit 149f7af
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
4 changes: 4 additions & 0 deletions go/oasis-test-runner/oasis/oasis.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ type Node struct { // nolint: maligned
entity *Entity
}

func (n *Node) GetDir() *env.Dir {
return n.dir
}

// SetArchiveMode sets the archive mode.
func (n *Node) SetArchiveMode(archive bool) {
n.consensus.EnableArchiveMode = archive
Expand Down
22 changes: 22 additions & 0 deletions go/oasis-test-runner/scenario/e2e/runtime/runtime_upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,28 @@ func (sc *runtimeUpgradeImpl) Run(ctx context.Context, childEnv *env.Env) error
// Run client again.
sc.Logger.Info("starting a second client to check if runtime works")
sc.Scenario.TestClient = NewTestClient().WithSeed("seed2").WithScenario(InsertRemoveEncWithSecretsScenarioV2)

// Ensure that after upgrade, every compute worker had its old bundle file
// (cd0b61aa46a800c6845292b4cb6b38c1b1fb0153e4ef81c3b9331721bd615fa9.orc),
// together with exploded subdir removed from its datadir/runtimes/bundles.
for _, worker := range sc.Net.ComputeWorkers() {
dir := bundle.ExplodedPath(worker.GetDir().String())
sc.Logger.Info("Ensuring old bundle and its exploded subdir was removed",
"worker", worker.Name,
"bundles dir", dir)
entries, err := os.ReadDir(dir)
if err != nil {
sc.Logger.Error("Failed to read %s's bundle dir: %v", worker.Name, err)
return err
}
// There should be only two entries:
// 1. datadir/runtimes/bundles/b74de387b08b0c1d5bf9dc53d61be0d594b0d36f16a1491c8218d6a58d215f9e.orc
// 2. datadir/runtimes/bundles/b74de387b08b0c1d5bf9dc53d61be0d594b0d36f16a1491c8218d6a58d215f9e
if n := len(entries); n != 2 {
return fmt.Errorf("failed to remove old bundle and its exploded subdir: expected 2 entries, but %d got", n)
}
}

return sc.RunTestClientAndCheckLogs(ctx, childEnv)
}

Expand Down

0 comments on commit 149f7af

Please sign in to comment.