Commit Graph

1260 Commits (a6ab774458411a6c0ea08f5df97e4dcc9a836345)

Author SHA1 Message Date
Benjamin Wang c2a7a5870d deps: bump github.com/prometheus/client_golang from 1.12.2 to 1.14.0
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-12-14 03:42:11 +08:00
Benjamin Wang bc41c0963b deps: bump github.com/coreos/go-systemd/v22 from 22.3.2 to 22.5.0
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-12-14 03:38:55 +08:00
Benjamin Wang 259a73d67a deps: bump github.com/spf13/cobra from 1.4.0 to 1.6.1
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-12-14 03:33:24 +08:00
Benjamin Wang 1a0af6fee6 deps: bump go.uber.org/zap from 1.21.0 to 1.24.0
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-12-14 03:33:24 +08:00
Benjamin Wang 3c51c42417 test: fix nil pointer panic in testMutexLock
Refer to: https://github.com/etcd-io/etcd/actions/runs/3671847902/jobs/6207463700

```
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xedc388]

goroutine 5253 [running]:
go.etcd.io/etcd/client/v3/concurrency.(*Session).Client(...)
	/home/runner/work/etcd/etcd/client/v3/concurrency/session.go:76
go.etcd.io/etcd/client/v3/concurrency.(*Mutex).tryAcquire(0xc000133140, {0x18a8668, 0xc000050158})
	/home/runner/work/etcd/etcd/client/v3/concurrency/mutex.go:111 +0x88
go.etcd.io/etcd/client/v3/concurrency.(*Mutex).Lock(0xc000133140, {0x18a8668, 0xc000050158})
	/home/runner/work/etcd/etcd/client/v3/concurrency/mutex.go:74 +0x68
go.etcd.io/etcd/tests/v3/integration/clientv3/experimental/recipes_test.testMutexLock.func1()
	/home/runner/work/etcd/etcd/tests/integration/clientv3/experimental/recipes/v3_lock_test.go:65 +0x285
created by go.etcd.io/etcd/tests/v3/integration/clientv3/experimental/recipes_test.testMutexLock
	/home/runner/work/etcd/etcd/tests/integration/clientv3/experimental/recipes/v3_lock_test.go:59 +0xda
FAIL	go.etcd.io/etcd/tests/v3/integration/clientv3/experimental/recipes	7.070s
FAIL
```

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-12-12 10:18:45 +08:00
Marek Siarkowicz 1bb4c9558d tests: Update gofail to v0.1.0
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-12-10 14:49:20 +01:00
Benjamin Wang 893a3e7356
Merge pull request #14916 from ahrtr/bump_go_1.19.4
Bump go to 1.19.4 and golang.org/x/net to v0.4.0 to address CVEs
2022-12-09 16:38:39 +08:00
Benjamin Wang 1ba246e1d8 bump golang.org/x/ to v0.4.0
Found 1 known vulnerability.

Vulnerability #1: GO-2022-1144
  An attacker can cause excessive memory growth in a Go server
  accepting HTTP/2 requests. HTTP/2 server connections contain a
  cache of HTTP header keys sent by the client. While the total
  number of entries in this cache is capped, an attacker sending
  very large keys can cause the server to allocate approximately
  64 MiB per open connection.

  Call stacks in your code:
Error:       tools/etcd-dump-metrics/main.go:158:5: go.etcd.io/etcd/v3/tools/etcd-dump-metrics.main calls go.etcd.io/etcd/server/v3/embed.StartEtcd, which eventually calls golang.org/x/net/http2.Server.ServeConn

  Found in: golang.org/x/net/http2@v0.2.0
  Fixed in: golang.org/x/net/http2@v0.4.0
  More info: https://pkg.go.dev/vuln/GO-2022-1144
Error: Process completed with exit code 3.

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-12-09 08:54:48 +08:00
Benjamin Wang dccc21bb69 bump go 1.19.4
$ govulncheck ./...
govulncheck is an experimental tool. Share feedback at https://go.dev/s/govulncheck-feedback.

Scanning for dependencies with known vulnerabilities...
Found 1 known vulnerability.

Vulnerability #1: GO-2022-1144
  An attacker can cause excessive memory growth in a Go server
  accepting HTTP/2 requests. HTTP/2 server connections contain a
  cache of HTTP header keys sent by the client. While the total
  number of entries in this cache is capped, an attacker sending
  very large keys can cause the server to allocate approximately
  64 MiB per open connection.

  Call stacks in your code:
      tools/etcd-dump-metrics/main.go:159:31: go.etcd.io/etcd/v3/tools/etcd-dump-metrics.main$4 calls go.etcd.io/etcd/server/v3/embed.StartEtcd, which eventually calls golang.org/x/net/http2.ConfigureServer$1

  Found in: golang.org/x/net/http2@v0.2.0
  Fixed in: golang.org/x/net/http2@v1.19.4
  More info: https://pkg.go.dev/vuln/GO-2022-1144

Vulnerability #2: GO-2022-1144
  An attacker can cause excessive memory growth in a Go server
  accepting HTTP/2 requests. HTTP/2 server connections contain a
  cache of HTTP header keys sent by the client. While the total
  number of entries in this cache is capped, an attacker sending
  very large keys can cause the server to allocate approximately
  64 MiB per open connection.

  Call stacks in your code:
      contrib/lock/storage/storage.go:106:28: go.etcd.io/etcd/v3/contrib/lock/storage.main calls net/http.ListenAndServe
      contrib/raftexample/httpapi.go:113:31: go.etcd.io/etcd/v3/contrib/raftexample.serveHTTPKVAPI$1 calls net/http.Server.ListenAndServe
      tools/etcd-dump-metrics/main.go:159:31: go.etcd.io/etcd/v3/tools/etcd-dump-metrics.main$4 calls go.etcd.io/etcd/server/v3/embed.StartEtcd, which eventually calls net/http.Serve
      tools/etcd-dump-metrics/main.go:159:31: go.etcd.io/etcd/v3/tools/etcd-dump-metrics.main$4 calls go.etcd.io/etcd/server/v3/embed.StartEtcd, which eventually calls net/http.Server.Serve

  Found in: net/http@go1.19.3
  Fixed in: net/http@go1.19.4
  More info: https://pkg.go.dev/vuln/GO-2022-1144

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-12-09 07:39:57 +08:00
Marek Siarkowicz 26bf2f81f5 tests: Add Txn operation to linearizability tests
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-12-08 23:57:42 +01:00
Marek Siarkowicz 60200b37d3 tests: Refactor etcd model
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-12-08 10:01:43 +01:00
Marek Siarkowicz 5ff9202027 tests: Refactor append failed requests
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-12-06 10:21:07 +01:00
Marek Siarkowicz 619ca4f5cf tests: Add comments explaning handling failed requests
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-12-06 10:11:22 +01:00
Marek Siarkowicz d8da98c49f tests: Fix return time for failed requests globally
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-12-06 10:11:22 +01:00
Marek Siarkowicz 45fdc2bbac tests: Extract history from client
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-12-06 10:11:22 +01:00
Marek Siarkowicz c5c2ea6aad tests: Enforce that revision doesn't skips without error
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-12-06 10:11:22 +01:00
Marek Siarkowicz fe6e42d411 tests: Improve tests by expending on scenarios
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-12-06 10:11:22 +01:00
Marek Siarkowicz 1d31e5e958 tests: Consider only latest failed request
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-12-06 10:11:22 +01:00
Marek Siarkowicz b922afc0a3 tests: Make etcdRequest and etcdResponse public to make it serializable
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-12-06 10:11:22 +01:00
Marek Siarkowicz 68fd863c87 tests: Mark failed requests as timed out
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-12-06 10:11:22 +01:00
Marek Siarkowicz 6a68141db5 tests: Allow dynamic number of clients
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-12-06 10:11:22 +01:00
Marek Siarkowicz 42bb543315
Merge pull request #14897 from serathius/linearizability-trigger-exit
Allow failpoint requests to fail assuming that process exists within 1 second
2022-12-06 09:31:21 +01:00
Marek Siarkowicz 2263315871
Merge pull request #14802 from geetasg/delete_api
linearizability tests - Add support for delete api
2022-12-06 09:30:59 +01:00
Marek Siarkowicz f2bc0823f6 tests: Make it explicit that we only suppurt panic failpoints
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-12-06 09:08:36 +01:00
Marek Siarkowicz 738ee3687a tests: Allow failpoint requests to fail assuming that process exists within 1 second
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-12-06 09:08:36 +01:00
Marek Siarkowicz a5cfc089fa tests: Refactor picking a member function
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-12-06 09:08:36 +01:00
Marek Siarkowicz 5baf8377bb
Merge pull request #14885 from serathius/linearizability-recreate-cluster
Linearizability recreate cluster
2022-12-05 12:16:00 +01:00
Piotr Tabor 40cc73c22e
Merge pull request #14889 from halegreen/fix-typo
test: fix typo
2022-12-04 16:33:35 +01:00
WangXiaoxiao f7f5474515 test:fix typo
Signed-off-by: WangXiaoxiao <1141195807@qq.com>
2022-12-04 21:11:12 +08:00
Marek Siarkowicz a573d8af69 tests: Use golang count to repeat tests
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-12-03 11:21:07 +01:00
Marek Siarkowicz 7f70b8cf76 tests: Separate retries count from failure trigger count
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-12-03 11:21:07 +01:00
Marek Siarkowicz df2d075e1a tests: Sleep between failpoint failure
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-12-03 11:21:07 +01:00
Marek Siarkowicz 11711fc007 tests: Recreate cluster for every failpoint trigger
This shortens operation history and avoids having to many failed requests.
Failed requests are problematic as too many of them can cause linearizability
verification complexity to become exponential.

Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-12-03 11:21:07 +01:00
Benjamin Wang 5503a9484a test: cleanup go.mod and go.sum files
Executed commands below,
1. Removed go.etcd.io/raft/v3 => ../raft;
2. go get go.etcd.io/raft/v3@eaa6808e1f7ab2247c13778250f70520b0527ff1;
3. go mod tidy

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-12-02 13:36:05 +08: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
Marek Siarkowicz ccf5d3c1af Cleanup comment
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-12-01 09:49:33 -08:00
Marek Siarkowicz eef1fb9246 Record delete request errors
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-12-01 09:49:22 -08:00
Geeta Gharpure 6be22d84ef Updated as per review feedback.
Signed-off-by: Geeta Gharpure <geetagh@amazon.com>
2022-12-01 09:39:26 -08:00
Geeta Gharpure de991a9f2d linearizability tests - Add support for delete api
Signed-off-by: Geeta Gharpure <geetagh@amazon.com>
2022-12-01 09:39:26 -08:00
Benjamin Wang 3f86db5e53 bump golang.org/x imports to address CVEs
Reference: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-32149

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-11-30 05:03:43 +08:00
Benjamin Wang 7b19ee6396 test: add integration test to cover the multiple member corruption case
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-11-26 19:35:38 +08:00
Benjamin Wang a3197102e9 test: rollback the change in PR pull/14824
The change did in https://github.com/etcd-io/etcd/pull/14824 fixed
the test instead of the product code. It isn't correct. After we
fixed the product code in this PR, we can revert the change in
that PR.

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-11-26 19:35:38 +08:00
Benjamin Wang 285e44378f bump github.com/stretchr/testify from v1.7.2 to v1.8.1
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-11-26 10:51:32 +08:00
Benjamin Wang cd15507c65 test: enhance case TestEndpointHashKV to check both hash and hashRevision
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-11-25 18:49:16 +08:00
Marek Siarkowicz f18ac02e0f
Merge pull request #14834 from fuweid/bump-grpc-1.51
bump grpc to v1.51.0 from v1.47.0
2022-11-24 09:07:56 +01:00
Bhargav Ravuri dbfe42bbd2 comments: fix comments as per goword in go _test pkg files
Comments fixed as per goword in go _test package files that
shell function go_srcs_in_module lists as per changes on #14827

