Skip to content

Commit d3b5bcc

Browse files
authored
Merge pull request #42 from grishy/sg-integration-tests
Add integration tests
2 parents 9b3ae42 + fc4026d commit d3b5bcc

8 files changed

Lines changed: 719 additions & 1 deletion

File tree

.github/workflows/commit.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,3 +195,18 @@ jobs:
195195
nix develop --command go version
196196
nix develop --command golangci-lint version
197197
nix develop --command goreleaser --version
198+
199+
integration-test:
200+
name: integration-test
201+
runs-on: ubuntu-24.04
202+
needs: build
203+
steps:
204+
- uses: actions/checkout@v5
205+
- uses: actions/setup-go@v6
206+
with:
207+
go-version: "1.25.2"
208+
209+
- run: go mod download
210+
211+
- name: Run integration tests
212+
run: go test -v -tags=integration -timeout=10m ./integration/...

AGENTS.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ Config bootstrap (cmd/start.go):
1919
- `extractSharedNetwork` copies network components from the coordinator into other apps.
2020
- DRPC routes by method prefix (`/CoordinatorService`, `/ConsensusService`, `/FileService`, `/SpaceSyncService`).
2121
- Data layout (default `./data`):
22+
- `bundle-config.yml` – persisted configuration (credentials, keys)
23+
- `client-config.yml` – generated client config (regenerated on start)
24+
- `storage/` – local storage directory:
25+
- `network-store/` – network configuration
26+
- `storage-sync/` – sync node persistence (AnyStore)
27+
- `storage-file/` – filenode data (BadgerDB, when not using S3)
2228

2329
## Development
2430

@@ -27,9 +33,21 @@ Config bootstrap (cmd/start.go):
2733
- `compose.dev.yml` – development dependencies (MongoDB replica set + Redis Stack).
2834
- `compose.aio.yml` – bundle image with embedded MongoDB/Redis.
2935
- `compose.external.yml` – bundle image plus external MongoDB and Redis containers.
36+
- `compose.s3.yml` – bundle with MinIO for S3 storage testing.
37+
- `compose.traefik.yml` – Traefik reverse proxy example.
3038

3139
```bash
3240
go build -o any-sync-bundle .
3341
golangci-lint run --fix
3442
go test -race -shuffle=on -vet=all -failfast ./...
43+
go test -tags=integration ./integration/... # requires Docker
3544
```
45+
46+
### Integration Tests
47+
48+
Uses `testcontainers-go` to spin up MongoDB, Redis, and MinIO containers.
49+
50+
Test files:
51+
- `integration/containers.go` – container lifecycle helpers
52+
- `integration/bundle.go` – bundle process manager
53+
- `integration/integration_test.go` – test cases

flake.nix

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

4949
src = ./.;
5050

51-
vendorHash = "sha256-jknWpJfPlN/hdwWIiHhWnvWxuEMaHEaBZu0ejb4mGEM=";
51+
vendorHash = "sha256-vQqiObn/r3lY4VPTXI4cLCtTbYzGpXNaZrkkqhUglpo=";
5252

5353
env.CGO_ENABLED = 0;
5454

