Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: parallelize test by starting subshell #193

Merged
merged 8 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ fmt: kurtosis_fmt cli_fmt ## 🧹 Format all code

lint: kurtosis_lint cli_lint ## 🧹 Lint all code

test: ## 🧪 Run tests
test: examples/hello-world-avs ## 🧪 Run tests
# NOTE: we do this to avoid race conditions in the engine initialization
kurtosis engine start

go test -v -timeout 30m ./...


Expand Down
28 changes: 3 additions & 25 deletions src/cmds/start_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package cmds_test
import (
"context"
"os"
"os/exec"
"path/filepath"
"testing"

Expand Down Expand Up @@ -46,23 +45,6 @@ func startDevnet(t *testing.T, devnetConfig config.DevnetConfig, workingDir stri
require.NoError(t, err, "Failed to start new devnet")
}

func goToDir(t *testing.T, destination string) {
dir, err := os.Getwd()
require.NoError(t, err, "Failed to get cwd")

err = os.Chdir(destination)
require.NoError(t, err, "Failed to go to repo root")

t.Cleanup(func() {
// Return to the original directory
err = os.Chdir(dir)
// Panic if failed, to avoid running other tests in the wrong directory
if err != nil {
panic(err)
}
})
}

func TestStartDefaultDevnet(t *testing.T) {
t.Parallel()
startDevnet(t, config.DefaultConfig(), examplesDir)
Expand All @@ -77,13 +59,9 @@ func TestStartIncredibleSquaring(t *testing.T) {
}

func TestStartLocalHelloWorld(t *testing.T) {
// NOTE: we don't run t.Parallel() here because we need to change the working directory
goToDir(t, "../../")

// Clone the hello-world-avs repo
err := exec.Command("make", "examples/hello-world-avs").Run()
require.NoError(t, err, "Failed to make hello-world-avs repo")

// Check that the Hello World AVS repo was downloaded
require.DirExists(t, filepath.Join(examplesDir, "hello-world-avs"), "Hello World AVS repo not found")
t.Parallel()
configFile := filepath.Join(examplesDir, "hello_world_local.yaml")
devnetConfig, err := config.LoadFromPath(configFile)
require.NoError(t, err, "Failed to parse example config")
Expand Down
Loading