Helps in #14827

Signed-off-by: Bhargav Ravuri <bhargav.ravuri@infracloud.io>
2022-11-24 00:03:00 +05:30
Bhargav Ravuri 2feec4fe68 comments: fix comments as per goword in go test files
Comments fixed as per goword in go test files that shell
function go_srcs_in_module lists as per changes on #14827

Helps in #14827

Signed-off-by: Bhargav Ravuri <bhargav.ravuri@infracloud.io>
2022-11-23 23:05:42 +05:30
Wei Fu cf285ea3c7 bump grpc to v1.51.0 from v1.47.0
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2022-11-23 22:16:22 +08:00
Marek Siarkowicz 51c0b4dff3
Merge pull request #14825 from clarkfw/EtcdProcessClusterConfig-antipattern-name
tests: fix anti-pattern name in `NewEtcdProcessCluster`
2022-11-23 15:11:36 +01:00
Andrew Sims f656fa0f49 add missing copyright headers
Signed-off-by: Andrew Sims <andrew.cameron.sims@gmail.com>
2022-11-23 19:13:43 +11:00
Clark b298c85a34 tests: fix anti-pattern name in `NewEtcdProcessCluster`
Signed-off-by: Clark <fwyongxing@gmail.com>
2022-11-23 00:32:10 +08:00
Wei Fu 0b30e83b1d tests/integration: deflake Corruption cases
If the corrupted member has been elected as leader, the memberID in alert
response won't be the corrupted one. It will be a smaller follower ID since
the raftCluster.Members always sorts by ID. We should check the leader
ID and decide to use which memberID.

Fixes: #14823

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2022-11-22 22:19:55 +08:00
Dirkjan Bussink c26dabacbd
release: build with consistent paths
This changes the builds to always add -trimpath which removes specific
build time paths from the binary (like current directories etc).

Improves build reproducability to make the final binary independent from
the specific build path.

Lastly, when stripping debug symbols, also add -w to strip DWARF symbols
as well which aren't needed in that case either.

Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com>
2022-11-21 15:06:11 +01:00
Benjamin Wang ebfcaaed34 test: fix the test failures in e2e/warning_logging_test.go
1. Fixed the test failures which are caused by recent test framework rafactoring;
2. renamed the file to promote_experimental_flag_test.go.

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-11-19 01:51:06 +08:00
Bogdan Kanivets 7e8ebf7727 server: added duplicate warning-unary-request-duration flag
--warning-unary-request-duration is a duplicate of --experimental-warning-unary-request-duration
experimental-warning-unary-request-duration will be removed in v3.7.

fixes https://github.com/etcd-io/etcd/issues/13783

Signed-off-by: Bogdan Kanivets <bkanivets@apple.com>
2022-11-18 18:06:00 +08:00
Benjamin Wang 6d8139dcea
Merge pull request #14788 from sashamelentyev/imports
all: goimports -w .
2022-11-18 09:03:43 +08:00
Benjamin Wang 2742bdc32a
Merge pull request #14752 from serathius/linearizability-raftBeforeLeaderSend
Linearizability raft before leader send
2022-11-18 08:56:11 +08:00
Sasha Melentyev c3b6cbdb73 all: goimports -w .
Signed-off-by: Sasha Melentyev <sasha@melentyev.io>
2022-11-17 19:07:04 +03:00
Marek Siarkowicz 9b3bfcdfeb
Merge pull request #14798 from tjungblu/fix_locking_tests
Fix TestCtlV3Lock/Elect flakes
2022-11-17 15:40:47 +01:00
Marek Siarkowicz 371179e292 tests: Trigger raftBeforeLeaderSend
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-11-17 14:17:16 +01:00
Thomas Jungblut eebfd15983 Fix TestCtlV3Lock/Elect flakes
waiting for a proper exit after a signal should ensure the goroutines
don't leak.

Signed-off-by: Thomas Jungblut <tjungblu@redhat.com>
2022-11-17 10:59:22 +01:00
Marek Siarkowicz bf3eea8831 tests: Allow creating client for EtcdProcess
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-11-17 10:48:14 +01:00
Benjamin Wang 0c1901466f test: add test case to cover the CommonName based authentication
Refer to https://github.com/etcd-io/etcd/issues/14764

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-11-16 18:34:34 +08:00
Benjamin Wang 585054e448 test: add certificate with root CommonName
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-11-16 18:31:53 +08:00
Clark 7180267d56 tests: refactor `EtcdProcessClusterConfig` with Functional Options Pattern
remove `cfg *EtcdProcessClusterConfig` param from `NewEtcdProcessCluster` function

Signed-off-by: Clark <fwyongxing@gmail.com>
2022-11-16 15:05:29 +08:00
Clark 9406de0033 tests: refactor `EtcdProcessClusterConfig` with Functional Options Pattern
replace all initialisations with `DefaultConfig`, `NewConfig` and `EPClusterOption`

