Merge pull request #14618 from ahrtr/username_password_cont

test: add common function "WithAuth"
dependabot/go_modules/go.uber.org/atomic-1.10.0
Benjamin Wang 2022-10-25 11:29:26 +08:00 committed by GitHub
commit b37532db8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 4 deletions

View File

@ -17,8 +17,16 @@
package common
import "go.etcd.io/etcd/tests/v3/framework"
import (
"go.etcd.io/etcd/tests/v3/framework"
"go.etcd.io/etcd/tests/v3/framework/config"
"go.etcd.io/etcd/tests/v3/framework/e2e"
)
func init() {
testRunner = framework.E2eTestRunner
}
func WithAuth(userName, password string) config.ClientOption {
return e2e.WithAuth(userName, password)
}

View File

@ -19,8 +19,14 @@ package common
import (
"go.etcd.io/etcd/tests/v3/framework"
"go.etcd.io/etcd/tests/v3/framework/config"
"go.etcd.io/etcd/tests/v3/framework/integration"
)
func init() {
testRunner = framework.IntegrationTestRunner
}
func WithAuth(userName, password string) config.ClientOption {
return integration.WithAuth(userName, password)
}

View File

@ -21,9 +21,10 @@ import (
)
// ClientOption configures the client with additional parameter.
// For example, if Auth is enabled,
// 1. e2e test cases use e2e.WithAuth to return a ClientOption;
// 2. integration test, uses integration.WithAuth to return a ClientOption.
// For example, if Auth is enabled, the common test cases just need to
// use `WithAuth` to return a ClientOption. Note that the common `WithAuth`
// function calls `e2e.WithAuth` or `integration.WithAuth`, depending on the
// build tag (either "e2e" or "integration").
type ClientOption func(any)
type GetOptions struct {