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
7 changes: 6 additions & 1 deletion cli/tests/crud_test_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,12 @@ func TestCRUDTest(t *testing.T) {
}

// start gateway service
gateway := h.StartService(ctx, "gateway-http-path")
serviceCtx, serviceCancel := context.WithCancel(
context.Background(),
)
t.Cleanup(serviceCancel)

gateway := h.StartService(serviceCtx, "gateway-http-path")
t.Cleanup(func() {
gateway.Stop(t)
})
Expand Down
7 changes: 6 additions & 1 deletion cli/tests/direct_crud_testsuite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,12 @@ func TestDirectCRUDTestSuite(t *testing.T) {
}

// start gateway service
gateway := h.StartService(ctx, "gateway-http-path")
serviceCtx, serviceCancel := context.WithCancel(
context.Background(),
)
t.Cleanup(serviceCancel)

gateway := h.StartService(serviceCtx, "gateway-http-path")
t.Cleanup(func() {
gateway.Stop(t)
})
Expand Down
7 changes: 6 additions & 1 deletion cli/tests/direct_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ func TestDirect(t *testing.T) {
)
defer cancel()

serviceCtx, serviceCancel := context.WithCancel(
context.Background(),
)
t.Cleanup(serviceCancel)

h := harness.New(
t,
"../bin/cli",
Expand All @@ -61,7 +66,7 @@ func TestDirect(t *testing.T) {
)

for _, service := range test.services {
s := h.StartService(ctx, service)
s := h.StartService(serviceCtx, service)
t.Cleanup(func() {
s.Stop(t)
})
Expand Down
4 changes: 3 additions & 1 deletion cli/tests/fixture_miss_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ func TestFixtureMiss(t *testing.T) {
defer cancel()

h := harness.New(t, "../bin/cli", "", path.Join(t.TempDir(), "data"))
serviceCtx, serviceCancel := context.WithCancel(context.Background())
t.Cleanup(serviceCancel)
for _, service := range test.services {
s := h.StartService(ctx, service)
s := h.StartService(serviceCtx, service)
t.Cleanup(func() {
s.Stop(t)
})
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/e2engine/tests/util"
)

const defaultTestTimeout = 5 * time.Second
const defaultTestTimeout = 30 * time.Second

type Service struct {
Name string
Expand Down
5 changes: 4 additions & 1 deletion cli/tests/real_not_calling_dependency_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ func TestRealNotCallingDependency(t *testing.T) {
)

// start ok service
okService := h.StartService(ctx, "ok-http")
serviceCtx, serviceCancel := context.WithCancel(context.Background())
t.Cleanup(serviceCancel)

okService := h.StartService(serviceCtx, "ok-http")
t.Cleanup(func() {
okService.Stop(t)
})
Expand Down
5 changes: 4 additions & 1 deletion cli/tests/socket_crud_testsuite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,10 @@ func TestSocketCRUDTestSuite(t *testing.T) {
}

// start gateway service
gateway := h.StartService(ctx, "gateway-http-path")
serviceCtx, serviceCancel := context.WithCancel(context.Background())
t.Cleanup(serviceCancel)

gateway := h.StartService(serviceCtx, "gateway-http-path")
t.Cleanup(func() {
gateway.Stop(t)
})
Expand Down
20 changes: 16 additions & 4 deletions cli/tests/transport_kind_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,11 @@ func TestTransportKind(t *testing.T) {

h := harness.New(t, "../bin/cli", test.configPath, path.Join(t.TempDir(), "data"))
if len(test.services) > 0 {
serviceCtx, serviceCancel := context.WithCancel(context.Background())
t.Cleanup(serviceCancel)

for _, service := range test.services {
s := h.StartService(ctx, service.Name, service.Args...)
s := h.StartService(serviceCtx, service.Name, service.Args...)
t.Cleanup(func() {
s.Stop(t)
})
Expand Down Expand Up @@ -308,6 +311,10 @@ func readRunnerPid(t *testing.T, logPath string) (int, bool) {

f, err := os.Open(logPath)
if err != nil {
if os.IsNotExist(err) {
return 0, false
}

t.Fatalf("Failed to open log file: %v", err)
}
defer f.Close()
Expand Down Expand Up @@ -343,7 +350,6 @@ func readRunnerPid(t *testing.T, logPath string) (int, bool) {
t.Fatalf("Failed to read log file: %v", err)
}

t.Fatalf("Runner PID not found in log file %s", logPath)
return 0, false
}

Expand All @@ -365,8 +371,11 @@ func TestDirectTransportWaitsForExecution(t *testing.T) {
path.Join(t.TempDir(), "data"),
)

serviceCtx, serviceCancel := context.WithCancel(context.Background())
t.Cleanup(serviceCancel)

service := h.StartService(
ctx,
serviceCtx,
"gateway-http-path",
"2",
)
Expand Down Expand Up @@ -440,7 +449,10 @@ func TestSocketTransportSequentialExecutions(t *testing.T) {
path.Join(t.TempDir(), "data"),
)

service := h.StartService(ctx, "gateway-http-path")
serviceCtx, serviceCancel := context.WithCancel(context.Background())
t.Cleanup(serviceCancel)

service := h.StartService(serviceCtx, "gateway-http-path")
t.Cleanup(func() {
service.Stop(t)
})
Expand Down
7 changes: 6 additions & 1 deletion docker/tests/direct_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,12 @@ func TestDirect(t *testing.T) {
)

for _, service := range test.services {
s := h.StartService(ctx, service)
serviceCtx, serviceCancel := context.WithCancel(
context.Background(),
)
t.Cleanup(serviceCancel)

s := h.StartService(serviceCtx, service)
t.Cleanup(func() {
s.Stop(t)
})
Expand Down
2 changes: 1 addition & 1 deletion docker/tests/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ import (
"time"
)

const defaultTestTimeout = 5 * time.Second
const defaultTestTimeout = 30 * time.Second
Loading