Signed-off-by: Clark <fwyongxing@gmail.com>
2022-11-16 15:05:28 +08:00
Benjamin Wang 8438ddae3e
Merge pull request #14767 from sashamelentyev/print
all: Change Printf and friends to Print if there is no formatting
2022-11-16 10:38:20 +08:00
Sasha Melentyev 2c9c209eb6 all: Changing Printf and friends to Print if there is no formatting
Signed-off-by: Sasha Melentyev <sasha@melentyev.io>
2022-11-15 22:11:23 +03:00
Marek Siarkowicz 8ae4420c4c tests: Add compact failpoints
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-11-15 15:00:18 +01:00
Benjamin Wang 39ca876f38
Merge pull request #14757 from ahrtr/add_failpoint_20221115
etcdserver: add failpoints for backend
2022-11-15 17:14:14 +08:00
Benjamin Wang cf190fb5b0 test: apply backend failpoints into the linearizablity test
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-11-15 16:36:56 +08:00
Marek Siarkowicz f8162919f9
Merge pull request #14744 from clarkfw/functional-options-pattern-EtcdProcessClusterConfig-2-1
tests: refactor `EtcdProcessClusterConfig` using Functional Options Pattern
2022-11-15 09:27:24 +01:00
Benjamin Wang f49d96f8b7
Merge pull request #14756 from sashamelentyev/time
all: Change time unit
2022-11-15 15:54:30 +08:00
Benjamin Wang d62e018495
Merge pull request #14755 from serathius/linearizability-traffic
tests: Make linearizability traffic extendable
2022-11-15 09:11:40 +08:00
Sasha Melentyev 006e747a44 all: Change time unit
Signed-off-by: Sasha Melentyev <sasha@melentyev.io>
2022-11-15 01:15:01 +03:00
Marek Siarkowicz 2fc1485f29 tests: Make linearizability traffic extendable
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-11-14 23:14:10 +01:00
Sasha Melentyev 855aa4f7a7 all: Use ReplaceAll instead of Replace with -1 pos
Signed-off-by: Sasha Melentyev <sasha@melentyev.io>
2022-11-15 00:06:09 +03:00
Marek Siarkowicz ca8baeb308
Merge pull request #14685 from serathius/linearizability-revision
Revision inconsistency caused by panic during defrag
2022-11-14 12:49:22 +01:00
Marek Siarkowicz 77cd6a660f
Merge pull request #14742 from fuweid/deflake-issue-14694
tests/e2e: disable testShellCompletion if enable cov flag
2022-11-14 12:41:40 +01:00
Marek Siarkowicz ff6c93f630 tests: Add revision to etcd linearizability model
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-11-14 12:20:55 +01:00
Thomas Jungblut 5b163aa507 Expect exit code enhancement
ExpectProcess and ExpectFunc now take the exit code of the process into
account, not just the matching of the tty output.

This also refactors the many tests that were previously succeeding on
matching an output from a failing cmd execution.

Signed-off-by: Thomas Jungblut <tjungblu@redhat.com>
2022-11-14 11:19:41 +01:00
Wei Fu c2f27a0070 tests/e2e: disable testShellCompletion if enable cov flag
The etcdctl and etcdutl built with `-tags cov` mode will show go-test result
after each execution, like

```
...

PASS
coverage: 0.0% of statements in ./...
```

Since the PASS is not real command, the `source completion` command will
fail with command-not-found error. And there is no easy way to disable
the (*testing.M).Run's output. Therefore, this patch uses build tag !cov
to disable cases when enable coverage.

Fixes: #14694

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2022-11-14 17:58:18 +08:00
Benjamin Wang 2532ca84d1 test: add failpoints into linearizablity test for commitBeforePreCommitHook and commitAfterPreCommitHook
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-11-14 11:11:48 +08:00
Clark 3510680c32 tests: refactor `EtcdProcessClusterConfig` using Functional Options Pattern
replace some initialisations with `DefaultConfig`, `NewConfig` and `EPClusterOption`

Signed-off-by: Clark <fwyongxing@gmail.com>
2022-11-14 03:07:51 +08:00
Marek Siarkowicz d5a6d2518d tests: Optimize checking failed writes
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-11-13 13:36:21 +01:00
Clark caaeee2920 tests: refactor `EtcdProcessClusterConfig` with Functional Options Pattern
replace some initialisations with `DefaultConfig`, `NewConfig` and `EPClusterOption`

Signed-off-by: Clark <fwyongxing@gmail.com>
2022-11-13 00:27:41 +08:00
Benjamin Wang dbc7204610 test: Create a subdirectory for each member when DataDirPath is specified
When e2e test cases specify the DataDirPath and there are more than
one member in the cluster, we need to create a subdirectory for each
member. Otherwise all members share the same directory and accordingly
lead to conflict.

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-11-11 18:48:42 +08:00
Marek Siarkowicz 2f558ca0db
Merge pull request #14714 from serathius/linearizability-data-dir
tests: Preserve data dir from failed linearizability tests
2022-11-10 13:58:23 +01:00
Marek Siarkowicz 04caec5960 tests: Preserve data dir from failed linearizability tests
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-11-10 11:05:59 +01:00
Benjamin Wang 0bff3ade4d
Merge pull request #14704 from chenyahui/mutex_unlock_state
etcdclient: check mutex state in Unlock method of concurrency.Mutex
2022-11-10 10:38:03 +08:00
Marek Siarkowicz 0d4a516d11
Merge pull request #14710 from tjungblu/downgrade_binary
Take binary version in Downgrade/Upgrade Test
2022-11-09 13:44:15 +01:00
Thomas Jungblut 0daf153b4f Take binary version in Downgrade/Upgrade Test
This fix avoids the assumption of knowing the current version of the
binary. We can query the binary with the version flag to get the actual
version of the given binary we upgrade and downgrade to. The
respectively reported versions should match what is returned by the
version endpoint.

Signed-off-by: Thomas Jungblut <tjungblu@redhat.com>
2022-11-09 10:41:07 +01:00
Benjamin Wang b32cd938b3 test: add mix versions sending snapshot test
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-11-09 16:04:22 +08:00
Benjamin Wang 080effc935 test: enhance StartNewProc to accept one more parameter: EtcdProcessClusterConfig
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-11-09 16:04:22 +08:00
Clark 269a0beb41 tests: refactor `EtcdProcessClusterConfig` with Functional Options Pattern
add `DefaultConfig`, `NewConfig` and `EPClusterOption`

Signed-off-by: Clark <fwyongxing@gmail.com>
2022-11-09 03:37:42 +08:00
chenyahui 5b8c6b548f etcdclient: check mutex state in Unlock method of concurrency.Mutex
Check the values of myKey and myRev first in Unlock method to prevent calling Unlock without Lock. Because this may cause the value of pfx to be deleted by mistake.

Signed-off-by: chenyahui <cyhone@qq.com>
2022-11-08 22:24:52 +08:00
Marek Siarkowicz 554b1bd0b0
Merge pull request #14687 from serathius/random-failpoint
tests: Add triggering random go failpoints to linearizability tests
2022-11-07 20:59:39 +01:00
Benjamin Wang 757cf33c00 test: update e2e test cases to use e2e specfic configuration from e2e package
Afer moving `ClusterVersion` and related constants into e2e packages,
some e2e test cases are broken, so we need to update them to use the
correct definitions.

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-11-07 10:25:04 +08:00
Benjamin Wang 86e71f026e test: update the definition of testRunner and clusterTestCases
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-11-07 10:18:51 +08:00
Benjamin Wang fc23d0e83a test: add ClusterContext into the common ClusterConfig
ClusterContext is used by "e2e" or "integration" to extend the
ClusterConfig. The common test cases shouldn't care about what
data is encoded or included; instead "e2e" or "integration"
framework should decode or parse it separately.

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-11-07 10:05:45 +08:00
Marek Siarkowicz 71b40b3abf tests: Extend common test to run previous release
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-11-07 06:51:59 +08:00
Marek Siarkowicz 219278b298 tests: Add triggering random go failpoints to linearizability tests
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-11-06 15:56:28 +01:00
Benjamin Wang c00ede393f test: fix pipeline errors due to PRs conflict
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-11-06 06:28:51 +08:00
Hitoshi Mitake 49db50c117
Merge pull request #14663 from ahrtr/auth_20221031
auth: check permission when performing maintainenence operations if auth is enabled
2022-11-05 23:13:29 +09:00
Benjamin Wang d71762f4f0
Merge pull request #14683 from ahrtr/test_framework_20221104
test: refactor the framework structure to make it clearer
2022-11-05 04:30:59 +08:00
Benjamin Wang dc0273b049 test: refactor the struct to make it clearer
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-11-04 19:28:32 +08:00
Marek Siarkowicz e614eec948
Merge pull request #14560 from serathius/env
tests: Pass only etcd related environment variables during e2e tests
2022-11-04 11:24:07 +01:00
Benjamin Wang f782891246 test: added auth test on maintenance API
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-11-03 04:39:42 +08:00
Benjamin Wang 1791ab5754 test: add common functions for auth test
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-11-03 04:39:42 +08:00
Wei Fu 3ddcb3ddef test: deflake TestDowngradeUpgradeClusterOf3 timeout
In the TestDowngradeUpgradeCluster case, the brand-new cluster is using
simple-config-changer, which means that entries has been committed
before leader election and these entries will be applied when etcdserver
starts to receive apply-requests. The simple-config-changer will mark
the `confState` dirty and the storage backend precommit hook will update
the `confState`.

For the new cluster, the storage version is nil at the beginning. And
it will be v3.5 if the `confState` record has been committed. And it
will be >v3.5 if the `storageVersion` record has been committed.

When the new cluster is ready, the leader will set init cluster version
with v3.6.x. And then it will trigger the `monitorStorageVersion` to
update the `storageVersion` to v3.6.x. If the `confState` record has
been updated before cluster version update, we will get storageVersion
record.

