Skip to content

Commit 5ab2b03

Browse files
committed
cleanup
Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
1 parent bdeef79 commit 5ab2b03

10 files changed

Lines changed: 172 additions & 101 deletions

File tree

.github/workflows/commit.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
branches: [ main ]
88

99
jobs:
10-
build_and_unit_test:
10+
build_and_test:
1111
name: Build and Unit Test (${{ matrix.platform.arch }}, ${{ matrix.platform.os }})
1212
runs-on: ${{ matrix.platform.os }}
1313
strategy:
@@ -64,6 +64,7 @@ jobs:
6464
- run: make check
6565
- run: make test
6666
- run: make build
67+
- run: make integration-test
6768

6869
docker_build_and_integration_test:
6970
name: Build and Run Integration Tests

Makefile

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ precommit: precommit-go precommit-rust
2828

2929
.PHONY: precommit-go
3030
precommit-go: ## This runs the linter, formatter, and tidy on the Go codebase.
31+
@$(call print_task,Tidying Go modules)
32+
@find . -name "go.mod" \
33+
| grep go.mod \
34+
| xargs -I {} bash -c 'dirname {}' \
35+
| xargs -I {} bash -c 'cd {} && $(call print_subtask,Tidying {}) && go mod tidy -v;'
36+
@$(call print_success,Tidying completed)
3137
@$(call print_task,Running linter)
3238
@$(call print_subtask,Checking ./...)
3339
@cd go && go tool golangci-lint run --build-tags==cgo ./...
@@ -40,12 +46,6 @@ precommit-go: ## This runs the linter, formatter, and tidy on the Go codebase.
4046
@$(call print_subtask,Running gci)
4147
@cd go && go tool gci write -s standard -s default -s "prefix(github.com/envoyproxy/dynamic-modules-examples)" `find . -name '*.go'`
4248
@$(call print_success,Formatting completed)
43-
@$(call print_task,Tidying Go modules)
44-
@find . -name "go.mod" \
45-
| grep go.mod \
46-
| xargs -I {} bash -c 'dirname {}' \
47-
| xargs -I {} bash -c 'cd {} && $(call print_subtask,Tidying {}) && go mod tidy -v;'
48-
@$(call print_success,Tidying completed)
4949

5050
.PHONY: precommt-rust
5151
precommit-rust: ## This runs the linter, formatter, and tidy on the Rust codebase.
@@ -89,9 +89,19 @@ build-go: ## Build the Go dynamic module.
8989
@$(call print_task,Building Go dynamic module)
9090
@cd go && go build -buildmode=c-shared -o libgo_module.so .
9191
@$(call print_success,Go dynamic module built at go/libgo_module.so)
92+
@$(call print_task,Copying Go dynamic module for easier use with Envoy)
93+
@cp go/libgo_module.so integration/libgo_module.so
9294

9395
.PHONY: build-rust
9496
build-rust: ## Build the Rust dynamic module.
9597
@$(call print_task,Building Rust dynamic module)
9698
@cd rust && cargo build
9799
@$(call print_success,Rust dynamic module built at rust/target/debug/librust_module.so)
100+
@$(call print_task,Copying Rust dynamic module for easier use with Envoy)
101+
@cp rust/target/debug/librust_module.dylib integration/librust_module.so
102+
103+
.PHONY: integration-test
104+
integration-test: build-go build-rust ## Run the integration tests.
105+
@$(call print_task,Running integration tests)
106+
@cd integration && go test -v ./...
107+
@$(call print_success,Integration tests completed)

README.md

