Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
2545ceb
Update routing
ygrebnov Oct 16, 2026
bd04683
Redact headers and metadata in reports
ygrebnov Oct 17, 2026
91dbc14
Redact request query parameters in reports
ygrebnov Oct 18, 2026
abbd747
Limit HTTP response body size read
ygrebnov Oct 18, 2026
7d31abf
Limit HTTP response body size recording
ygrebnov Oct 18, 2026
19a2e1b
Bound HTTP request body reads
ygrebnov Oct 18, 2026
bfc1191
Limit gRPC request and response messages size
ygrebnov Oct 19, 2026
5fd1c0d
Limit gRPC request and response messages size
ygrebnov Oct 19, 2026
dfbfc25
Limit calls number in store
ygrebnov Oct 19, 2026
5625463
Add call store byte-limit
ygrebnov Oct 19, 2026
a9a5c22
Add HTTP router timeouts
ygrebnov Oct 19, 2026
a9221c4
Add metadata limits
ygrebnov Oct 20, 2026
1e06284
Limit max response header size
ygrebnov Oct 20, 2026
dd946d1
Limit redirects
ygrebnov Oct 20, 2026
d81ecb7
Deep-copy calls in store operations
ygrebnov Oct 20, 2026
51661ad
Update logging
ygrebnov Oct 20, 2026
0ce2de0
Update error reporting in test launcher
ygrebnov Oct 21, 2026
c14d32f
Add cursor size limit
ygrebnov Oct 21, 2026
97aa244
Update internal resource errors
ygrebnov Oct 21, 2026
010c040
Add socket transport limits
ygrebnov Oct 21, 2026
870457b
Update address resolver
ygrebnov Oct 21, 2026
e42b1c9
Update matchers
ygrebnov Oct 21, 2026
f1de438
Bound test resolving requests
ygrebnov Oct 25, 2026
ef670f0
Update file loading
ygrebnov Oct 26, 2026
5edab45
Add vulncheck target
ygrebnov Oct 26, 2026
ea9a57d
Update CI
ygrebnov Oct 26, 2026
3af9c42
Use repository.ExecutionStatus type
ygrebnov Oct 26, 2026
d01a5db
Update validation errors
ygrebnov Oct 26, 2026
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
14 changes: 11 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ on:
- main
workflow_dispatch:

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v7
Expand All @@ -17,9 +21,13 @@ jobs:
uses: actions/setup-go@v7
with:
go-version: "1.27.x"
check-latest: true
cache-dependency-path: |
go.sum
tools/go.sum

- name: Verify
run: make verify
- name: Go version
run: go version

- name: Verify
run: make verify
run: make verify
28 changes: 28 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ linters:
- goconst
- lll

- path: ^(model/matcher/(grpc_message|string)\.go)$
linters:
- dupl

- path: ^api/
linters:
- dupl
Expand All @@ -98,6 +102,30 @@ linters:
linters:
- lll

- path: ^(execute/worker/reporter/config\.go)$
linters:
- lll

- path: ^(execute/worker/http/evaluate\.go)$
linters:
- lll

- path: ^(execute/runtime/service/(grpc|http)/config\.go)$
linters:
- lll

- path: ^execute/runtime/router/(grpc|http)/config\.go$
linters:
- lll

- path: ^execute/(call|worker)/config\.go$
linters:
- lll

- path: ^(transport/config\.go)$
linters:
- lll

- path: ^execute/runtime/router/(grpc|http)/router\.go$
linters:
- funlen
Expand Down
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ lint: install-golangci-lint
@echo "Running linter..."
$(GOLANGCI_LINT) run

.PHONY: vulncheck
vulncheck: install-govulncheck
@echo "Checking for known vulnerabilities..."
$(GOVULNCHECK) ./...

.PHONY: test
test:
@echo "Running tests..."
Expand All @@ -47,5 +52,5 @@ test-race:
@go test ./... -race -count=1 -timeout=600s

.PHONY: verify
verify: mockgen lint test-race
verify: mockgen lint vulncheck test-race
@echo "All verifications passed successfully."
121 changes: 112 additions & 9 deletions api/service_run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ func TestService_RunTestSuite(t *testing.T) {
)

testRepo.EXPECT().
GetByTag(gomock.Any(), "smoke").
GetByTag(gomock.Any(), "smoke", 11).
Return(nil, nil)