If the storage backend doesn't commit in time, the
`monitorStorageVersion` won't update the version because of `cannot
detect storage schema version: missing confstate information`.

And then we file the downgrade request before next round of
`monitorStorageVersion`(per 4 second), the cluster version will be
v3.5.0 which is equal to the `UnsafeDetectSchemaVersion`'s result.
And we won't see that `The server is ready to downgrade`.

It is easy to reproduce the issue if you use cpuset or taskset to limit
in two cpus.

So, we should wait for the new cluster's storage ready before downgrade
request.

Fixes: #14540

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2022-11-02 22:50:31 +08:00
Benjamin Wang 94e0c2410b bump go version to 1.19.3 to address security fixes
FYI. https://groups.google.com/g/golang-announce/c/dRtDK7WS78g

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-11-02 09:07:22 +08:00
spacewander e73a25a1d0 ci: ensure the generated code is up-to-date
See https://github.com/etcd-io/etcd/pull/14612#issue-1419792069
Signed-off-by: spacewander <spacewanderlzx@gmail.com>
2022-10-31 19:58:21 +08:00
Benjamin Wang 5073af6521
Merge pull request #14660 from clarkfw/new-cluster-accept-configuration-as-options
tests: TestRunner.NewCluster accepts options
2022-10-31 19:15:23 +08:00
Clark fa9ee5cce9 tests: TestRunner.NewCluster accepts options
Signed-off-by: Clark <fwyongxing@gmail.com>
2022-10-31 15:26:08 +08:00
Benjamin Wang a1018dbddf
Merge pull request #14604 from ahrtr/double_barrier
clientv3: fix the implementation of double barrier
2022-10-31 08:13:12 +08:00
Benjamin Wang d1f7136a50
Merge pull request #14621 from ahrtr/functional_test_20221025
test: terminate functional test on failure and code cleanup
2022-10-31 07:42:29 +08:00
vivekpatani 680310a6c9 *: bump to go1.19.2 from 1.19.1
- update .github workflows
- update tests

Signed-off-by: vivekpatani <9080894+vivekpatani@users.noreply.github.com>
2022-10-27 18:45:02 -07:00
Oleg Guba fbed8cb645 etcdserver: call refreshRangePermCache on Recover() in AuthStore
Signed-off-by: Oleg Guba <oleg@dropbox.com>
2022-10-27 15:05:05 -07:00
Oleg Guba b22e3ff4eb Allow passing client options to Client()
Signed-off-by: Oleg Guba <oleg@dropbox.com>
2022-10-27 14:08:23 -07:00
Marek Siarkowicz c45f3388ac
Merge pull request #14632 from clarkfw/functional-options-pattern-of-cluster-config
tests: add a ClusterOption interface for ClusterSize in config.Cluster
2022-10-27 16:29:57 +02:00
Oleg Guba 47c558e605 [e2e] don't pass --endpoints flag in test HashKV implementation
Signed-off-by: Oleg Guba <oleg@dropbox.com>
2022-10-27 02:02:58 -07:00
Clark e28b66f751 tests: add a ClusterOption interface for ClusterSize in config.ClusterConfig
Signed-off-by: Clark <fwyongxing@gmail.com>
2022-10-26 23:41:09 +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 5550041633
Merge pull request #14629 from clarkfw/fix-anti-pattern-naming
test: fix anti-pattern naming problem in config.ClusterConfig
2022-10-26 20:01:43 +08:00
Clark 08284c56e0 test: fix anti-pattern naming problem in config.ClusterConfig
Signed-off-by: Clark <fwyongxing@gmail.com>
2022-10-26 15:47:19 +08:00
Benjamin Wang 42cfb74b4c test: define a default WithAuth to resolve error Unresolved reference 'WithAuth' from IDE
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-10-26 14:30:47 +08:00
Marek Siarkowicz 8ce81a1624
Merge pull request #14611 from serathius/issue14370
tests: Add linearizability tests scenario for #14370
2022-10-25 14:03:39 +02:00
Benjamin Wang 36cbd6aff3 test: terminate functional test on failure
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-10-25 17:15:11 +08:00
Benjamin Wang 3ee2f5711e test: add common function "WithAuth"
We defines two common `WithAuth` functions for e2e and integration
test respectively. They are calling `integration.WithAuth` and
`e2e.WithAuth` respectively.

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-10-25 02:41:49 +08:00
Marek Siarkowicz 837819860b tests: Add linearizability tests scenario for #14370
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-10-24 13:36:12 +02: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 e5790d204c
Merge pull request #14398 from serathius/linearizability
Validate etcd linearizability
2022-10-23 12:09:30 +02:00
Marek Siarkowicz 069e26e284 tests: Validate etcd linearizability
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-10-23 06:41:38 +02:00
Benjamin Wang 61c8888440
Merge pull request #14602 from ahrtr/enhance_functional_test_20221020
functional_test: code cleanup and minor enhancements
2022-10-23 11:00:25 +08:00
Benjamin Wang 3b4c255444
Merge pull request #14608 from veshij/auth
[e2e] Fix AuthEnable/Disable e2e test implementations
2022-10-22 08:19:05 +08:00
Oleg Guba 44bc007494 Update tests/framework/e2e/etcdctl.go
address comment

Co-authored-by: Benjamin Wang <wachao@vmware.com>
Signed-off-by: Oleg Guba <oleg@dropbox.com>
2022-10-21 10:44:09 -07:00
Oleg Guba 24831a0242 Update tests/framework/e2e/etcdctl.go
address comment

Co-authored-by: Benjamin Wang <wachao@vmware.com>
Signed-off-by: Oleg Guba <oleg@dropbox.com>
2022-10-21 10:44:09 -07:00
Oleg Guba a39374f33a [e2e] Fix AuthEnable/Disable e2e test implementations
Signed-off-by: Oleg Guba <oleg@dropbox.com>
2022-10-20 19:15:31 -04:00
Benjamin Wang b5751636e3
Merge pull request #14607 from veshij/hashkv
[e2e] Fix bug in EtcdctlV3.HashKV() e2e implementation.
2022-10-21 06:02:01 +08:00
Oleg Guba a466d5cc2e [e2e] Fix bug in EtcdctlV3.HashKV()
Signed-off-by: Oleg Guba <oleg@dropbox.com>
2022-10-20 17:37:16 -04:00
Benjamin Wang 62167d1f1f clientv3: fix the design & implementation of double barrier
Check the client count before creating the ephemeral key, do not
create the key if there are already too many clients. Check the
count after creating the key again, if the total kvs is bigger
than the expected count, then check the rev of the current key,
and take action accordingly based on its rev. If its rev is in
the first ${count}, then it's valid client, otherwise, it should
fail.

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-10-20 16:24:20 +08:00
Benjamin Wang bbda1daecf functional_test: code cleanup and minor enhancements
Cleaned up some useless or dead code;
Remove some unnecessary methods.

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-10-20 10:35:30 +08:00
Marek Siarkowicz 1b3f301cc2 tests: Share SpawnCmdWithLogger between coverage and no coverage scenarios
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-10-17 14:10:11 +02:00
Marek Siarkowicz 574b3d33d1 test: Remove BinDir global variable
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-10-17 14:09:51 +02:00
Marek Siarkowicz 9bba38e51f tests: Include etcd-last-release in BinPath
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-10-17 14:09:51 +02:00
Marek Siarkowicz 0f9e15fc37 test: Remove accessing etcd via BinDir
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-10-17 14:09:51 +02:00
Marek Siarkowicz 89a1e7978c tests: Configure coverage binary paths via init
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-10-17 14:09:51 +02:00
Marek Siarkowicz d3b9951126 tests: Refactor BinPath into struct
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-10-17 14:09:49 +02:00
Marek Siarkowicz de0efc9aa4 tests: Move global e2e configuration into one file
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-10-17 14:09:28 +02: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
Benjamin Wang bf6a1d7264
Merge pull request #14591 from ZoeShaw101/dev
Tests: Check Watch response error not nil to avoid runtime panic.
2022-10-16 17:00:18 +08:00
王霄霄 2751ec6479 integration: check Watch response error not nil to avoid runtime panic.
Fixes issue: #14259

Signed-off-by: 王霄霄 <1141195807@qq.com>
2022-10-16 11:41:11 +08:00
Benjamin Wang 24ad49091e test: resolve review comment for the feature of dynamically adding new member
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-10-15 06:09:58 +08:00
Vitalii Levitskii 11e23f1ef7 Added member interaction into EtcdProcessCluster
Rebased this PR. There is no response from the original author,
so Benjamin (ahrtr@) continue to work on this PR.

Signed-off-by: Vitalii Levitskii <vitalii@uber.com>
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-10-15 05:53:07 +08: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
Benjamin Wang a5fb57b485
Merge pull request #14586 from serathius/pattern
tests: Use bash like patterns in TestAuthority instead of string fo…
2022-10-14 06:11:36 +08:00
Marek Siarkowicz fdce1b38fb tests: Use bash like patterns in TestAuthority instead of string formating
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-10-13 16:45:27 +02:00
Marek Siarkowicz 81bd3fb9f9 tests: Pass only etcd related environment variables during e2e tests
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-10-13 16:44:22 +02:00
Benjamin Wang 78380ae6b8 functional-test: move the check on log-outputs out of the 'if clientTLS' branch
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-10-13 16:33:02 +08:00
Benjamin Wang b48641e5f2
Merge pull request #14348 from VinozzZ/add-integration-test-for-tracing
embed: add integration test for distributed tracing
2022-10-13 02:11:59 +08:00
Benjamin Wang 328a33668b functional_test: stop etcd and cleanup data when test is successful
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-10-09 09:23:13 +08:00
Benjamin Wang 742c925a27
Merge pull request #14387 from lavacat/main-functional
functional: remove SIGQUIT_ETCD_AND_REMOVE_DATA_AND_STOP_AGENT command
2022-10-09 08:25:25 +08:00
Marek Siarkowicz 510f26e34c Remove mention of ETCDCTL_API environment variable as it was removed on main branch
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-10-07 21:22:06 +02:00
Wei Fu b15f6bf978 integration: deflaking TestMaintenanceSnapshotCancel/Timeout
Since http2 spec defines the receive windows's size and max size of
frame in the stream, the underlayer - gRPC client can pre-read data
from server even if the application layer hasn't read it yet.

And the initialized cluster has 20KiB snapshot, which can be pre-read
by underlayer. We should increase the snapshot's size, just in case
that the io.Copy won't return the canceled or timeout error.

Fixes: #14477

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2022-10-06 11:03:51 +08: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
Kafuu Chino f1d4935e91 *: avoid closing a watch with ID 0 incorrectly
Signed-off-by: Kafuu Chino <KafuuChinoQ@gmail.com>

add test
2022-09-26 20:30:33 +08:00
Benjamin Wang 7f10dccbaf Bump go 1.19: update all the dependencies and go.sum files
1. run ./scripts/fix.sh;
2. cd tools/mod; gofmt -w . & go mod tidy;

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-09-22 08:47:46 +08:00
Benjamin Wang cb5f7276c3 Bump go 1.19: upgrade go version to 1.19.1 in the pipeline
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-09-22 08:47:46 +08:00
Benjamin Wang cd0b1d0c66 Bump go 1.19: upgrade go version to 1.19 in all go.mod files
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-09-22 08:47:46 +08:00
Marek Siarkowicz 026794495f
Merge pull request #14494 from demoManito/remove/redundant-type-conversion
etcd: remove redundant type conversion
2022-09-21 11:34:19 +02:00
Benjamin Wang 2441a24cee
Merge pull request #14493 from demoManito/style/format-import-order
etcd: format import order
2022-09-21 06:03:31 +08:00
demoManito f67ec10779 etcd: format import order
golang CodeReviewComments:
https://github.com/golang/go/wiki/CodeReviewComments#imports

Signed-off-by: demoManito <1430482733@qq.com>
2022-09-20 18:41:39 +08:00
Benjamin Wang c113f93d79
Merge pull request #14482 from fuweid/testing-curl-maxstream
e2e: make maxstream test stable
2022-09-20 12:30:10 +08:00
demoManito a9c3d56508 etcd: remove redundant type conversion
Signed-off-by: demoManito <1430482733@qq.com>
2022-09-20 11:26:02 +08:00
Wei Fu 16884373b9 e2e: submitConcurrentWatch runs with ExecuteWithTimeout
Use testutils.ExecuteWithTimeout to make sure that the all active
streams are ready in time.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2022-09-20 11:03:51 +08:00
Wei Fu ec847337d7 e2e: make maxstream test stable
submitConcurrentWatch use sleep 3s to wait for all the watch connections
ready. When the number of connections increases, like 1000, the 3s is not
enough and the test case becomes flaky.

In this commit, spawn curl process and check the ouput line with
`created":true}}` to make sure that the connection has been initialized
and ready to receive the events. It is reliable to test the following
range request.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2022-09-20 10:41:59 +08:00
Benjamin Wang 5344085338
Merge pull request #14491 from ahrtr/bump_jwt_4.4.2
etcd: Bump golang-jwt/jwt/ version to 4.4.2
2022-09-20 10:18:44 +08:00
Sahdev Zala ad4a465383
Merge pull request #14492 from cmurphy/bump-golang-x-net
*: Update golang.org/x/net to latest
2022-09-19 22:11:43 -04:00
Colleen Murphy 7ea2a3d7cb *: Update golang.org/x/net to latest
Update golang.org/x/net to address CVE-2022-27664.

