Skip to content
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
2 changes: 2 additions & 0 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ jobs:
- title: core
label_filter: core
artifact: e2e-test-results-core
procs: 4
- title: mcp-run
label_filter: mcp-run
artifact: e2e-test-results-mcp-run
Expand Down Expand Up @@ -178,6 +179,7 @@ jobs:
TOOLHIVE_EGRESS_IMAGE: ghcr.io/stacklok/toolhive/egress-proxy:latest
TEST_TIMEOUT: ${{ matrix.test_timeout || '15m' }}
LABEL_FILTER: ${{ matrix.label_filter }}
PROCS: ${{ matrix.procs || 1 }}
run: ./test/e2e/run_tests.sh

- name: Upload test results (${{ matrix.title }})
Expand Down
3 changes: 1 addition & 2 deletions test/e2e/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package e2e_test

import (
"encoding/json"
"fmt"
"os"
"path/filepath"
"time"
Expand Down Expand Up @@ -212,5 +211,5 @@ var _ = Describe("Export Command", Label("core", "export", "e2e"), func() {

// generateExportTestServerName creates a unique server name for export tests
func generateExportTestServerName(prefix string) string {
return fmt.Sprintf("%s-%d", prefix, GinkgoRandomSeed())
return e2e.GenerateUniqueServerName(prefix)
}
22 changes: 15 additions & 7 deletions test/e2e/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"os/exec"
"path/filepath"
"strings"
"sync"
"syscall"
"time"

Expand Down Expand Up @@ -216,14 +217,21 @@ func WaitForMCPServer(config *TestConfig, serverName string, timeout time.Durati
// ExpectMCPServersRunning waits for each named workload to reach the running
// state within ServerReadyTimeout, and fails naming the workload that did not.
//
// Specs that start several workloads used to wait in a loop over a bare
// Expect(err).ToNot(HaveOccurred()), so a timeout said only that some workload
// in the set was not ready. The failure is reported at the caller's line so a
// CI annotation still points at the spec rather than at this helper.
// All workloads are polled concurrently so that the total wait is bounded by
// the slowest workload rather than the sum of all waits.
func ExpectMCPServersRunning(config *TestConfig, serverNames ...string) {
for _, serverName := range serverNames {
err := WaitForMCPServer(config, serverName, ServerReadyTimeout())
ExpectWithOffset(1, err).ToNot(HaveOccurred(),
errs := make([]error, len(serverNames))
var wg sync.WaitGroup
for i, name := range serverNames {
wg.Add(1)
go func(i int, name string) {
defer wg.Done()
errs[i] = WaitForMCPServer(config, name, ServerReadyTimeout())
}(i, name)
}
wg.Wait()
for i, serverName := range serverNames {
ExpectWithOffset(1, errs[i]).ToNot(HaveOccurred(),
"workload %s (of %v) should reach the running state", serverName, serverNames)
}
}
Expand Down
3 changes: 1 addition & 2 deletions test/e2e/restart_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
package e2e_test

import (
"fmt"
"strings"
"time"

Expand Down Expand Up @@ -203,5 +202,5 @@ var _ = Describe("Server Restart", Label("core", "restart", "e2e"), func() {

// generateTestServerName creates a unique server name for restart tests
func generateTestServerName(prefix string) string {
return fmt.Sprintf("%s-%d", prefix, GinkgoRandomSeed())
return e2e.GenerateUniqueServerName(prefix)
}
6 changes: 5 additions & 1 deletion test/e2e/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ fi
TEST_TIMEOUT="${TEST_TIMEOUT:-20m}"
echo -e "${GREEN}✓${NC} Test timeout: $TEST_TIMEOUT"

# Set number of parallel Ginkgo processes (default 1 = sequential)
PROCS="${PROCS:-1}"
echo -e "${GREEN}✓${NC} Ginkgo procs: $PROCS"

# Export environment variables for tests
export THV_BINARY
export TEST_TIMEOUT
Expand All @@ -57,7 +61,7 @@ echo ""
cd "$(dirname "$0")"

# Build ginkgo command with conditional GitHub output flag
GINKGO_CMD="ginkgo run --timeout=\"$TEST_TIMEOUT\""
GINKGO_CMD="ginkgo run --timeout=\"$TEST_TIMEOUT\" --procs=$PROCS"
GINKGO_CMD="$GINKGO_CMD --junit-report=junit-report.xml --output-dir=."
GINKGO_CMD="$GINKGO_CMD --silence-skips"
if [ -n "$GITHUB_ACTIONS" ]; then
Expand Down
3 changes: 1 addition & 2 deletions test/e2e/status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package e2e_test

import (
"encoding/json"
"fmt"
"strings"
"time"

Expand All @@ -24,7 +23,7 @@ var _ = Describe("Status Command", Label("core", "status", "e2e"), func() {

BeforeEach(func() {
config = e2e.NewTestConfig()
serverName = fmt.Sprintf("status-test-%d", GinkgoRandomSeed())
serverName = e2e.GenerateUniqueServerName("status-test")

// Check if thv binary is available
err := e2e.CheckTHVBinaryAvailable(config)
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/thvignore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var _ = Describe("THVIgnore E2E Tests", Label("core", "thvignore", "e2e"), func(

BeforeEach(func() {
config = e2e.NewTestConfig()
serverName = fmt.Sprintf("thvignore-test-%d", GinkgoRandomSeed())
serverName = e2e.GenerateUniqueServerName("thvignore-test")

// Check if thv binary is available
err := e2e.CheckTHVBinaryAvailable(config)
Expand Down
Loading