go.mod

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ require (
2020
github.com/ipfs/go-cid v0.6.0
2121
github.com/multiformats/go-multihash v0.2.3
2222
github.com/stretchr/testify v1.11.1
23+
github.com/testcontainers/testcontainers-go v0.40.0
24+
github.com/testcontainers/testcontainers-go/modules/mongodb v0.40.0
25+
github.com/testcontainers/testcontainers-go/modules/redis v0.40.0
2326
github.com/urfave/cli/v2 v2.27.7
2427
go.mongodb.org/mongo-driver v1.17.6
2528
go.uber.org/zap v1.27.1
@@ -28,7 +31,10 @@ require (
2831
)
2932

3033
require (
34+
dario.cat/mergo v1.0.2 // indirect
3135
filippo.io/edwards25519 v1.1.0 // indirect
36+
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
37+
github.com/Microsoft/go-winio v0.6.2 // indirect
3238
github.com/OneOfOne/xxhash v1.2.8 // indirect
3339
github.com/akrylysov/pogreb v0.10.3-0.20240803013244-523613e335e9 // indirect
3440
github.com/anyproto/any-store v0.4.3 // indirect
@@ -42,21 +48,34 @@ require (
4248
github.com/btcsuite/btcd v0.22.1 // indirect
4349
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 // indirect
4450
github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce // indirect
51+
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
4552
github.com/cespare/xxhash v1.1.0 // indirect
4653
github.com/cespare/xxhash/v2 v2.3.0 // indirect
4754
github.com/cheggaaa/mb/v3 v3.0.2 // indirect
55+
github.com/containerd/errdefs v1.0.0 // indirect
56+
github.com/containerd/errdefs/pkg v0.3.0 // indirect
57+
github.com/containerd/log v0.1.0 // indirect
58+
github.com/containerd/platforms v0.2.1 // indirect
59+
github.com/cpuguy83/dockercfg v0.3.2 // indirect
4860
github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect
4961
github.com/davecgh/go-spew v1.1.1 // indirect
5062
github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // indirect
5163
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 // indirect
5264
github.com/dgraph-io/ristretto/v2 v2.2.0 // indirect
5365
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
5466
github.com/disintegration/imaging v1.6.2 // indirect
67+
github.com/distribution/reference v0.6.0 // indirect
68+
github.com/docker/docker v28.5.1+incompatible // indirect
69+
github.com/docker/go-connections v0.6.0 // indirect
70+
github.com/docker/go-units v0.5.0 // indirect
5571
github.com/dustin/go-humanize v1.0.1 // indirect
72+
github.com/ebitengine/purego v0.8.4 // indirect
73+
github.com/felixge/httpsnoop v1.0.4 // indirect
5674
github.com/flopp/go-findfont v0.1.0 // indirect
5775
github.com/fogleman/gg v1.3.0 // indirect
5876
github.com/go-logr/logr v1.4.3 // indirect
5977
github.com/go-logr/stdr v1.2.2 // indirect
78+
github.com/go-ole/go-ole v1.2.6 // indirect
6079
github.com/go-redsync/redsync/v4 v4.14.0 // indirect
6180
github.com/gobwas/glob v0.2.3 // indirect
6281
github.com/goccy/go-graphviz v0.2.9 // indirect
@@ -76,10 +95,21 @@ require (
7695
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
7796
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
7897
github.com/libp2p/go-libp2p v0.45.0 // indirect
98+
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
99+
github.com/magiconair/properties v1.8.10 // indirect
79100
github.com/matryer/moq v0.6.0 // indirect
80101
github.com/mattn/go-isatty v0.0.20 // indirect
102+
github.com/mdelapenya/tlscert v0.2.0 // indirect
81103
github.com/minio/sha256-simd v1.0.1 // indirect
104+
github.com/moby/docker-image-spec v1.3.1 // indirect
105+
github.com/moby/go-archive v0.1.0 // indirect
106+
github.com/moby/patternmatcher v0.6.0 // indirect
107+
github.com/moby/sys/sequential v0.6.0 // indirect
108+
github.com/moby/sys/user v0.4.0 // indirect
109+
github.com/moby/sys/userns v0.1.0 // indirect
110+
github.com/moby/term v0.5.0 // indirect
82111
github.com/montanaflynn/stats v0.7.1 // indirect
112+
github.com/morikuni/aec v1.0.0 // indirect
83113
github.com/mr-tron/base58 v1.2.0 // indirect
84114
github.com/multiformats/go-base32 v0.1.0 // indirect
85115
github.com/multiformats/go-base36 v0.2.0 // indirect
@@ -90,8 +120,12 @@ require (
90120
github.com/multiformats/go-varint v0.1.0 // indirect
91121
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
92122
github.com/ncruces/go-strftime v0.1.9 // indirect
123+
github.com/opencontainers/go-digest v1.0.0 // indirect
124+
github.com/opencontainers/image-spec v1.1.1 // indirect
125+
github.com/pkg/errors v0.9.1 // indirect
93126
github.com/planetscale/vtprotobuf v0.6.0 // indirect
94127
github.com/pmezard/go-difflib v1.0.0 // indirect
128+
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
95129
github.com/prometheus/client_golang v1.23.2 // indirect
96130
github.com/prometheus/client_model v0.6.2 // indirect
97131
github.com/prometheus/common v0.66.1 // indirect
@@ -100,18 +134,24 @@ require (
100134
github.com/redis/go-redis/v9 v9.17.0 // indirect
101135
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
102136
github.com/russross/blackfriday/v2 v2.1.0 // indirect
137+
github.com/shirou/gopsutil/v4 v4.25.6 // indirect
138+
github.com/sirupsen/logrus v1.9.3 // indirect
103139
github.com/spaolacci/murmur3 v1.1.0 // indirect
104140
github.com/tetratelabs/wazero v1.8.1 // indirect
141+
github.com/tklauser/go-sysconf v0.3.12 // indirect
142+
github.com/tklauser/numcpus v0.6.1 // indirect
105143
github.com/tyler-smith/go-bip39 v1.1.0 // indirect
106144
github.com/valyala/fastjson v1.6.4 // indirect
107145
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
108146
github.com/xdg-go/scram v1.1.2 // indirect
109147
github.com/xdg-go/stringprep v1.0.4 // indirect
110148
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect
111149
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 // indirect
150+
github.com/yusufpapurcu/wmi v1.2.4 // indirect
112151
github.com/zeebo/blake3 v0.2.4 // indirect
113152
github.com/zeebo/errs v1.3.0 // indirect
114153
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
154+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0 // indirect
115155
go.opentelemetry.io/otel v1.38.0 // indirect
116156
go.opentelemetry.io/otel/metric v1.38.0 // indirect
117157
go.opentelemetry.io/otel/trace v1.38.0 // indirect

0 commit comments

Comments
 (0)