Skip to content

etcd: use testcontainers to run etcd in tests - #4244

Open
sri-adarsh-kumar wants to merge 2 commits into
zalando:masterfrom
sri-adarsh-kumar:sri-adarsh-kumar/issue-2451
Open

etcd: use testcontainers to run etcd in tests#4244
sri-adarsh-kumar wants to merge 2 commits into
zalando:masterfrom
sri-adarsh-kumar:sri-adarsh-kumar/issue-2451

Conversation

@sri-adarsh-kumar

@sri-adarsh-kumar sri-adarsh-kumar commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Replaces host etcd process management in etcd/etcdtest with testcontainers-go and removes host binary download scripts.
Updates test suites to cleanly skip etcd container startup under -test.short.

Fixes #2451

Please add a gen-ai label if present.

Signed-off-by: Sri Adarsh Kumar <sri.adarsh.kumar+gh@zalando.de>
@sri-adarsh-kumar

Copy link
Copy Markdown
Contributor Author

There seem to be flaky TestTracingProxySpanWithTeeLoopbackFilter test. So closing and reopening.
Previously ClusterFuzzLite failed and succeeded on retry

@sri-adarsh-kumar
sri-adarsh-kumar marked this pull request as ready for review September 4, 2026 07:24
Comment thread etcd/etcdtest/mocketcd.go Outdated
return (1 << 15) + rand.Intn(1<<15) // #nosec
}
const (
etcdImage = "gcr.io/etcd-development/etcd:v3.5.18"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it work if we would switch to "latest"?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked with my agent.

  • The registry has no :latest tag.
  • In etcd 3.6+, upstream completely removed the v2 storage engine and --enable-v2 flag.
  • Because skipper/etcd is an HTTP v2 client (/v2/keys), it requires etcd <= 3.5.x until Skipper migrates the client to etcd v3 gRPC API in a separate initiative.

If you wish, I can make a separate issue to do the migration.

Comment thread etcd/etcdtest/mocketcd.go Outdated

Urls = makeLocalUrls(randPort(), randPort())
clientUrlsString := strings.Join(Urls, ",")
ctx, cancel := context.WithTimeout(context.Background(), 40*time.Second)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we depend on external docker registries that are throttled if you have a lot of runs a day. I would suggest to have at least 2 minutes as timeout

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

Comment thread etcd/etcdtest/mocketcd.go Outdated
if binary == "" {
binary = "etcd"
}
endpointCtx, endpointCancel := context.WithTimeout(context.Background(), 5*time.Second)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please refactor and use a const endpointTimeout = time.Minute instead of fixed 5*time.Second.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

@szuecs szuecs added refactor minor no risk changes, for example new filters labels Sep 4, 2026
Signed-off-by: Sri Adarsh Kumar <sri.adarsh.kumar+gh@zalando.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor no risk changes, for example new filters refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use testcontainers to run etcd

2 participants