Signed-off-by: Colleen Murphy <colleen.murphy@suse.com>
2022-09-19 16:01:45 -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
Benjamin Wang 09db6ec1d7 etcd: Bump golang-jwt/jwt/ version to 4.4.2
github.com/golang-jwt/jwt adds go mod support startig from 4.0.0,
and it's backwards-compatible with existing v3.x.y tags.

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-09-20 04:06:47 +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
Benjamin Wang d657f2f66b Test: increase the TestKVDelete's timeout to 15s
Sometimes it just needs more time to execute the test case,
so increase the timeout from 10s to 15s.

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-09-18 04:26:30 +08: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
Sahdev Zala cdf4228673
Merge pull request #14308 from dusk125/main
server/etcdmain: add configurable cipher list to gRPC proxy listener
2022-09-16 12:15:08 -04:00
demoManito 5b26fc0101 fix test
Signed-off-by: demoManito <1430482733@qq.com>
2022-09-16 17:08:29 +08: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
Bogdan Kanivets c31d758189 functional: remove SIGQUIT_ETCD_AND_REMOVE_DATA_AND_STOP_AGENT command
Problem: both SIGQUIT_ETCD_AND_REMOVE_DATA_AND_STOP_AGENT and test.sh
will attempt to stop agents and remove directories.

Solution: since test.sh creates directories and starts test, it should be
responsible for cleanup.

See https://github.com/etcd-io/etcd/issues/14384

Signed-off-by: Bogdan Kanivets <bkanivets@apple.com>
2022-09-15 10:55:32 -07:00
Marek Siarkowicz b5bbf04503
Merge pull request #14460 from ahrtr/fix_TestV3AuthRestartMember_20220913
Integration_test: fix the flaky test TestV3AuthRestartMember
2022-09-14 09:44:15 +02: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
Marek Siarkowicz 157ee32da4 test: Clean incorrectly used StopSignal field from expect
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-09-13 15:22:45 +02:00
Marek Siarkowicz 92d8d7f41e
Merge pull request #14445 from tjungblu/movelead_main
etcdctl: fix move-leader for multiple endpoints
2022-09-09 11:20:33 +02:00
Thomas Jungblut 3fc16608f7 etcdctl: fix move-leader for multiple endpoints
Due to a duplicate call of clientConfigFromCmd, the move-leader command
would fail with "conflicting environment variable is shadowed by corresponding command-line flag".
Also in scenarios where no command-line flag was supplied.

Signed-off-by: Thomas Jungblut <tjungblu@redhat.com>
2022-09-09 10:38:13 +02:00
Clark 6a5dd09fe6 tests: Migrate member remove tests to common framework
Signed-off-by: Clark <fwyongxing@gmail.com>
2022-09-09 15:09:10 +08:00
Yingrong Zhao 57206f9dfb shutdown tracer provider first
Signed-off-by: Yingrong Zhao <yingrong.zhao@gmail.com>
2022-09-06 11:26:31 -04:00
Marek Siarkowicz f0c95cadea
Merge pull request #14281 from clarkfw/migrate-member-add-tests
tests: Migrate member add tests to common framework
2022-09-06 09:27:28 +02:00
Clark fcc076fb78 tests: Migrate member add tests to common framework
Signed-off-by: Clark <fwyongxing@gmail.com>
2022-09-06 11:02:54 +08:00
Benjamin Wang cc840336f0 move consistent_index forward when executing alarmList operation
The alarm list is the only exception that doesn't move consistent_index
forward. The reproduction steps are as simple as,

```
etcd --snapshot-count=5 &
for i in {1..6}; do etcdctl  alarm list; done
kill -9 <etcd_pid>
etcd
```

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-09-05 10:05:55 +08:00
Clark 3f3149b15f tests: fix failed integration test cases after enabling `--strict-reconfig-check` by default
Signed-off-by: Clark <fwyongxing@gmail.com>
2022-09-03 15:56:51 +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
Benjamin Wang e1c5d2a9ac fix test code compiling error due to not enough arguments in call to node0.Restart
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-08-30 13:15:04 +08:00
Piotr Tabor de41f83343
Merge pull request #14383 from serathius/context-e2e
tests: Add context to e2e cluster start
2022-08-29 21:12:12 +02:00
Allen Ray c52108942b
Merge branch 'main' into main 2022-08-29 12:07:27 -04:00
Benjamin Wang fdf22b241a add the missing parameter 'name' into SpawnCmdWithLogger for cov test
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-08-29 13:37:23 +08:00
Hitoshi Mitake 9c8326bb50
Merge pull request #14358 from vivekpatani/main
server/auth: refresh cache on each NewAuthStore
2022-08-27 11:13:59 +09:00
Benjamin Wang dc4b810195
Merge pull request #14388 from niconorsk/fix/notify-systemd-when-cluster-ready-times-out
etcdmain: Honour ExperimentalWaitClusterReadyTimeout in startEtcd
2022-08-26 18:34:52 +08:00
Nicolai Moore e15bdd9df1 etcdmain: Honour ExperimentalWaitClusterReadyTimeout in startEtcd
When we can't reach quorum, we were waiting forever and never sending
the systemd notify message. As a result, systemd would eventually time out
and restart the etcd process which likely would make the unhealthy cluster
in an even worse state

