Skip to content

Commit

Permalink
Merge pull request #349 from ecordell/enable-e2e
Browse files Browse the repository at this point in the history
e2e: fill schema with many namespaces to span ranges
  • Loading branch information
ecordell committed Dec 30, 2021
2 parents 9a8f598 + 9ea3c24 commit 6f66209
Show file tree
Hide file tree
Showing 11 changed files with 463 additions and 205 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/build.yaml
Expand Up @@ -64,8 +64,6 @@ jobs:
run: "go test -tags ci ./..."

e2e:
# Explicitly disabling e2e testing
if: "false"
name: "E2E"
runs-on: "ubuntu-latest"
steps:
Expand Down
24 changes: 24 additions & 0 deletions e2e/cockroach/cockroach.go
Expand Up @@ -73,6 +73,30 @@ func (c *Node) Conn() *pgx.Conn {
return c.conn
}

// NodeID returns the cockroach-internal node id for this connection. This is
// the value that is referenced by other crdb metadata to identify range leader,
// follower nodes, etc.
func (c *Node) NodeID(ctx context.Context) (int, error) {
rows, err := c.conn.Query(ctx, "SHOW node_id")
defer rows.Close()
if err != nil {
return -1, err
}
// despite being an int, crdb returns node id as a string
var nodeID string
for rows.Next() {
if err := rows.Scan(&nodeID); err != nil {
return -1, err
}
break
}
i, err := strconv.Atoi(nodeID)
if err != nil {
return -1, err
}
return i, nil
}

// Cluster represents a set of Node nodes configured to talk to
// each other.
type Cluster []*Node
Expand Down
25 changes: 25 additions & 0 deletions e2e/generator/names.go
@@ -0,0 +1,25 @@
package generator

import "github.com/brianvoe/gofakeit/v6"

type UniqueGenerator struct {
seen map[string]struct{}
regex string
}

func NewUniqueGenerator(regex string) *UniqueGenerator {
return &UniqueGenerator{
seen: make(map[string]struct{}, 0),
regex: regex,
}
}

func (g *UniqueGenerator) Next() string {
for {
val := gofakeit.Regex(g.regex)
if _, ok := g.seen[val]; !ok {
g.seen[val] = struct{}{}
return val
}
}
}
25 changes: 16 additions & 9 deletions e2e/go.mod
Expand Up @@ -3,37 +3,44 @@ module github.com/authzed/spicedb/e2e
go 1.17

require (
github.com/authzed/authzed-go v0.3.1-0.20211130221323-9d59da6e55da
github.com/authzed/authzed-go v0.3.1-0.20211220220442-a36f72252b43
github.com/authzed/grpcutil v0.0.0-20211020204402-aba1876830e6
github.com/authzed/spicedb v0.0.0
github.com/jackc/pgx/v4 v4.13.0
github.com/brianvoe/gofakeit/v6 v6.10.0
github.com/ecordell/optgen v0.0.5-0.20211217170453-18cdce036e35
github.com/jackc/pgtype v1.9.1
github.com/jackc/pgx/v4 v4.14.1
github.com/stretchr/testify v1.7.0
golang.org/x/tools v0.1.8
google.golang.org/grpc v1.42.0
mvdan.cc/gofumpt v0.2.1
)

require (
github.com/certifi/gocertifi v0.0.0-20210507211836-431795d63e8d // indirect
github.com/dave/jennifer v1.4.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/envoyproxy/protoc-gen-validate v0.6.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.6 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.6.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
github.com/jackc/pgconn v1.10.0 // indirect
github.com/jackc/pgconn v1.10.1 // indirect
github.com/jackc/pgio v1.0.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgproto3/v2 v2.1.1 // indirect
github.com/jackc/pgproto3/v2 v2.2.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect
github.com/jackc/pgtype v1.8.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/shopspring/decimal v1.3.1 // indirect
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect
golang.org/x/mod v0.5.1 // indirect
golang.org/x/net v0.0.0-20211104170005-ce137452f963 // indirect
golang.org/x/sys v0.0.0-20211103235746-7861aae1554b // indirect
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect
golang.org/x/text v0.3.7 // indirect
google.golang.org/genproto v0.0.0-20211102202547-e9cf271f7f2c // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 // indirect
google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
Expand Down
98 changes: 64 additions & 34 deletions e2e/go.sum

Large diffs are not rendered by default.

0 comments on commit 6f66209

Please sign in to comment.