Skip to content

Commit

Permalink
Rebrand codebase.
Browse files Browse the repository at this point in the history
  • Loading branch information
YoEight committed Dec 18, 2024
1 parent c29aa7d commit c335a9c
Show file tree
Hide file tree
Showing 65 changed files with 942 additions and 943 deletions.
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ endif

.PHONY: singleNode
singleNode: ## Run tests against a single node.
@EVENTSTORE_INSECURE=true go test -count=1 -v ./esdb -run 'TestStreams|TestPersistentSubscriptions|TestExpectations|TestProjections'
@EVENTSTORE_INSECURE=true go test -count=1 -v ./kurrent -run 'TestStreams|TestPersistentSubscriptions|TestExpectations|TestProjections'

.PHONY: secureNode
secureNode: ## Run tests against a secure node.
@$(DOCKER_COMPOSE_CMD) down -v
@$(DOCKER_COMPOSE_CMD) pull
@$(DOCKER_COMPOSE_CMD) up -d
@EVENTSTORE_INSECURE=false go test -v ./esdb -run 'TestStreams|TestPersistentSubscriptions|TestProjections'
@EVENTSTORE_INSECURE=false go test -v ./kurrent -run 'TestStreams|TestPersistentSubscriptions|TestProjections'
@$(DOCKER_COMPOSE_CMD) down

.PHONY: clusterNode
Expand All @@ -52,16 +52,16 @@ clusterNode: ## Run tests against a cluster node.
@$(DOCKER_COMPOSE_CMD) -f cluster-docker-compose.yml up -d
@echo "Waiting for services to be fully ready..."
@sleep 5
@EVENTSTORE_INSECURE=false CLUSTER=true go test -count=1 -v ./esdb -run 'TestStreams|TestPersistentSubscriptions|TestProjections|TestClusterRebalance'
@EVENTSTORE_INSECURE=false CLUSTER=true go test -count=1 -v ./kurrent -run 'TestStreams|TestPersistentSubscriptions|TestProjections|TestClusterRebalance'
@$(DOCKER_COMPOSE_CMD) -f cluster-docker-compose.yml down --remove-orphans

.PHONY: misc
misc: ## Run tests that don't need a server to run.
go test -v ./esdb -run TestMisc
go test -v ./kurrent -run TestMisc

.PHONY: test
test: singleNode secureNode clusterNode misc ## Run all tests.

.PHONY: ci
ci: ## Run tests in Github Actions setting.
go test -v ./esdb -run "$(CI_TARGET)"
go test -v ./kurrent -run "$(CI_TARGET)"
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# EventStoreDB Client SDK for Golang [![Actions Status](https://github.com/eventstore/EventStore-Client-Go/workflows/CI/badge.svg?branch=master)](https://github.com/eventstore/EventStore-Client-Go/actions)
# KurrentDB Client SDK for Golang [![Actions Status](https://github.com/eventstore/EventStore-Client-Go/workflows/CI/badge.svg?branch=master)](https://github.com/eventstore/EventStore-Client-Go/actions)

EventStoreDB is the event-native database, where business events are immutably stored and streamed. Designed for event-sourced, event-driven, and microservices architectures.
KurrentDB is the event-native database, where business events are immutably stored and streamed. Designed for event-sourced, event-driven, and microservices architectures.

This repository contains an [EventStoreDB][es] Client SDK written in Go.
This repository contains an [KurrentDB][es] Client SDK written in Go.

## Developing

Integration tests run against a server using Docker, with the [EventStoreDB gRPC Client Test Container][container].
Integration tests run against a server using Docker, with the [KurrentDB gRPC Client Test Container][container].

### Setup dependencies
Testing requires [Docker] and [Docker Compose] to be installed.
Expand Down
2 changes: 1 addition & 1 deletion build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,5 @@ if ($generateProtos) {
}

Write-Host "Compiling project..."
go build -v .\esdb .\samples
go build -v .\kurrent .\samples
Write-Host "done."
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,5 @@ then
fi

echo "Compiling project..."
go build -v ./esdb ./samples
go build -v ./kurrent ./samples
echo "done."
46 changes: 0 additions & 46 deletions esdb/position_parsing_test.go

This file was deleted.

2 changes: 1 addition & 1 deletion esdb/append_options.go → kurrent/append_options.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package esdb
package kurrent

