57 Commits

Author SHA1 Message Date
Chao Chen
e6c8bf82e0 add uds test cases into e2e TestAuthority
Signed-off-by: Chao Chen <chaochn@amazon.com>
2023-06-08 15:54:30 -07:00
Wei Fu
50aa00b203 tests: make log monitor as common helper
It's followup of #15667.

This patch is to use zaptest/observer as base to provide a similar
function to pkg/expect.Expect.

The test env

```bash
11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
mkdir /sys/fs/cgroup/etcd-followup-15667
echo 0-2 | tee /sys/fs/cgroup/etcd-followup-15667/cpuset.cpus # three cores
```

Before change:

* memory.peak: ~ 681 MiB
* Elapsed (wall clock) time (h:mm:ss or m:ss): 6:14.04

After change:

* memory.peak: ~ 671 MiB
* Elapsed (wall clock) time (h:mm:ss or m:ss): 6:13.07

Based on the test result, I think it's safe to be enabled by default.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2023-04-18 09:00:24 +08:00
Chao Chen
caed563e08 fix flaking auth member remove test
Signed-off-by: Chao Chen <chaochn@amazon.com>
2023-04-03 17:41:08 -07:00
Chao Chen
d7f992c351 enable pre-vote by default and add retry on member_test
Signed-off-by: Chao Chen <chaochn@amazon.com>
2023-03-17 15:15:13 -07:00
Piotr Tabor
6f899a7b40
Merge pull request #15052 from ptabor/20221228-goimports-fix
./scripts/fix.sh: Takes care of goimports across the whole project.
2022-12-29 11:31:22 +01:00
Piotr Tabor
9e1abbab6e Fix goimports in all existing files. Execution of ./scripts/fix.sh
Signed-off-by: Piotr Tabor <ptab@google.com>
2022-12-29 09:41:31 +01:00
wafuwafu13
0c67e318d7 enhancement(ctlv3): display as learner when member add as learner
Signed-off-by: wafuwafu13 <mariobaske@i.softbank.jp>
2022-12-29 13:18:23 +09:00
Benjamin Wang
7ce21519fb test: update test to use the new raft module go.etcd.io/raft/v3
Just replaced all go.etcd.io/etcd/raft/v3 with go.etcd.io/raft/v3
under directory test.

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-12-02 13:32:47 +08:00
Chao Chen
f3c47d760c update auth test interface
Signed-off-by: Chao Chen <chaochn@amazon.com>
2022-10-26 09:56:22 -04:00
Benjamin Wang
4e0ccc69c9 test: refactor the client interface
It doesn't make sense to always pass a AuthConfig parameter for
test cases which do not enable auth at all. So refactoring the
Client interface method so that it accepts a `ClientOption`
variadic parameter.

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-10-24 19:04:34 +08:00
Marek Siarkowicz
07ca384753 tests: Move MustAbsPath function to testutils
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-10-17 13:37:14 +02:00
Thomas Jungblut
20dccfa484 Test port allocating using net.Listen
To avoid port clashes during integration tests, we let the OS give us a
free port.

Signed-off-by: Thomas Jungblut <tjungblu@redhat.com>
2022-10-14 09:40:04 +02:00
Chao Chen
8d057ea2b8 common tests framework: cluster client creation fail with invalid auth
Signed-off-by: Chao Chen <chaochn@amazon.com>
2022-09-29 23:09:32 -07:00
Benjamin Wang
159ed15afc
Merge pull request #14479 from demoManito/fix/declaring-empty-slice
etcd: modify declaring empty slices
2022-09-20 05:22:59 +08:00
Hitoshi Mitake
c793f18238
Merge pull request #14322 from mitake/watch-auth-err
*: handle auth invalid token and old revision errors in watch
2022-09-19 23:33:49 +09:00
Hitoshi Mitake
c5614520d5 tests: a test case for watch with auth token expiration
Signed-off-by: Hitoshi Mitake <h.mitake@gmail.com>
2022-09-17 21:51:36 +09:00
demoManito
72cf0cc04a etcd: modify declaring empty slices
declare an empty slice to var s []int replace  s :=[]int{}, https://github.com/golang/go/wiki/CodeReviewComments#declaring-empty-slices

