Skip to content

Commit

Permalink
integration/fixtures: Move the 'tests/integration/fixtures' directory…
Browse files Browse the repository at this point in the history
… up and update references.

I moved the files up as they are shared between e2e & integrational tests.
  • Loading branch information
ptabor committed Oct 7, 2020
1 parent bb97038 commit be4e8b7
Show file tree
Hide file tree
Showing 76 changed files with 86 additions and 79 deletions.
2 changes: 1 addition & 1 deletion Documentation/op-guide/security.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ The command should show that the handshake succeed. Since we use self-signed cer

**OSX 10.9+ Users**: curl 7.30.0 on OSX 10.9+ doesn't understand certificates passed in on the command line.
Instead, import the dummy ca.crt directly into the keychain or add the `-k` flag to curl to ignore errors.
To test without the `-k` flag, run `open ./fixtures/ca/ca.crt` and follow the prompts.
To test without the `-k` flag, run `open ./tests/fixtures/ca/ca.crt` and follow the prompts.
Please remove this certificate after testing!
If there is a workaround, let us know.

Expand Down
8 changes: 4 additions & 4 deletions auth/jwt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ import (
)

const (
jwtRSAPubKey = "../integration/fixtures/server.crt"
jwtRSAPrivKey = "../integration/fixtures/server.key.insecure"
jwtRSAPubKey = "../tests/fixtures/server.crt"
jwtRSAPrivKey = "../tests/fixtures/server.key.insecure"

jwtECPubKey = "../integration/fixtures/server-ecdsa.crt"
jwtECPrivKey = "../integration/fixtures/server-ecdsa.key.insecure"
jwtECPubKey = "../tests/fixtures/server-ecdsa.crt"
jwtECPrivKey = "../tests/fixtures/server-ecdsa.key.insecure"
)