Lines changed: 3 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -29,65 +29,10 @@ The tracking issue for dynamic modules in general is [here](https://github.com/e
2929

3030
## Development
3131

32-
### Rust Dynamic Module
33-
34-
To build and test the modules locally without Envoy, you can use `cargo` to build them just like any other Rust project:
35-
36-
```
37-
cd rust
38-
cargo build
39-
cargo test
40-
cargo clippy -- -D warnings
41-
cargo fmt --all -- --check
42-
```
43-
44-
### Go Dynamic Module
45-
To build and test the modules locally without Envoy, you can use `go` to build them just like any other Go project:
46-
47-
```
48-
cd go
49-
go test ./... -v
50-
go build -buildmode=c-shared -o libgo_module.so .
51-
go tool golangci-lint run
52-
find . -type f -name '*.go' | xargs go tool gofumpt -l -w
53-
```
54-
55-
### Build Envoy + Example Dynamic Module Docker Image
56-
57-
To build the example modules and bundle them with Envoy, simply run
58-
59-
```
60-
docker buildx build . -t envoy-with-dynamic-modules:latest [--platform linux/amd64,linux/arm64]
61-
```
62-
63-
where `--platform` is optional and can be used to build for multiple platforms.
64-
65-
### Run Envoy + Example Dynamic Module Docker Image
66-
67-
The example Envoy configuration yaml is in [`integration/envoy.yaml`](integration/envoy.yaml) which is also used
68-
to run the integration tests. Assuming you built the Docker image with the tag `envoy-with-dynamic-modules:latest`, you can run Envoy with the following command:
69-
70-
```
71-
docker run --network host -v $(pwd):/examples -w /examples/integration envoy-with-dynamic-modules:latest --config-path ./envoy.yaml
72-
```
73-
74-
Then execute, for example, the following command to test the passthrough and access log filters:
75-
76-
```
77-
curl localhost:1062/uuid
78-
```
79-
80-
### Run integration tests with the built example Envoy + Dynamic Module Docker Image.
81-
82-
The integration tests are in the `integration` directory. Assuming you built the Docker image with the tag `envoy-with-dynamic-modules:latest`, you can run the integration tests with the following command:
83-
```
84-
cd integration
85-
go test . -v -count=1
86-
```
87-
88-
If you want to explicitly specify the docker image, use `ENVOY_IMAGE` environment variable:
8932
```
90-
ENVOY_IMAGE=foo-bar-image:latest go test . -v -count=1
33+
make test # Run all unit tests
34+
make build # Build all dynamic modules
35+
make integration-test # Run integration tests with Envoy
9136
```
9237

9338
[6d9bb7d9a85d616b220d1f8fe67b61f82bbdb8d3]: https://github.com/envoyproxy/envoy/tree/6d9bb7d9a85d616b220d1f8fe67b61f82bbdb8d3

go/go.mod

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
module github.com/envoyproxy/dynamic-modules-examples/go
22

3-
go 1.24.2
3+
go 1.25.6
44

55
tool (
66
github.com/daixiang0/gci
77
github.com/golangci/golangci-lint/cmd/golangci-lint
8+
github.com/tetratelabs/func-e/cmd/func-e
89
mvdan.cc/gofumpt
910
)
1011

1112
require (
1213
github.com/dop251/goja v0.0.0-20250630131328-58d95d85e994
13-
github.com/stretchr/testify v1.10.0
14+
github.com/stretchr/testify v1.11.1
1415
)
1516

1617
require (
@@ -21,7 +22,7 @@ require (
2122
github.com/Antonboom/errname v1.0.0 // indirect
2223
github.com/Antonboom/nilnil v1.0.1 // indirect
2324
github.com/Antonboom/testifylint v1.5.2 // indirect
24-
github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c // indirect
25+
github.com/BurntSushi/toml v1.5.0 // indirect
2526
github.com/Crocmagnon/fatcontext v0.7.1 // indirect
2627
github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 // indirect
2728
github.com/GaijinEntertainment/go-exhaustruct/v3 v3.3.1 // indirect
@@ -48,11 +49,13 @@ require (
4849
github.com/charithe/durationcheck v0.0.10 // indirect
4950
github.com/chavacava/garif v0.1.0 // indirect
5051
github.com/ckaznocha/intrange v0.3.0 // indirect
52+
github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect
5153
github.com/curioswitch/go-reassign v0.3.0 // indirect
5254
github.com/daixiang0/gci v0.13.7 // indirect
5355
github.com/davecgh/go-spew v1.1.1 // indirect
5456
github.com/denis-tingaikin/go-header v0.5.0 // indirect
5557
github.com/dlclark/regexp2 v1.11.4 // indirect
58+
github.com/ebitengine/purego v0.9.0 // indirect
5659
github.com/ettle/strcase v0.2.0 // indirect
5760
github.com/fatih/color v1.18.0 // indirect
5861
github.com/fatih/structtag v1.2.0 // indirect
@@ -61,6 +64,7 @@ require (
6164
github.com/fzipp/gocyclo v0.6.0 // indirect
6265
github.com/ghostiam/protogetter v0.3.9 // indirect
6366
github.com/go-critic/go-critic v0.12.0 // indirect
67+
github.com/go-ole/go-ole v1.2.6 // indirect
6468
github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect
6569
github.com/go-toolsmith/astcast v1.1.0 // indirect
6670
github.com/go-toolsmith/astcopy v1.1.0 // indirect
@@ -111,6 +115,7 @@ require (
111115
github.com/ldez/tagliatelle v0.7.1 // indirect
112116
github.com/ldez/usetesting v0.4.2 // indirect
113117
github.com/leonklingele/grouper v1.1.2 // indirect
118+
github.com/lufia/plan9stats v0.0.0-20220913051719-115f729f3c8c // indirect
114119
github.com/macabu/inamedparam v0.1.3 // indirect
115120
github.com/magiconair/properties v1.8.6 // indirect
116121
github.com/maratori/testableexamples v1.0.0 // indirect
@@ -133,6 +138,7 @@ require (
133138
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
134139
github.com/pmezard/go-difflib v1.0.0 // indirect
135140
github.com/polyfloyd/go-errorlint v1.7.1 // indirect
141+
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
136142
github.com/prometheus/client_golang v1.12.1 // indirect
137143
github.com/prometheus/client_model v0.2.0 // indirect
138144
github.com/prometheus/common v0.32.1 // indirect
@@ -145,13 +151,15 @@ require (
145151
github.com/raeperd/recvcheck v0.2.0 // indirect
146152
github.com/rivo/uniseg v0.4.7 // indirect
147153
github.com/rogpeppe/go-internal v1.14.1 // indirect
154+
github.com/russross/blackfriday/v2 v2.1.0 // indirect
148155
github.com/ryancurrah/gomodguard v1.3.5 // indirect
149156
github.com/ryanrolds/sqlclosecheck v0.5.1 // indirect
150157
github.com/sanposhiho/wastedassign/v2 v2.1.0 // indirect
151158
github.com/santhosh-tekuri/jsonschema/v6 v6.0.1 // indirect
152159
github.com/sashamelentyev/interfacebloat v1.1.0 // indirect
153160
github.com/sashamelentyev/usestdlibvars v1.28.0 // indirect
154161
github.com/securego/gosec/v2 v2.22.2 // indirect
162+
github.com/shirou/gopsutil/v4 v4.25.9 // indirect
155163
github.com/sirupsen/logrus v1.9.3 // indirect
156164
github.com/sivchari/containedctx v1.0.3 // indirect
157165
github.com/sivchari/tenv v1.12.1 // indirect
@@ -169,18 +177,25 @@ require (
169177
github.com/subosito/gotenv v1.4.1 // indirect
170178
github.com/tdakkota/asciicheck v0.4.1 // indirect
171179
github.com/tetafro/godot v1.5.0 // indirect
180+
github.com/tetratelabs/func-e v1.3.0 // indirect
172181
github.com/timakin/bodyclose v0.0.0-20241017074812-ed6a65f985e3 // indirect
173182
github.com/timonwong/loggercheck v0.10.1 // indirect
183+
github.com/tklauser/go-sysconf v0.3.15 // indirect
184+
github.com/tklauser/numcpus v0.10.0 // indirect
174185
github.com/tomarrell/wrapcheck/v2 v2.10.0 // indirect
175186
github.com/tommy-muehle/go-mnd/v2 v2.5.1 // indirect
187+
github.com/ulikunitz/xz v0.5.15 // indirect
176188
github.com/ultraware/funlen v0.2.0 // indirect
177189
github.com/ultraware/whitespace v0.2.0 // indirect
190+
github.com/urfave/cli/v2 v2.27.7 // indirect
178191
github.com/uudashr/gocognit v1.2.0 // indirect
179192
github.com/uudashr/iface v1.3.1 // indirect
180193
github.com/xen0n/gosmopolitan v1.2.2 // indirect
194+
github.com/xrash/smetrics v0.0.0-20250705151800-55b8f293f342 // indirect
181195
github.com/yagipy/maintidx v1.0.0 // indirect
182196
github.com/yeya24/promlinter v0.3.0 // indirect
183197
github.com/ykadowak/zerologlint v0.1.5 // indirect
198+
github.com/yusufpapurcu/wmi v1.2.4 // indirect
184199
gitlab.com/bosi/decorder v0.4.2 // indirect
185200
go-simpler.org/musttag v0.13.0 // indirect
186201
go-simpler.org/sloglint v0.9.0 // indirect
@@ -191,7 +206,7 @@ require (
191206
golang.org/x/exp/typeparams v0.0.0-20250210185358-939b2ce775ac // indirect
192207
golang.org/x/mod v0.24.0 // indirect
193208
golang.org/x/sync v0.13.0 // indirect
194-
golang.org/x/sys v0.32.0 // indirect
209+
golang.org/x/sys v0.35.0 // indirect
195210
golang.org/x/text v0.22.0 // indirect
196211
golang.org/x/tools v0.32.0 // indirect
197212
google.golang.org/protobuf v1.36.5 // indirect

0 commit comments

Comments
 (0)