launcher := &fakeLauncher{}
Expand Down Expand Up @@ -368,7 +368,7 @@ func TestService_RunTestSuite(t *testing.T) {

// test-a is deliberately returned again by the tag lookup.
testRepo.EXPECT().
GetByTag(gomock.Any(), "smoke").
GetByTag(gomock.Any(), "smoke", 11).
Return([]repository.Test{
*runRepositoryTest("test-b", "test-b"),
*runRepositoryTest("test-a", "test-a"),
Expand Down Expand Up @@ -481,7 +481,7 @@ func TestService_RunTestSuite(t *testing.T) {
)

testRepo.EXPECT().
GetByTag(gomock.Any(), "smoke").
GetByTag(gomock.Any(), "smoke", 3).
Return([]repository.Test{
*runRepositoryTest("test-a", "test-a"),
*runRepositoryTest("test-b", "test-b"),
Expand Down Expand Up @@ -560,7 +560,7 @@ func TestService_RunTestSuite(t *testing.T) {
)

testRepo.EXPECT().
GetByTag(gomock.Any(), "smoke").
GetByTag(gomock.Any(), "smoke", 11).
Return([]repository.Test{
*runRepositoryTest("test-a", "test-a"),
}, nil)
Expand Down Expand Up @@ -604,6 +604,109 @@ func TestService_RunTestSuite(t *testing.T) {
)
}
})

t.Run("overlapping selectors at limit", func(t *testing.T) {
ctrl := gomock.NewController(t)

environmentRepo := mock.NewMockResourceRepository[repository.Environment](ctrl)
testSuiteRepo := mock.NewMockResourceRepository[repository.TestSuite](ctrl)
testRepo := mock.NewMockTestRepository(ctrl)

environmentRepo.EXPECT().
GetIDsByID(gomock.Any(), "env").
Return([]string{"environment-001"}, nil)

environmentRepo.EXPECT().
Get(gomock.Any(), "environment-001").
Return(runRepositoryEnvironment(), nil)

testSuiteRepo.EXPECT().
GetIDsByID(gomock.Any(), "suite").
Return([]string{"testsuite-001"}, nil)

testSuiteRepo.EXPECT().
Get(gomock.Any(), "testsuite-001").
Return(
runRepositoryTestSuite(
model.TestSelectorsSpec{
IDs: []string{"test-a"},
Tags: []string{"smoke"},
},
),
nil,
)

testRepo.EXPECT().
GetIDsByID(gomock.Any(), "test-a").
Return([]string{"test-a"}, nil)

testRepo.EXPECT().
Get(gomock.Any(), "test-a").
Return(runRepositoryTest("test-a", "test-a"), nil)

// Two matching tests, one already resolved by ID.
testRepo.EXPECT().
GetByTag(gomock.Any(), "smoke", 3).
Return([]repository.Test{
*runRepositoryTest("test-a", "test-a"),
*runRepositoryTest("test-b", "test-b"),
}, nil)

launcher := &fakeLauncher{
startTestSuiteResult: "suite-execution-001",
}

service := newRunService(
t,
Repositories{
Environment: environmentRepo,
Test: testRepo,
TestSuite: testSuiteRepo,
},
launcher,
2,
)

got, err := service.RunTestSuite(
t.Context(),
TestSuiteRunRequest{
EnvironmentRef: "env",
TestSuiteRef: "suite",
},
)
if err != nil {
t.Fatalf("RunTestSuite() error = %v", err)
}

if got != "suite-execution-001" {
t.Errorf(
"RunTestSuite() = %q, want suite-execution-001",
got,
)
}

if launcher.startTestSuiteCalls != 1 {
t.Fatalf(
"StartTestSuite calls = %d, want 1",
launcher.startTestSuiteCalls,
)
}

gotIDs := make([]string, len(launcher.testSuiteRequest.Tests))
for i, test := range launcher.testSuiteRequest.Tests {
gotIDs[i] = test.ID
}

wantIDs := []string{"test-a", "test-b"}

if !reflect.DeepEqual(gotIDs, wantIDs) {
t.Errorf(
"Resolved test IDs = %v, want %v",
gotIDs,
wantIDs,
)
}
})
}

type fakeLauncher struct {
Expand Down Expand Up @@ -682,11 +785,11 @@ func validEnvironmentSpec() model.EnvironmentSpec {
return model.EnvironmentSpec{
Services: []model.ServiceSpec{
{
ID: "api",
Kind: model.ServiceKindHTTP,
Mode: model.ServiceModeReal,
Address: "api:8080",
HTTPTarget: "http://localhost:8080",
ID: "api",
Kind: model.ServiceKindHTTP,
Mode: model.ServiceModeReal,
E2EnginePort: 8080,
Target: "http://localhost:8080",
},
},
}
Expand Down
35 changes: 26 additions & 9 deletions api/testsuite.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ func (s *Service) resolveTestSuiteTests(
selectors model.TestSelectorsSpec,
) ([]model.Test, error) {
tests := make(map[string]model.Test)
limit := s.runtimeCfg.MaxResolvedTests

for _, ref := range selectors.IDs {
test, err := s.GetTest(ctx, ref)
Expand All @@ -158,6 +159,9 @@ func (s *Service) resolveTestSuiteTests(
}

tests[test.ID] = *test
if errLimit := checkResolvedTestsLimit(len(tests), limit); errLimit != nil {
return nil, errLimit
}
}

for _, ref := range selectors.Names {
Expand All @@ -167,31 +171,33 @@ func (s *Service) resolveTestSuiteTests(
}

tests[test.ID] = *test
if errLimit := checkResolvedTestsLimit(len(tests), limit); errLimit != nil {
return nil, errLimit
}
}

for _, tag := range selectors.Tags {
matched, err := s.resources.GetTestsByTag(ctx, tag)
matched, err := s.resources.GetTestsByTag(ctx, tag, limit+1)
if err != nil {
return nil, err
}

if len(matched) > limit {
return nil, checkResolvedTestsLimit(len(matched), limit)
}

for i := range matched {
tests[matched[i].ID] = matched[i]
if errLimit := checkResolvedTestsLimit(len(tests), limit); errLimit != nil {
return nil, errLimit
}
}
}

if len(tests) == 0 {
return nil, errors.ErrNoTestsResolved
}

if len(tests) > s.runtimeCfg.MaxResolvedTests {
return nil, errorc.With(
errors.ErrExceededTestsLimit,
errorc.Int(keys.TestSuiteMaxTestsNumber, s.runtimeCfg.MaxResolvedTests),
errorc.Int(keys.TestSuiteResolvedTestsNumber, len(tests)),
)
}

ids := make([]string, 0, len(tests))
for id := range tests {
ids = append(ids, id)
Expand All @@ -206,3 +212,14 @@ func (s *Service) resolveTestSuiteTests(

return result, nil
}

func checkResolvedTestsLimit(actual, limit int) error {
if actual > limit {
return errorc.With(
errors.ErrExceededTestsLimit,
errorc.Int(keys.TestSuiteMaxTestsNumber, limit),
)
}

return nil
}
Loading
Loading