func TestJWTInfo(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions clientv3/yaml/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ import (
)

var (
certPath = "../../tests/integration/fixtures/server.crt"
privateKeyPath = "../../tests/integration/fixtures/server.key.insecure"
caPath = "../../tests/integration/fixtures/ca.crt"
certPath = "../../tests/fixtures/server.crt"
privateKeyPath = "../../tests/fixtures/server.key.insecure"
caPath = "../../tests/fixtures/ca.crt"
)

func TestConfigFromFile(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions pkg/proxy/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ import (
var testLogger = zap.NewExample()

var testTLSInfo = transport.TLSInfo{
KeyFile: "./fixtures/server.key.insecure",
CertFile: "./fixtures/server.crt",
TrustedCAFile: "./fixtures/ca.crt",
KeyFile: "../../tests/fixtures/server.key.insecure",
CertFile: "../../tests/fixtures/server.crt",
TrustedCAFile: "../../tests/fixtures/ca.crt",
ClientCertAuth: true,
}

Expand Down
8 changes: 4 additions & 4 deletions tests/e2e/cluster_proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,10 @@ func newProxyV3Proc(cfg *etcdServerProcessConfig) *proxyV3Proc {
// Configure certificates for connection proxy ---> server.
// This certificate must NOT have CN set.
tlsArgs = append(tlsArgs,
"--cert", "../../integration/fixtures/client-nocn.crt",
"--key", "../../integration/fixtures/client-nocn.key.insecure",
"--cacert", "../../integration/fixtures/ca.crt",
"--client-crl-file", "../../integration/fixtures/revoke.crl")
"--cert", "../fixtures/client-nocn.crt",
"--key", "../fixtures/client-nocn.key.insecure",
"--cacert", "../fixtures/ca.crt",
"--client-crl-file", "../fixtures/revoke.crl")
}
return &proxyV3Proc{
proxyProc{
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ var (
configJWT = etcdProcessClusterConfig{
clusterSize: 1,
initialToken: "new",
authTokenOpts: "jwt,pub-key=../../integration/fixtures/server.crt,priv-key=../../integration/fixtures/server.key.insecure,sign-method=RS256,ttl=1s",
authTokenOpts: "jwt,pub-key=../fixtures/server.crt,priv-key=../fixtures/server.key.insecure,sign-method=RS256,ttl=1s",
}
)

Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func TestMain(m *testing.M) {
os.Unsetenv("ETCDCTL_API")

flag.StringVar(&binDir, "bin-dir", "../../bin", "The directory for store etcd and etcdctl binaries.")
flag.StringVar(&certDir, "cert-dir", "../../integration/fixtures", "The directory for store certificate files.")
flag.StringVar(&certDir, "cert-dir", "../fixtures", "The directory for store certificate files.")
flag.Parse()

binPath = binDir + "/etcd"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/integration/clientv3/black_hole_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

// +build !cluster_proxy

package integration
package clientv3test

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/clientv3/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package integration
package clientv3test

import (
"context"
Expand Down
14 changes: 7 additions & 7 deletions tests/integration/clientv3/dial_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package integration
package clientv3test

import (
"context"
Expand All @@ -31,16 +31,16 @@ import (

var (
testTLSInfo = transport.TLSInfo{
KeyFile: "../../integration/fixtures/server.key.insecure",
CertFile: "../../integration/fixtures/server.crt",
TrustedCAFile: "../../integration/fixtures/ca.crt",
KeyFile: "../../fixtures/server.key.insecure",
CertFile: "../../fixtures/server.crt",
TrustedCAFile: "../../fixtures/ca.crt",
ClientCertAuth: true,
}

testTLSInfoExpired = transport.TLSInfo{
KeyFile: "../../integration/fixtures-expired/server.key.insecure",
CertFile: "../../integration/fixtures-expired/server.crt",
TrustedCAFile: "../../integration/fixtures-expired/ca.crt",
KeyFile: "../fixtures-expired/server.key.insecure",
CertFile: "../fixtures-expired/server.crt",
TrustedCAFile: "../fixtures-expired/ca.crt",
ClientCertAuth: true,
}
)
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/clientv3/examples/example_auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package clientv3_test
package clientv3test

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package clientv3_test
package clientv3test

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/clientv3/examples/example_kv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package clientv3_test
package clientv3test

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/clientv3/examples/example_lease_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package clientv3_test
package clientv3test

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package clientv3_test
package clientv3test

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package clientv3_test
package clientv3test

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/clientv3/examples/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package clientv3_test
package clientv3test

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/clientv3/examples/example_watch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package clientv3_test
package clientv3test

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/clientv3/examples/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package clientv3_test
package clientv3test

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/clientv3/grpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package naming_test
package clientv3test

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/clientv3/kv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package integration
package clientv3test

import (
"bytes"
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/clientv3/lease_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package integration
package clientv3test

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/clientv3/leasing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package integration
package clientv3test

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/clientv3/logger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package integration
package clientv3test

import (
"io/ioutil"
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/clientv3/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package integration
package clientv3test

import (
"testing"
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/clientv3/maintenance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package integration
package clientv3test

import (
"bytes"
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/clientv3/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package integration
package clientv3test

import (
"bufio"
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/clientv3/mirror_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package integration
package clientv3test

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/clientv3/namespace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package integration
package clientv3test

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/clientv3/network_partition_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

// +build !cluster_proxy

package integration
package clientv3test

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/clientv3/ordering_kv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package integration
package clientv3test

import (
"context"
Expand Down
13 changes: 8 additions & 5 deletions tests/integration/clientv3/ordering_util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package ordering
package clientv3test

import (
"context"
Expand All @@ -21,6 +21,7 @@ import (

"go.etcd.io/etcd/tests/v3/integration"
"go.etcd.io/etcd/v3/clientv3"
"go.etcd.io/etcd/v3/clientv3/ordering"
"go.etcd.io/etcd/v3/pkg/testutil"
)

Expand All @@ -38,6 +39,7 @@ func TestEndpointSwitchResolvesViolation(t *testing.T) {
if err != nil {
t.Fatal(err)
}
defer cli.Close()

ctx := context.TODO()

Expand All @@ -64,7 +66,7 @@ func TestEndpointSwitchResolvesViolation(t *testing.T) {
// NewOrderViolationSwitchEndpointClosure will be able to
// access the full list of endpoints.
cli.SetEndpoints(eps...)
OrderingKv := NewKV(cli.KV, NewOrderViolationSwitchEndpointClosure(*cli))
OrderingKv := ordering.NewKV(cli.KV, ordering.NewOrderViolationSwitchEndpointClosure(*cli))
// set prevRev to the second member's revision of "foo" such that
// the revision is higher than the third member's revision of "foo"
_, err = OrderingKv.Get(ctx, "foo")
Expand Down Expand Up @@ -97,6 +99,7 @@ func TestUnresolvableOrderViolation(t *testing.T) {
if err != nil {
t.Fatal(err)
}
defer cli.Close()
eps := cli.Endpoints()
ctx := context.TODO()

Expand All @@ -123,7 +126,7 @@ func TestUnresolvableOrderViolation(t *testing.T) {
// access the full list of endpoints.
cli.SetEndpoints(eps...)
time.Sleep(1 * time.Second) // give enough time for operation
OrderingKv := NewKV(cli.KV, NewOrderViolationSwitchEndpointClosure(*cli))
OrderingKv := ordering.NewKV(cli.KV, ordering.NewOrderViolationSwitchEndpointClosure(*cli))
// set prevRev to the first member's revision of "foo" such that
// the revision is higher than the fourth and fifth members' revision of "foo"
_, err = OrderingKv.Get(ctx, "foo")
Expand All @@ -147,7 +150,7 @@ func TestUnresolvableOrderViolation(t *testing.T) {
time.Sleep(5 * time.Second) // give enough time for operation

_, err = OrderingKv.Get(ctx, "foo", clientv3.WithSerializable())
if err != ErrNoGreaterRev {
t.Fatalf("expected %v, got %v", ErrNoGreaterRev, err)
if err != ordering.ErrNoGreaterRev {
t.Fatalf("expected %v, got %v", ordering.ErrNoGreaterRev, err)
}
}
2 changes: 1 addition & 1 deletion tests/integration/clientv3/role_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package integration
package clientv3test

import (
"context"
Expand Down
Loading

0 comments on commit be4e8b7

Please sign in to comment.