36 Commits

Author SHA1 Message Date
Madhav Jivrajani
4fa07a1c8a tests/robustness: make merging histories work on []PersistedEvent
Event histories after merging serve as an authorotative list of
events that can be seen as ones persisted by etcd, we don't need
PrevValue as part of it.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>
2024-02-14 15:44:08 +05:30
Madhav Jivrajani
9aad6700d5 tests/robustness: add robustness test for watch with PrevKV()
Kubernetes relies on the PrevKV() option in the watches it opens
against etcd. This commit adds a robustness test to validate the
same.

A watch response returned with PrevKV() is valid if:
The value in current event's prevKV matches the previous
event's value of the same key if this is not a create event.

There are cases where there can be a prevKV for a create event
as well, for example if a watch is opened after the key is creatd.
Since we don't simulate for that, we don't check for that.

Further, this adjusts revision numbers such that we can successfully create
a new replay. Needed now since we will have unit tests with
and without PrevKV co-existing and we requite creation of a
new replay everytime we validate PrevKV.

We also regenerate test data with so that prevKV exists in it

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>
2024-02-13 22:55:57 +05:30
Madhav Jivrajani
f0f4e8a4e8 tests/robustness: fix out of index panic in model replay
Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>
2024-02-01 16:14:35 +05:30
Wei Fu
aea1cd0077 feat: enable unparam lint
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2023-10-17 21:24:13 +08:00
Wei Fu
07effc4d0a *: fix revive linter
Remove old revive_pass in the bash scripts and migirate the revive.toml
into golangci linter_settings.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2023-09-24 14:21:11 +08:00
chenyahui
c0aa3b613b Use any instead of interface{}
Signed-off-by: chenyahui <cyhone@qq.com>
2023-09-17 17:41:58 +08:00
Marek Siarkowicz
11da84a1d1 tests/robustness: Implement loading client reports
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2023-06-28 15:35:17 +02:00
Marek Siarkowicz
09c462e2ea tests/robustness: Add resumable validation and improve reliable validation
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2023-06-26 12:12:39 +02:00
Marek Siarkowicz
c3720fac3d tests/robustness: Implement Kubernetes pagination
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2023-06-23 09:44:22 +02:00
Marek Siarkowicz
2e7cb772b2 tests/robustness: Implement proper range requests
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2023-06-22 18:36:43 +02:00
Marek Siarkowicz
f7831e2607 tests/robustness: Move key into dedicated options to allow to implement proper ranges
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2023-06-22 18:27:54 +02:00
Marek Siarkowicz
3f09a51c60 tests/robustness: Make watch event independent from etcd operation
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2023-06-22 15:43:27 +02:00
Marek Siarkowicz
1663600bec tests/robustness: Validate stale get requests by replaying etcd state
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2023-06-19 14:17:38 +02:00
Marek Siarkowicz
96987d8b5e tests/robustness: Implement stale reads without validation
For now we just validate stale read revision, but not response content.
Reason is that etcd model only stores latest version of keys, and no
history like real etcd.

Validating stale read contents needs to be done outside of model
as storing whole history is just to costly for linearization validation.

Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2023-06-16 21:17:37 +02:00
Marek Siarkowicz
ea3255b477 tests/robustness: Limit model to start only from fresh state
It is just to complicated to support starting from non-empty etcd.
Existing implementation was very naive to assume that we can build
full state from just one request. We might consider implementing
validation of non-empty history in future, but for now settting
this limit should clean up the code and speed up development.

Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2023-06-16 13:50:20 +02:00
Marek Siarkowicz
34cbf4cd6f tests/robustness: Allow errors and unknown responses in deterministic model
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2023-06-15 22:25:48 +02:00
Marek Siarkowicz
6979318108 tests/robustness: Make Range a proper request type to allow setting Range.Revision != 0 for stale reads
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2023-06-14 13:55:45 +02:00
Marek Siarkowicz
974655e02c tests/robustness: Rename operations const to separate from RequestType
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2023-06-14 13:24:14 +02:00
Marek Siarkowicz
7bbc738ec4 tests/robustness: Extract validation to separate package
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2023-06-14 09:14:27 +02:00
Marek Siarkowicz
a6ab774458
Merge pull request #16044 from serathius/robusness-empty
tests/robustness: Assume starting from empty etcd instead of throwing out first failed request
2023-06-12 10:18:34 +02:00
Marek Siarkowicz
f410c6e6df tests/robustness: Provide a response diff in model test to make debugging easier
Signed-off-by: Marek Siarkowicz <serathius@users.noreply.github.com>
2023-06-09 22:42:17 +02:00
Marek Siarkowicz
53af854871 tests/robustness: Assume starting from empty etcd instead of throwing out first failed request
Signed-off-by: Marek Siarkowicz <serathius@users.noreply.github.com>
2023-06-09 22:38:16 +02:00
Marek Siarkowicz
f3c9db9c46
Merge pull request #15893 from serathius/robustness-validate-client-watch
tests/robustness: Validate all etcd watches opened to etcd
2023-05-16 10:51:55 +02:00
Marek Siarkowicz
6429f47631 tests/robustness: Validate all etcd watches opened to etcd
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2023-05-16 10:28:01 +02:00
Marek Siarkowicz
112aad1ea7 tests/robustness: Unify model test cases
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2023-05-16 10:13:08 +02:00
Marek Siarkowicz
6e53792568 tests/robustness: Implement Kubernetes optimistic concurrency operations
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2023-05-15 13:45:27 +02:00
Marek Siarkowicz
2a0c989662
Merge pull request #15882 from serathius/robustness-txn-fields
tests/robustness: Improve naming of Txn fields
2023-05-12 13:34:02 +02:00
Marek Siarkowicz
831ce4c3cf tests/robustness: Improve naming of Txn fields
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2023-05-12 13:10:25 +02:00
Marek Siarkowicz
e9900f6fff tests/robustness: Separate stream id from client id and improve AppendableHistory doc
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2023-05-11 21:03:52 +02:00
Marek Siarkowicz
962e15038e tests/robustness: Add safeguards to client and history
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2023-05-11 13:12:09 +02:00
Marek Siarkowicz
7c68be4cf3 tests/robustness: Implement Range limit and count
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2023-05-07 09:32:07 +02:00
Marek Siarkowicz
40f71ef3c6 tests/robustness: Implement delete request for kubernetes scenario
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2023-05-05 13:40:46 +02:00
Marek Siarkowicz
92366a5338 tests/robustness: Split model code into deterministic and non-deterministic
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
Co-authored-by: Benjamin Wang <wachao@vmware.com>
Co-authored-by: chao <54131596+chaochn47@users.noreply.github.com>
2023-05-05 12:25:10 +02:00
Marek Siarkowicz
cfe154209c tests/robustness: Separate describe model functions to dedicated file
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2023-05-04 14:03:18 +02:00
Marek Siarkowicz
9b5680c5f1 tests/robustness: Implement first step in validating the Kubernetes-etcd contract.
* Use mod revision for optimistic concurrency.
* Introduce range requests as more general then get
* Add kubernetes specific traffic generation, for now using pull, but
  expected to evolve to use watch.
* Introduce kubernetes specific test scenario

Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2023-05-04 13:26:54 +02:00
Marek Siarkowicz
d475cf81a0 tests: Rename linearizability tests to robustness
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2023-02-26 14:36:18 +01:00