Improves #13785

Signed-off-by: Nicolai Moore <niconorsk@gmail.com>
2022-08-26 18:06:50 +10:00
Benjamin Wang f00578c3cd
Merge pull request #14389 from ahrtr/cleanup_e2e_fields
Cleanup some e2e test configurations
2022-08-26 15:05:53 +08:00
Marek Siarkowicz 70de5c8937 tests: Add context to e2e cluster start
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-08-26 08:08:17 +02:00
Benjamin Wang 17b83ea810 Cleanup some e2e test configurations
Notes:
1. compactPhysical in ctlCtx and withQuota aren't used at all, they are dead code.
2. quotaBackendBytes in ctlCtx isn't used either. Instead, users (test cases) set the QuotaBackendBytes directly.

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-08-26 13:53:33 +08:00
Marek Siarkowicz 46fe4b8e1c tests: Rename common client lease methods to match
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-08-26 07:12:47 +02:00
Marek Siarkowicz b7272df69f tests: Remove dummy client implementations
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-08-26 07:12:47 +02:00
Marek Siarkowicz 72bec6fbc2 tests: Add context to common client interface
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-08-26 07:12:45 +02:00
Benjamin Wang e40828540c
Merge pull request #14354 from biosvs/add-client-auto-sync-to-proxy
Added client-auto-sync-interval argument to the grpc-proxy
2022-08-26 05:36:01 +08:00
Vitalii Levitskii be58a2539c Added client-auto-sync-interval argument to the grpc-proxy
Signed-off-by: Vitalii Levitskii <vitalii@uber.com>
2022-08-25 15:33:38 +03:00
Marek Siarkowicz f36a8782f0
Merge pull request #14345 from nic-chen/tests/watch
tests: Migrate watch test to common framework
2022-08-25 13:35:34 +02:00
Marek Siarkowicz 7086a06490
Merge pull request #14377 from tjungblu/flake_14333
Add ErrTimeoutDueToLeaderFail as expected error
2022-08-25 10:04:53 +02:00
Benjamin Wang 82bf79d4ce
Merge pull request #14376 from biosvs/fix-expect-package
Fixed infinite loop in ExpectProcess.ExpectFunc
2022-08-25 05:29:30 +08:00
Vitalii Levitskii 71c5360f98 Fixed infinite loop in ExpectProcess.ExpectFunc
Signed-off-by: Vitalii Levitskii <vitalii@uber.com>
2022-08-24 16:46:24 +03:00
Thomas Jungblut e1e92e9c0d Add ErrTimeoutDueToLeaderFail as expected error
This fixes ci flakes where timeouts are expected to happen in network
partitions.
issue: #14333

Signed-off-by: Thomas Jungblut <tjungblu@redhat.com>
2022-08-24 13:56:45 +02:00
vivekpatani ae608da7e6 server,test: refresh cache on each NewAuthStore
- permissions were incorrectly loaded on restarts.
- https://github.com/etcd-io/etcd/issues/14355

Signed-off-by: vivekpatani <9080894+vivekpatani@users.noreply.github.com>
2022-08-23 20:11:47 -07:00
nic-chen f6ed36372b tests: Migrate watch test to common framework
Signed-off-by: nic-chen <chenjunxu6@gmail.com>
2022-08-22 21:55:57 +08:00
Sahdev Zala 192d635da9
Merge pull request #14292 from tjungblu/debug_e2e
Add test name to e2e cluster members
2022-08-20 19:30:44 -04:00
Benjamin Wang d8ee37641d Cleanup all etcd-agent and etcd processes when the test finishes
There are two cases, when interrupted by users, then forcibly kill
all processes. Otherwise, gracefully terminate all processes.

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-08-18 17:15:39 +08:00
Benjamin Wang 2f51d3d9b7 improve the performance of starting functional test
The proxy must be waiting for the etcd to be running, but the current
implementation hard codes the wating time as 5 seconds. The improvement
is to dynamically check whether the etcd is running, and start the
proxy when etcd port is reachable.

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-08-18 04:18:11 +08:00
Sam Batschelet 76a5902efa server/etcdmain: add configurable cipher list to gRPC proxy listener
Signed-off-by: Allen Ray <alray@redhat.com>
2022-08-17 10:56:27 -04:00
Yingrong Zhao ea2f299ba0 embed: add integration test for distributed tracing
To verify distributed tracing feature is correctly setup, this PR adds
an integration test for this feature.
In the process of writing the test, I discovered a goroutine leak due to
the TraceProvider not being closed. This PR fixs this issue as well.

Signed-off-by: Yingrong Zhao <yingrong.zhao@gmail.com>
2022-08-15 11:19:10 -04:00
Benjamin Wang bba4eb4d81 Improve functional test code
Get duplicated code wraped in common functions, and simplify
error handling.

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-08-15 16:59:39 +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
Clark 7fa88fb8f7 tests: fix status responses size and nil
Signed-off-by: Clark <fwyongxing@gmail.com>
2022-08-03 03:10:45 +08:00
Thomas Jungblut 51933a7c8b Add test name to e2e cluster members
This should aid in debugging test flakes, especially in tests where the process is restarted very often and thus changes its pid.
Now it's a lot easier to grep for different members, also when different tests fail at the same time.
The test TestDowngradeUpgradeClusterOf3 as mentioned in #13167 is a good example for that.

Signed-off-by: Thomas Jungblut <tjungblu@redhat.com>
2022-08-01 15:57:16 +02:00
Benjamin Wang 68c0cf834a
Merge pull request #14288 from VladSaioc/bugfix-goleak-watchtest
Fixed goroutine leak in tests/integration/clientv3/watch_test.go
2022-08-01 06:55:57 +08:00
Benjamin Wang 9e9e500d57
Merge pull request #14287 from VladSaioc/bugfix-queue-test
Fixed goroutine leak
2022-08-01 06:52:40 +08:00
VladSaioc 2c89834608 Fixed goroutine leak in tests/integration/v3_watch_restore_test.go
Signed-off-by: VladSaioc <vladsaioc10@gmail.com>
2022-07-31 23:28:26 +02:00
VladSaioc cbfddfe63f Fixed goroutine leak in tests/integration/clientv3/watch_test.go
Signed-off-by: VladSaioc <vladsaioc10@gmail.com>
2022-07-31 23:09:50 +02:00
VladSaioc 3a775201c0 Fixed goroutine leak
Signed-off-by: VladSaioc <vladsaioc10@gmail.com>
2022-07-31 22:19:59 +02:00
Benjamin Wang 37e4193c60
Merge pull request #14272 from serathius/memberID
memberID equals zero in corruption alarm
2022-07-27 06:32:52 +08:00
Clark 13d20f8d28 tests: Migrate member list tests to common framework
Signed-off-by: Clark <fwyongxing@gmail.com>
2022-07-26 23:28:19 +08:00
Marek Siarkowicz bb7e4653c8 tests: Fix member id in CORRUPT alarm
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-07-26 15:55:22 +02:00
Marek Siarkowicz d44bbff278 server: Make corrtuption check optional and period configurable
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-07-26 09:31:15 +02:00
Marek Siarkowicz 6697fca97d server: Implement compaction hash checking
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-07-26 09:31:14 +02:00
Marek Siarkowicz f0f750f4c0 tests: Cover periodic check in tests
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-07-25 13:59:31 +02:00
Marek Siarkowicz 264498258b tests: Move CorruptBBolt to testutil
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-07-25 13:59:30 +02:00
Marek Siarkowicz 99b982e71a tests: Rename corruptHash to CorruptBBolt
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-07-25 13:28:30 +02:00
Benjamin Wang 1a6fe4dbc6 update the comment for MaxConcurrentStreams to clearly state it's the max value for each client.
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-07-07 04:51:20 +08:00
Benjamin Wang f40b676701 add e2e test cases to cover the maxConcurrentStreams
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-07-06 03:43:46 +08:00
Benjamin Wang ae9ca48a3f remove duplicate certificate configuration for proxy test
The issue was introduced in the following commit,
093282f5ea

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-06-30 10:26:36 +08:00
chavacava f220bfe1e0 fix #14162
Signed-off-by: chavacava <salvadorcavadini+github@gmail.com>
2022-06-26 11:44:11 +02:00
Mikel Olasagasti Uranga 89637a4223 Tools/benchmark: migrate cheggaaa/pb.v1 to cheggaaa/pb/v3
etcdctl/ctlv3: migrate cheggaaa/pb.v1 to cheggaaa/pb/v3