Signed-off-by: demoManito <1430482733@qq.com>
2022-09-16 14:41:14 +08:00
Benjamin Wang
e8ad008067 integration_test: fix the flaky test TestV3AuthRestartMembe
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-09-14 14:30:37 +08:00
Clark
3beb25489d tests: enable --strict-reconfig-check by default and expose it to common framework
Signed-off-by: Clark <fwyongxing@gmail.com>
2022-08-31 22:21:23 +08:00
Clark
0b9f43410a tests: e2e and integration share TickDuration constant
Signed-off-by: Clark <fwyongxing@gmail.com>
2022-08-14 18:49:46 +08:00
Clark
a5409c62e6 tests: add WaitLeader function to common framework
Signed-off-by: Clark <fwyongxing@gmail.com>
2022-08-11 12:46:40 +08:00
Piotr Tabor
651de5a057 Rename EtcdServer.Id with EtcdServer.MemberId.
It was misleading and error prone vs. ClusterId.
2022-05-20 14:32:04 +02:00
Marek Siarkowicz
26f42e7a9e server: Apply review comments and split basic handler 2022-05-05 09:52:14 +02:00
Marek Siarkowicz
722ec487df server: Split metrics and health code 2022-05-05 09:52:14 +02:00
Marek Siarkowicz
600ee13ac0 server: Cover V3 health with tests 2022-05-05 09:52:14 +02:00
Marek Siarkowicz
0096d2ecdb server: Remove unused NewClientHandler 2022-05-05 09:52:13 +02:00
ahrtr
24002fb099 allocate unique port for each member in test cases 2022-04-26 12:32:00 +08:00
ahrtr
fe3a57976e support linearizable renew lease
When etcdserver receives a LeaseRenew request, it may be still in
progress of processing the LeaseGrantRequest on exact the same
leaseID. Accordingly it may return a TTL=0 to client due to the
leaseID not found error. So the leader should wait for the appliedID
to be available before processing client requests.
2022-04-10 14:44:55 +08:00
Piotr Tabor
68f2cb8c77 Fix ExampleAuth from integration/clientv3/examples (on OsX)
The code now ensures that each of the test is running in its own directory as opposed to shared os.tempdir.
```
$  (cd tests && env go test -timeout=15m --race go.etcd.io/etcd/tests/v3/integration/clientv3/examples -run ExampleAuth)
2022/04/03 10:24:59 Running tests (examples): ...
2022/04/03 10:24:59 the function can be called only in the test context. Was integration.BeforeTest() called ?
2022/04/03 10:24:59 2022-04-03T10:24:59.462+0200	INFO	m0	LISTEN GRPC	{"member": "m0", "grpcAddr": "localhost:m0", "m.Name": "m0"}
```
2022-04-03 14:16:45 +02:00
Piotr Tabor
d57f8dba62 Deflaking: Make WaitLeader (and WaitMembersForLeader) aggressively (30s) wait for leader being established.
Nearly none of the tests was checking the value... just assuming WaitLeader success.

```
    maintenance_test.go:277: Waiting for leader...
    logger.go:130: 2022-04-03T08:01:09.914+0200	INFO	m0	cluster version differs from storage version.	{"member": "m0", "cluster-version": "3.6.0", "storage-version": "3.5.0"}
    logger.go:130: 2022-04-03T08:01:09.915+0200	WARN	m0	leader failed to send out heartbeat on time; took too long, leader is overloaded likely from slow disk	{"member": "m0", "to": "2acc3d3b521981", "heartbeat-interval": "10ms", "expected-duration": "20ms", "exceeded-duration": "103.756219ms"}
    logger.go:130: 2022-04-03T08:01:09.916+0200	INFO	m0	updated storage version	{"member": "m0", "new-storage-version": "3.6.0"}
    ...
    logger.go:130: 2022-04-03T08:01:09.926+0200	INFO	grpc	[[roundrobin] roundrobinPicker: Build called with info: {map[0xc002630ac0:{{unix:localhost:m0 localhost <nil> 0 <nil>}} 0xc002630af0:{{unix:localhost:m1 localhost <nil> 0 <nil>}} 0xc002630b20:{{unix:localhost:m2 localhost <nil> 0 <nil>}}]}]
    logger.go:130: 2022-04-03T08:01:09.926+0200	WARN	m0	apply request took too long	{"member": "m0", "took": "114.661766ms", "expected-duration": "100ms", "prefix": "", "request": "header:<ID:12658633312866157316 > cluster_version_set:<ver:\"3.6.0\" > ", "response": ""}
    logger.go:130: 2022-04-03T08:01:09.927+0200	INFO	m0	cluster version is updated	{"member": "m0", "cluster-version": "3.6"}
    logger.go:130: 2022-04-03T08:01:09.955+0200	INFO	m2.raft	9f96af25a04e2ec3 [logterm: 2, index: 8, vote: 9903a56eaf96afac] ignored MsgVote from 2acc3d3b521981 [logterm: 2, index: 8] at term 2: lease is not expired (remaining ticks: 10)	{"member": "m2"}
    logger.go:130: 2022-04-03T08:01:09.955+0200	INFO	m0.raft	9903a56eaf96afac [logterm: 2, index: 8, vote: 9903a56eaf96afac] ignored MsgVote from 2acc3d3b521981 [logterm: 2, index: 8] at term 2: lease is not expired (remaining ticks: 5)	{"member": "m0"}
    logger.go:130: 2022-04-03T08:01:09.955+0200	INFO	m0.raft	9903a56eaf96afac [term: 2] received a MsgAppResp message with higher term from 2acc3d3b521981 [term: 3]	{"member": "m0"}
    logger.go:130: 2022-04-03T08:01:09.955+0200	INFO	m0.raft	9903a56eaf96afac became follower at term 3	{"member": "m0"}
    logger.go:130: 2022-04-03T08:01:09.955+0200	INFO	m0.raft	raft.node: 9903a56eaf96afac lost leader 9903a56eaf96afac at term 3	{"member": "m0"}
    maintenance_test.go:279: Leader established.
```

