Skip to content

Commit 7b71c82

Browse files
authored
refactor: move e2e_test.go and its testdata to internal (#2934)
Move `e2e_test.go` and related test data to internal/integration. - Change package to `integration_test` following Go's convention for external test packages. This ensures e2e test only interact with the exported APIs (which it is already doing). - The `e2e` specific test data has been moved from `internal/testdata/e2e` to `internal/integration/testdata/e2e`. This adheres to the principle of co-location, keeping test data alongside the tests that use it. - Update testing doc and workflow to reflect changes. The rest of testdata should also be moved to out of root into `internal` and co-locate in the package of the test, will do that in a separate PR. For #2842
1 parent c12ef6e commit 7b71c82

File tree

34 files changed

+5
-5
lines changed

34 files changed

+5
-5
lines changed

.github/workflows/librarian.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
- name: Build the test image
6363
run: |
6464
DOCKER_BUILDKIT=1 docker build \
65-
-f ./testdata/e2e-test.Dockerfile \
65+
-f ./internal/integration/testdata/e2e-test.Dockerfile \
6666
-t test-image:latest \
6767
.
6868
- name: Run end-to-end test

doc/testing.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ Setup:
2020

2121
```bash
2222
DOCKER_BUILDKIT=1 docker build \
23-
-f ./testdata/e2e-test.Dockerfile \
23+
-f ./internal/integration/testdata/e2e-test.Dockerfile \
2424
-t test-image:latest \
2525
.
2626
```
2727

2828
Usage:
2929

3030
```bash
31-
go test -tags e2e
31+
go test -tags e2e ./internal/integration/...
3232
```
3333

3434
## Integration Tests

e2e_test.go renamed to internal/integration/e2e_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
//go:build e2e
1616

17-
package librarian
17+
package integration_test
1818

1919
import (
2020
"bytes"

testdata/e2e-test.Dockerfile renamed to internal/integration/testdata/e2e-test.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ COPY go.sum .
2222

2323
RUN go mod download
2424

25-
COPY ./testdata/e2e_func.go .
25+
COPY ./internal/integration/testdata/e2e_func.go .
2626

2727
RUN go build -o e2e_func .
2828

0 commit comments

Comments
 (0)