import (
"time"
Expand Down
58 changes: 29 additions & 29 deletions esdb/append_test.go → kurrent/append_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package esdb_test
package kurrent_test

import (
"context"
Expand All @@ -8,14 +8,14 @@ import (
"testing"
"time"

"github.com/EventStore/EventStore-Client-Go/v4/esdb"
"github.com/EventStore/EventStore-Client-Go/v4/kurrent"
"github.com/stretchr/testify/assert"
)

func createTestEvent() esdb.EventData {
event := esdb.EventData{
func createTestEvent() kurrent.EventData {
event := kurrent.EventData{
EventType: "TestEvent",
ContentType: esdb.ContentTypeBinary,
ContentType: kurrent.ContentTypeBinary,
EventID: uuid.New(),
Data: []byte{0xb, 0xe, 0xe, 0xf},
Metadata: []byte{0xd, 0xe, 0xa, 0xd},
Expand All @@ -24,8 +24,8 @@ func createTestEvent() esdb.EventData {
return event
}

func collectStreamEvents(stream *esdb.ReadStream) ([]*esdb.ResolvedEvent, error) {
events := []*esdb.ResolvedEvent{}
func collectStreamEvents(stream *kurrent.ReadStream) ([]*kurrent.ResolvedEvent, error) {
events := []*kurrent.ResolvedEvent{}

for {
event, err := stream.Recv()
Expand All @@ -45,7 +45,7 @@ func collectStreamEvents(stream *esdb.ReadStream) ([]*esdb.ResolvedEvent, error)

type TestCall = func(t *testing.T)

func AppendTests(t *testing.T, emptyDB *Container, emptyDBClient *esdb.Client) {
func AppendTests(t *testing.T, emptyDB *Container, emptyDBClient *kurrent.Client) {
t.Run("AppendTests", func(t *testing.T) {
t.Run("appendToStreamSingleEventNoStream", appendToStreamSingleEventNoStream(emptyDBClient))
t.Run("appendWithInvalidStreamRevision", appendWithInvalidStreamRevision(emptyDBClient))
Expand All @@ -54,7 +54,7 @@ func AppendTests(t *testing.T, emptyDB *Container, emptyDBClient *esdb.Client) {
})
}

func appendToStreamSingleEventNoStream(db *esdb.Client) TestCall {
func appendToStreamSingleEventNoStream(db *kurrent.Client) TestCall {
return func(t *testing.T) {
testEvent := createTestEvent()
testEvent.EventID = uuid.MustParse("38fffbc2-339e-11ea-8c7b-784f43837872")
Expand All @@ -63,8 +63,8 @@ func appendToStreamSingleEventNoStream(db *esdb.Client) TestCall {
context, cancel := context.WithTimeout(context.Background(), time.Duration(5)*time.Second)
defer cancel()

opts := esdb.AppendToStreamOptions{
ExpectedRevision: esdb.NoStream{},
opts := kurrent.AppendToStreamOptions{
ExpectedRevision: kurrent.NoStream{},
}

_, err := db.AppendToStream(context, streamID.String(), opts, testEvent)
Expand All @@ -73,7 +73,7 @@ func appendToStreamSingleEventNoStream(db *esdb.Client) TestCall {
t.Fatalf("Unexpected failure %+v", err)
}

stream, err := db.ReadStream(context, streamID.String(), esdb.ReadStreamOptions{}, 1)
stream, err := db.ReadStream(context, streamID.String(), kurrent.ReadStreamOptions{}, 1)

if err != nil {
t.Fatalf("Unexpected failure %+v", err)
Expand All @@ -96,20 +96,20 @@ func appendToStreamSingleEventNoStream(db *esdb.Client) TestCall {
}
}

func appendWithInvalidStreamRevision(db *esdb.Client) TestCall {
func appendWithInvalidStreamRevision(db *kurrent.Client) TestCall {
return func(t *testing.T) {
streamID := uuid.New()
context, cancel := context.WithTimeout(context.Background(), time.Duration(5)*time.Second)
defer cancel()

opts := esdb.AppendToStreamOptions{
ExpectedRevision: esdb.StreamExists{},
opts := kurrent.AppendToStreamOptions{
ExpectedRevision: kurrent.StreamExists{},
}

_, err := db.AppendToStream(context, streamID.String(), opts, createTestEvent())
esdbErr, ok := esdb.FromError(err)
esdbErr, ok := kurrent.FromError(err)
assert.False(t, ok)
assert.Equal(t, esdbErr.Code(), esdb.ErrorCodeWrongExpectedVersion)
assert.Equal(t, esdbErr.Code(), kurrent.ErrorCodeWrongExpectedVersion)
}
}

Expand All @@ -122,12 +122,12 @@ func appendToSystemStreamWithIncorrectCredentials(container *Container) TestCall
}

conn := fmt.Sprintf("esdb://bad_user:bad_password@%s?tlsverifycert=false", container.Endpoint)
config, err := esdb.ParseConnectionString(conn)
config, err := kurrent.ParseConnectionString(conn)
if err != nil {
t.Fatalf("Unexpected configuration error: %s", err.Error())
}

db, err := esdb.NewClient(config)
db, err := kurrent.NewClient(config)
if err != nil {
t.Fatalf("Unexpected failure setting up test connection: %s", err.Error())
}
Expand All @@ -138,35 +138,35 @@ func appendToSystemStreamWithIncorrectCredentials(container *Container) TestCall
context, cancel := context.WithTimeout(context.Background(), 1*time.Minute)
defer cancel()

opts := esdb.AppendToStreamOptions{
ExpectedRevision: esdb.Any{},
opts := kurrent.AppendToStreamOptions{
ExpectedRevision: kurrent.Any{},
}

_, err = db.AppendToStream(context, streamID.String(), opts, createTestEvent())
esdbErr, ok := esdb.FromError(err)
esdbErr, ok := kurrent.FromError(err)
assert.False(t, ok)
assert.Equal(t, esdbErr.Code(), esdb.ErrorCodeUnauthenticated)
assert.Equal(t, esdbErr.Code(), kurrent.ErrorCodeUnauthenticated)
}
}

func metadataOperation(db *esdb.Client) TestCall {
func metadataOperation(db *kurrent.Client) TestCall {
return func(t *testing.T) {
streamID := uuid.New()
context, cancel := context.WithTimeout(context.Background(), time.Duration(5)*time.Second)
defer cancel()

opts := esdb.AppendToStreamOptions{
ExpectedRevision: esdb.Any{},
opts := kurrent.AppendToStreamOptions{
ExpectedRevision: kurrent.Any{},
}

_, err := db.AppendToStream(context, streamID.String(), opts, createTestEvent())

assert.Nil(t, err, "error when writing an event")

acl := esdb.Acl{}
acl := kurrent.Acl{}
acl.AddReadRoles("admin")

meta := esdb.StreamMetadata{}
meta := kurrent.StreamMetadata{}
meta.SetMaxAge(2 * time.Second)
meta.SetAcl(acl)

Expand All @@ -175,7 +175,7 @@ func metadataOperation(db *esdb.Client) TestCall {
assert.Nil(t, err, "no error from writing stream metadata")
assert.NotNil(t, result, "defined write result after writing metadata")

metaActual, err := db.GetStreamMetadata(context, streamID.String(), esdb.ReadStreamOptions{})
metaActual, err := db.GetStreamMetadata(context, streamID.String(), kurrent.ReadStreamOptions{})

assert.Nil(t, err, "no error when reading stream metadata")

Expand Down
17 changes: 8 additions & 9 deletions esdb/auth_insecure_test.go → kurrent/auth_insecure_test.go
Original file line number Diff line number Diff line change
@@ -1,40 +1,39 @@
package esdb_test
package kurrent_test

import (
"context"
"github.com/EventStore/EventStore-Client-Go/v4/kurrent"
"testing"
"time"

"github.com/EventStore/EventStore-Client-Go/v4/esdb"
)

func InsecureAuthenticationTests(t *testing.T, client *esdb.Client) {
func InsecureAuthenticationTests(t *testing.T, client *kurrent.Client) {
t.Run("AuthenticationTests", func(t *testing.T) {
t.Run("callInsecureWithoutCredentials", callInsecureWithoutCredentials(client))
t.Run("callInsecureWithInvalidCredentials", callInsecureWithInvalidCredentials(client))
})
}

func callInsecureWithoutCredentials(db *esdb.Client) TestCall {
func callInsecureWithoutCredentials(db *kurrent.Client) TestCall {
return func(t *testing.T) {
context, cancel := context.WithTimeout(context.Background(), time.Duration(5)*time.Second)
defer cancel()

err := db.CreatePersistentSubscription(context, NAME_GENERATOR.Generate(), NAME_GENERATOR.Generate(), esdb.PersistentStreamSubscriptionOptions{})
err := db.CreatePersistentSubscription(context, NAME_GENERATOR.Generate(), NAME_GENERATOR.Generate(), kurrent.PersistentStreamSubscriptionOptions{})

if err != nil {
t.Fatalf("Unexpected failure %+v", err)
}
}
}

func callInsecureWithInvalidCredentials(db *esdb.Client) TestCall {
func callInsecureWithInvalidCredentials(db *kurrent.Client) TestCall {
return func(t *testing.T) {
context, cancel := context.WithTimeout(context.Background(), time.Duration(5)*time.Second)
defer cancel()

opts := esdb.PersistentStreamSubscriptionOptions{
Authenticated: &esdb.Credentials{
opts := kurrent.PersistentStreamSubscriptionOptions{
Authenticated: &kurrent.Credentials{
Login: "invalid",
Password: "invalid",
},
Expand Down
Loading

0 comments on commit c335a9c

Please sign in to comment.