This commit also changes the format of the progress bar, from using a
custom progress bar to the default provided by the library.

Old behaviour:

./benchmarkv1  put
 0 / 10000 B                                                   !   0.00%
 3987 / 10000 Boooooooooooooom                                 !  39.87%
 10000 / 10000 Boooooooooooooooooooooooooooooooooooooooooooo! 100.00% 1s

New behaviour:

./benchmark put
 6536 / 10000 [----------------------->________________] 65.36% 7053 p/s
10000 / 10000 [---------------------------------------] 100.00% 7581 p/s

Signed-off-by: Mikel Olasagasti Uranga <mikel@olasagasti.info>
2022-06-20 15:47:23 +02:00
Piotr Tabor 88cd0fe695 Refresh minor dependencies.
Signed-off-by: Piotr Tabor <ptab@google.com>
2022-06-17 10:23:03 +02:00
Piotr Tabor e7a84b69c8 Update zap to 1.21.
Signed-off-by: Piotr Tabor <ptab@google.com>
2022-06-17 10:05:25 +02:00
Piotr Tabor 8ac23dad88
Merge pull request #14125 from ptabor/20220615-update-grpc2
Update to grpc-1.47 (and fix the connection-string format)
2022-06-17 10:04:11 +02:00
Piotr Tabor 17c1dcd614 Update grpc to 1.47 and go-cmp to 0.5.8.
Signed-off-by: Piotr Tabor <ptab@google.com>
2022-06-17 08:57:22 +02:00
Benjamin Wang 8038e876d3 replace ioutil with os package
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-06-17 10:11:30 +08:00
Marek Siarkowicz 2c12954158
Merge pull request #14049 from serathius/compact-hash
Calculate hash during compaction
2022-06-14 11:10:19 +02:00
Marek Siarkowicz 9612fc1194 tests: Unify TestCompactionHash and extend it to also Delete keys and Defrag
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-06-13 18:20:19 +02:00
Marek Siarkowicz f5eadf5452 tests: Add tests for HashByRev HTTP API
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-06-13 18:20:19 +02:00
Marek Siarkowicz 1581eef888 tests: Add integration tests for compact hash
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-06-13 18:20:19 +02:00
Benjamin Wang 5f8cd5bd39 Replace all etcd versions with the centralized definitions
We have already defined all the constant etcd versions in the
centralized place api/version/version.go. So we should replace all
the versions with the centralized definitions.
2022-06-13 14:08:39 +08:00
Piotr Tabor 5097b33ab9 Rename etcdserver/etcderrors package to etcdserver/errors. 2022-05-20 14:32:04 +02:00
Piotr Tabor fc6a6c3c27 Move etcdserver/errors.go to sepatate package to avoid cyclic dependencies. 2022-05-20 14:32:04 +02: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 ee08770bfb tests: Make common framework context aware 2022-05-16 14:35:44 +02:00
Benjamin Wang 29f090b5c0
Merge pull request #14029 from serathius/spawn-json-command
tests: Refactor spawn json command
2022-05-14 05:06:03 +08:00
Marek Siarkowicz 83a4309f3b tests: Refactor spawn json command 2022-05-13 15:04:45 +02:00
Marek Siarkowicz 9beb29916e tests: Extract cluster test cases 2022-05-13 14:41:53 +02:00
ahrtr 1e6163ba27 remove v2 http proxy in 3.6 2022-05-13 17:44:58 +08:00
Vimal Kumar 55f0c96fa0 tests: Migrate Txn tests to common functional test framework 2022-05-11 10:33:47 +05:30
Marek Siarkowicz 066e510731
Merge pull request #14020 from chaochn47/role_test
migrate e2e & integration role_test to common
2022-05-10 23:39:14 +02:00
Chao Chen e004c91d36 migrate e2e & integration role_test to common 2022-05-10 10:17:16 -07:00
Marek Siarkowicz e292e5b0b4 tests: Apply suggestions from code-review 2022-05-06 12:09:44 +02:00
Marek Siarkowicz a65f7da5cb server: Implement HA downgrade test 2022-05-06 12:09:44 +02:00
Marek Siarkowicz c50fbb9ad6 tests: Retry validating version during downgrades 2022-05-06 12:09:44 +02:00
Marek Siarkowicz c9af75dd8d tests: Improve logging in downgrade tests 2022-05-06 12:09:43 +02:00
Marek Siarkowicz 7b04674d17 server: Move fatal calls out of internal function to make stacktrace cleaner 2022-05-06 12:09:43 +02:00
Marek Siarkowicz 75449c075d tests: Allow sepecting member to in curl commands 2022-05-06 12:09:43 +02:00
Marek Siarkowicz 923096a2bb tests: Simplify downgrade tests 2022-05-06 12:09:43 +02:00
Marek Siarkowicz 3f05f7de92 tests: Use restart in downgrade tests 2022-05-06 12:09:43 +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
eval-exec 755e2e7755 fix data race in testWatchOverlapContextCancel #14003 2022-05-01 21:12:38 +08:00
Piotr Tabor 00d6d40aea
Merge pull request #13940 from lavacat/leases-list-test
tests/common/lease: don't use revision to wait for leases
2022-04-29 10:12:18 +02:00
Piotr Tabor 52ea811af8
Merge pull request #13966 from VladSaioc/blocking-readyc
Fixed potential goroutine leak due to p.Ready() receive in pkg/proxy and dependents.
2022-04-28 16:12:02 +02:00
Piotr Tabor 7ebebb4ff6
Merge pull request #13969 from cmurphy/update-crypto
*: Update golang.org/x/crypto to latest
2022-04-28 12:35:14 +02:00
ahrtr 24002fb099 allocate unique port for each member in test cases 2022-04-26 12:32:00 +08:00
Bogdan Kanivets 67f3bb3ad4 tests/common/lease: don't use revision to wait for leases
Problem: TestLeaseGrantAndList is flaky because lists won't match at the end.
Test uses revision to verify that all members got leases. But checking for revision isn't enough.

Solution: use size of the list to stop polling.
2022-04-25 10:24:32 -07:00
Colleen Murphy 27bd78f6ab Update golang.org/x/crypto to latest
Update crypto to address CVE-2022-27191.

The CVE fix is added in 0.0.0-20220315160706-3147a52a75dd but this
change updates to latest.
2022-04-25 09:52:12 -07:00
Piotr Tabor 887f95d0d3
Merge pull request #13963 from ptabor/20220412-verify-assert
Add verification consistent index is (nearly) never decreasing
2022-04-25 10:13:44 +02:00
Marek Siarkowicz d6368a20cf etcdctl: Remove V2 API commands 2022-04-24 12:08:42 +02:00
Piotr Tabor d69e07dd3a Verification framework and check whether cindex is not decreasing. 2022-04-22 12:32:05 +02:00
Vlad Saioc 00ca558167 Fixed goroutine leak on NewServer 2022-04-22 08:57:19 +02:00
ahrtr 6eef7ede40 Update conssitent_index when applying fails
When clients have no permission to perform whatever operation, then
the applying may fail. We should also move consistent_index forward
in this case, otherwise the consitent_index may smaller than the
snapshot index.
2022-04-20 21:44:48 +08:00
ahrtr 842fed52c7 use lineariziable range request in TestKVGet 2022-04-18 08:56:19 +08:00
ahrtr 0dae4b3b1e rollback the opentelemetry bumpping to recover the pipeline failures 2022-04-14 16:13:28 +08:00
Will Beason eab1e0c5d5 go.mod: upgrade opentelemetry deps
Downstream users of etcd experience build issues when using dependencies
which require more recent (incompatible) versions of opentelemetry. This
commit upgrades the dependencies so that downstream users stop
experiencing these issues.
2022-04-13 07:14:10 -07:00
Danielle Lancashire 6cb7372e6d clientv3: disable mirror auth test with proxy 2022-04-12 13:42:13 +00:00
Danielle Lancashire e324cc1cbe cv3/mirror: Fetch the most recent prefix revision
When a user sets up a Mirror with a restricted user that doesn't have
access to the `foo` path, we will fail to get the most recent revision
due to permissions issues.

With this change, when a prefix is provided we will get the initial
revision from the prefix rather than /foo. This allows restricted users
to setup sync.
2022-04-11 13:42:03 +00: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
Marek Siarkowicz 12bdd1c5e4
Merge pull request #13910 from serathius/crypto
*: update golang.org/x/crypto
2022-04-09 09:41:49 +02:00
Marek Siarkowicz 1bb59adb1e *: update golang.org/x/crypto 2022-04-08 16:27:52 +02:00
Marek Siarkowicz 05e6527d26
Merge pull request #13756 from serathius/test-snapshot
tests: Add tests for snapshot compatibility and recovery between versions
2022-04-08 14:14:19 +02:00
Danielle Lancashire 7cc00ec981 tests/framework/integration: Fail nesting early
Currently there are a handful of tests within etcd that silently fail
because LeakDetection will skip the test before it manages to hit this
check.

