Skip to content

In-memory implementation of etcd client for testing - #43

Merged
56quarters merged 5 commits into
mainfrom
56quarters/mock-etcd
Sep 20, 2021
Merged

In-memory implementation of etcd client for testing#43
56quarters merged 5 commits into
mainfrom
56quarters/mock-etcd

Conversation

@56quarters

Copy link
Copy Markdown
Contributor

Signed-off-by: Nick Pillitteri nick.pillitteri@grafana.com

What this PR does:

Create an in-memory version of an Etcd v3 client for use testing
the Etcd implementation of kv.Client. Because this client is only
for unit testing another part of dskit, it does not implement all
operations that the real client does - only enough to pass our tests.

The benefit of this in-memory client is that dskit can drop its
dependency on the entire Etcd server which was used in-process for
testing previously. This meant that consumers of dskit inherited
a dependency on the Etcd server and all its dependencies which
caused version conflicts in e.g. Tempo.

Which issue(s) this PR fixes:

Fixes #40

Checklist

  • Tests updated
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

Create an in-memory version of an Etcd v3 client for use testing
the Etcd implementation of kv.Client. Because this client is only
for unit testing another part of dskit, it does not implement all
operations that the real client does - only enough to pass our tests.

The benefit of this in-memory client is that dskit can drop its
dependency on the entire Etcd server which was used in-process for
testing previously. This meant that consumers of dskit inherited
a dependency on the Etcd server and all its dependencies which
caused version conflicts in e.g. Tempo.

Fixes #40

Signed-off-by: Nick Pillitteri <nick.pillitteri@grafana.com>
Comment thread kv/etcd/mock.go Outdated
Signed-off-by: Nick Pillitteri <nick.pillitteri@grafana.com>

@trevorwhitney trevorwhitney left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A few small nits, but LGTM! Looks great!

Comment thread kv/etcd/mock.go Outdated
Comment thread kv/etcd/mock_test.go Outdated
Comment thread kv/etcd/mock_test.go Outdated
Comment thread kv/etcd/mock_test.go Outdated
Comment thread kv/etcd/mock_test.go
Signed-off-by: Nick Pillitteri <nick.pillitteri@grafana.com>
Signed-off-by: Nick Pillitteri <nick.pillitteri@grafana.com>
Comment thread kv/etcd/mock.go Outdated
Comment thread kv/etcd/mock.go Outdated
Comment thread kv/etcd/mock.go
Signed-off-by: Nick Pillitteri <nick.pillitteri@grafana.com>

@replay replay left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

etcd mock client depends on etcd server packages

3 participants