Tmp
2022-04-03 12:23:09 +02:00
Piotr Tabor
2fab3f3ae5 Make naming of test-nodes consistent and positive: m0, m1, m2
The nodes used to be named: m-1, m0, m1, that was generating very confusing logs
in integration tests.
2022-04-03 09:16:55 +02:00
Marek Siarkowicz
31de503859
Merge pull request #13740 from serathius/common-get
Migrate key value Get to common framework
2022-03-02 10:14:34 +01:00
Piotr Tabor
088807c08e
Merge pull request #13565 from ahrtr/remove_peer_serve_client_requests
Updated servePeers to remove the grpc server
2022-03-01 16:24:42 +01:00
Marek Siarkowicz
81ef11ffb8 tests: Test different TLS configuration with TestKVPut 2022-03-01 10:41:21 +01:00
ahrtr
9b6681fffd add failover test cases 2022-02-25 09:55:36 +08:00
ahrtr
2f36e0c62b Change discovery url to endpoints
Currently the discovery url is just one endpoint. But actually it
should be the same as the etcdctl, which means that it should be
a list of endpoints. When one endpoint is down, the clientv3 can
fail over to the next endpoint automatically.
2022-02-24 09:11:41 +08:00
ahrtr
ebc86d12c0 support v3 discovery to bootstrap a new etcd cluster 2022-02-21 23:22:49 +08:00
Chao Chen
fd79af9ee7 load all leases from backend 2022-02-13 20:30:20 -08:00
Marek Siarkowicz
43c1631f26 tests: Use cmp.Equal to avoid mutating arguments 2022-02-01 16:47:18 +01:00
ahrtr
a879ccf152 updated servePeers to remvoe the grpc server 2022-01-27 16:22:01 +08:00
Marek Siarkowicz
692b3c4cd7 server: Remove most of V2 API 2022-01-25 15:24:13 +01:00
Marek Siarkowicz
37879eb5f9 test: Migrate WaitMembersMatch to V3 API 2022-01-25 13:56:17 +01:00
Marek Siarkowicz
c59694d41e test: Migrate WaitMembersForLeader to V3 API 2022-01-24 17:26:51 +01:00
Marek Siarkowicz
81490c25d1 test: Migrate WaitStarted to V3 API 2022-01-24 17:26:50 +01:00
Marek Siarkowicz
ee6306b9f9 Migrate RemoveMember and AddMember to V3 API 2022-01-24 17:01:22 +01:00
Marek Siarkowicz
a53074542b test: Run v2 discovery tests on previous version binary 2022-01-20 14:10:09 +01:00
Marek Siarkowicz
264fdbb6a1 test: Remove separation between V2 and V3 cluster in integration tests 2022-01-20 14:10:09 +01:00
Marek Siarkowicz
de30257d79 test: Always run server with grpc enabled 2022-01-20 14:10:09 +01:00
Marek Siarkowicz
51f72915e4 test: Move UseGRPC to member config 2022-01-20 14:10:09 +01:00
Marek Siarkowicz
87c8e8b868 test: Migrate to ClusterV3 cluster in integration tests 2022-01-20 14:10:09 +01:00