Here we move the check to the beginning of the process to highlight
these cases earlier, and to avoid them accidentally presenting as leaks.
2022-04-07 13:10:15 +00:00
Manuel Rüger f0f77fc14e go.mod: Bump prometheus/client_golang to v1.12.1
Signed-off-by: Manuel Rüger <manuel@rueg.eu>
2022-04-06 19:03:24 +02:00
Marek Siarkowicz 3ffa253516 tests: Add tests for snapshot compatibility and recovery between versions 2022-04-06 16:10:38 +02:00
Marek Siarkowicz c4d055fe7b
Merge pull request #13819 from endocrimes/dani/auth_test.go
migrate e2e/users tests to common framework
2022-04-06 16:02:46 +02:00
Marek Siarkowicz 73fc864247 tests: Pass logger to backend 2022-04-05 15:53:38 +02:00
Danielle Lancashire f71196d113 tests/common/lease: Wait for correct lease list response
We don't consistently reach the same etcd server during the lifetime of
a test and in some cases, this means that this test will flake if an
etcd server was slow to update its state and the test hits the outdated
server.

Here we switch to using an `Eventually` case which will wait upto a
second for the expected result before failing - with a 10ms gap between
invocations.

```
[tests(dani/leasefix)] $ gotestsum -- ./common -tags integration -count 100 -timeout 15m -run TestLeaseGrantAndList
✓  common (2m26.71s)

DONE 1600 tests in 147.258s
```
2022-04-04 15:43:17 +02:00
Piotr Tabor 6c974a3e31
Merge pull request #13867 from serathius/logs-test
tests: Use zaptest.NewLogger in tests
2022-04-04 14:47:04 +02:00
Marek Siarkowicz 804fddf921 tests: Use zaptest.NewLogger in tests 2022-04-04 13:03:15 +02:00
Piotr Tabor d4dcd3061d Fix flakes in TestV3LeaseCheckpoint/Checkpointing_disabled,_lease_TTL_is_reset
I think strong (not-equal) relationship was too restrictive when expressed with 1s granularity.

```
        logger.go:130: 2022-04-03T22:15:15.242+0200	WARN	m1	leader failed to send out heartbeat on time; took too long, leader is overloaded likely from slow disk	{"member": "m1", "to": "cb785755eb80ac1", "heartbeat-interval": "10ms", "expected-duration": "20ms", "exceeded-duration": "24.666613ms"}
        logger.go:130: 2022-04-03T22:15:15.262+0200	INFO	m-1	published local member to cluster through raft	{"member": "m-1", "local-member-id": "e2dd9f523aa7be87", "local-member-attributes": "{Name:m-1 ClientURLs:[unix://127.0.0.1:2196386040]}", "cluster-id": "b4b8e7e41c23c8b5", "publish-timeout": "5.2s"}
        v3_lease_test.go:415: Expected lease ttl (4m58s) to be greather than (4m58s)
```
2022-04-03 23:13:01 +02:00
Piotr Tabor ed1bc447c7 Flakes: Additional logging and timeouts to understand common flakes. 2022-04-03 14:48:36 +02: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
Piotr Tabor f85cd0296f
Merge pull request #13872 from ptabor/20220402-osx-unit-test-pass
Fix TestauthTokenBundleOnOverwrite on OsX:
2022-04-02 20:03:38 +02:00
Piotr Tabor 8cd8a1ea10 Flakes in integration/clientv3/examples/...
The tests sometimes flaked due to already existing socket-files.
Now each execution works in a tempoarary directory.
2022-04-02 16:16:25 +02:00
Piotr Tabor 3b589fb3b2 Fix TestauthTokenBundleOnOverwrite on OsX:
```
% (cd client/v3 && env go test -short -timeout=3m --race ./...)
--- FAIL: TestAuthTokenBundleNoOverwrite (0.00s)
    client_test.go:210: listen unix /var/folders/t1/3m8z9xz93t9c3vpt7zyzjm6w00374n/T/TestAuthTokenBundleNoOverwrite3197524989/001/etcd-auth-test:0: bind: invalid argument
FAIL
FAIL	go.etcd.io/etcd/client/v3	4.270s
```

The reason was that the path exceeded 108 chars (that is too much for socket).
In the mitigation we first change chroot (working directory) to the tempDir... such the path is 'local'.
2022-04-02 16:12:02 +02:00
Marek Siarkowicz 63346bfead server: Use default logging configuration instead of zap production one
This fixes problem where logs json changes format of timestamp.
2022-04-01 10:23:42 +02:00
Marek Siarkowicz e5bf23037a tests: Keeps log in expect to allow their analysis 2022-03-31 21:02:36 +02:00
Marek Siarkowicz 27e222e2d7
Merge pull request #13802 from yankay/fix-the-api-dependency-in-pkg-and-update-cobra-to-1.4.0
Fix the etcd api dependency in pkg. And Update Cobra Version to1.4.0
2022-03-28 10:40:24 +02:00
Sahdev Zala dcc226491f
Merge pull request #13836 from kkkkun/set-etcdutl-default
test: set etcdutl to default
2022-03-25 20:13:21 -04:00
Kay Yan afecd3139c fix the api dependency in pkg, and update cobra to 1.4.0
Signed-off-by: Kay Yan <kay.yan@daocloud.io>
2022-03-25 17:18:56 +08:00
Kun Zhang 62641d3385 set etcdutl to default 2022-03-24 16:20:28 +08:00
Manuel Rüger c544b2a2a5 Update go to 1.17.8 2022-03-23 20:11:12 +01:00
Sahdev Zala 3254125e6c
Merge pull request #13809 from kkkkun/cleanup-deprecated-commands
Removing deprecated commands in etcdctl & etcdutl
2022-03-23 11:21:01 -04:00
Kun Zhang 1649c9dfc2 Removing deprecated commands in etcdctl & etcdutl 2022-03-23 11:05:52 +08:00
Marek Siarkowicz 5fe4d551df
Merge pull request #13754 from serathius/common-noquorum
tests: Migrate noquorum kv tests to common framework
2022-03-22 10:54:38 +01:00
Marek Siarkowicz 44aad460db tests: Migrate noquorum kv tests to common framework 2022-03-21 14:53:29 +01:00
Hitoshi Mitake 7a0c254b73 tests/integration: re-enable TestV3AuthOldRevConcurrent 2022-03-21 22:25:58 +09:00
Danielle Lancashire 3416042c50 tests: migrate user tests to common fw 2022-03-21 12:46:00 +00:00
Danielle Lancashire adae7a659e tests/framework: Add User operations 2022-03-21 12:44:51 +00:00
nic-chen c6488a2c56 fix review 2022-03-20 10:09:27 +08:00
nic-chen 89146aa157 chore: delete useless file 2022-03-20 02:06:42 +08:00
nic-chen bb7856090a fix: set cluster size to 1 to avoid unstable 2022-03-20 02:01:30 +08:00
nic-chen 527edd39a6 fix alarm test 2022-03-20 01:40:53 +08:00
nic-chen 02516ab266 Merge branch 'main' into tests/ctl-alarm
# Conflicts:
#	tests/framework/e2e/etcdctl.go
#	tests/framework/interface.go
2022-03-19 16:36:15 +08:00
nic-chen e9fa171665 fix test fail 2022-03-19 16:31:19 +08:00
nic-chen 3e657bdc50 tests: Migrate key value Get to common framework 2022-03-19 00:51:29 +08:00
Danielle Lancashire 87740f6c7b tests: Migrate TestCtlV3LeaseRevoke.* to common 2022-03-18 16:47:42 +00:00
Danielle Lancashire ab3353582d tests/framework: Add Client.LeaseRevoke 2022-03-18 16:47:42 +00:00
Danielle Lancashire 36279e0797 tests: migrate TestCtlV3LeaseKeepAliveOnce.* to common 2022-03-18 16:47:42 +00:00
Danielle Lancashire 353b011f59 tests/framework: Add Client.LeaseKeepAliveOnce 2022-03-18 16:47:42 +00:00
Danielle Lancashire c12e03c8e6 tests: migrate TestCtlV3LeaseTestTimeToLiveExpired.* to common 2022-03-18 16:47:42 +00:00
Danielle Lancashire b50f10299b tests/framework: Add PutOptions
Put can take a leaseid to associate a value with a lease. This adds the
ability for tests to make use of this.
2022-03-18 16:47:42 +00:00
nic-chen dca5874d44 tests: Migrate key value Get to common framework 2022-03-19 00:46:42 +08:00
Danielle Lancashire b7beaf9c62 tests: migrate TestCtlV3LeaseGrantLeases.* to common 2022-03-18 16:43:55 +00:00
Danielle Lancashire 68e6493977 tests/framework: add Client.LeaseList 2022-03-18 16:43:53 +00:00