Skip to content
This repository was archived by the owner on May 18, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ run: build
fmt: $(GOFILES)
gofmt -w -s $(GOFILES)

spell: $(GOFILES)
misspell $(GOFILES)


myday: test lint vet

COMPLETER_DIR := $(realpath $(dir $(firstword $(MAKEFILE_LIST))))
Expand Down
2 changes: 1 addition & 1 deletion graph/graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func (graph *CompletionGraph) IsCompleted() bool {
}

// HandleCompleted closes the graph for modifications
// this should only be called once an OnComplete event has been emmitted by the graph
// this should only be called once an OnComplete event has been emitted by the graph
func (graph *CompletionGraph) handleCompleted() {
graph.log.Info("completing graph")
graph.state = StateCompleted
Expand Down
4 changes: 2 additions & 2 deletions graph/stage.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (r *RawDependency) GetID() string {
return r.ID
}

// GetResult gets the result (or nil if no result) of teh graph
// GetResult gets the result (or nil if no result) of the graph
func (r *RawDependency) GetResult() *model.CompletionResult {
return r.result
}
Expand Down Expand Up @@ -85,7 +85,7 @@ func (stage *CompletionStage) GetID() string {
return stage.ID
}

// GetResult gets the result (or nil if no result) of teh graph
// GetResult gets the result (or nil if no result) of the graph
func (stage *CompletionStage) GetResult() *model.CompletionResult {
return stage.result
}
Expand Down
2 changes: 1 addition & 1 deletion graph/stage_strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func invokeWithResult(stage *CompletionStage, listener CompletionEventListener,
listener.OnExecuteStage(stage, results)
}

// invokeWithResultOrError triggers invoking the closure with a pair consisting of the (result,<emtpy>) if the result is successful, or (<empty>,error) if the result is an error
// invokeWithResultOrError triggers invoking the closure with a pair consisting of the (result,<empty>) if the result is successful, or (<empty>,error) if the result is an error
// this can only be used with single-valued result
func invokeWithResultOrError(stage *CompletionStage, listener CompletionEventListener, results []*model.CompletionResult) {
if len(results) != 1 {
Expand Down
2 changes: 1 addition & 1 deletion persistence/sql_blob_store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func givenEmptyBlobStore() BlobStore {
func setupDb() *sqlx.DB {
resetTestDb()

db, err := CreateDBConnecection(testDbURL())
db, err := CreateDBConnection(testDbURL())
if err != nil {
panic(err)
}
Expand Down
4 changes: 2 additions & 2 deletions persistence/sql_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ var tables = [...]string{`CREATE TABLE IF NOT EXISTS events (
blob_data BLOB);`,
}

// CreateDBConnecection sets up a DB connection and ensures required tables exist
func CreateDBConnecection(url *url.URL) (*sqlx.DB, error) {
// CreateDBConnection sets up a DB connection and ensures required tables exist
func CreateDBConnection(url *url.URL) (*sqlx.DB, error) {
driver := url.Scheme
switch driver {
case "mysql", "sqlite3":
Expand Down
2 changes: 1 addition & 1 deletion persistence/sql_provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func getEventsForActor(provider ProviderState, actorName string, startIdx int) [

func givenProvider(t *testing.T) ProviderState {
resetTestDb()
db, err := CreateDBConnecection(testDbURL())
db, err := CreateDBConnection(testDbURL())
require.NoError(t, err)
provider, err := NewSQLProvider(db, 0)
require.NoError(t, err)
Expand Down
8 changes: 5 additions & 3 deletions protocol/read_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,13 +347,14 @@ func TestReadsSuccessfulEncapsulatedResultFromHttpResp(t *testing.T) {

val, err := store.ReadBlobData(result.Datum.GetBlob())

require.NoError(t, err)
assert.True(t, result.Successful)
assert.Equal(t, content, val)
assert.Equal(t, "text/plain", result.Datum.GetBlob().ContentType)

}

func TestReadsFailedncapsulatedResultFromHttpResp(t *testing.T) {
func TestReadsFailedEncapsulatedResultFromHTTPResp(t *testing.T) {
store := persistence.NewInMemBlobStore()

h := http.Header{}
Expand Down Expand Up @@ -386,13 +387,14 @@ func TestReadsFailedncapsulatedResultFromHttpResp(t *testing.T) {

val, err := store.ReadBlobData(result.Datum.GetBlob())

require.NoError(t, err)
assert.False(t, result.Successful)
assert.Equal(t, content, val)
assert.Equal(t, "text/plain", result.Datum.GetBlob().ContentType)

}

func TestRejectsHttpRespDatumWithNoResultCode(t *testing.T) {
func TestRejectsHTTPRespDatumWithNoResultCode(t *testing.T) {
store := persistence.NewInMemBlobStore()

h := emptyHeaders()
Expand All @@ -408,7 +410,7 @@ func TestRejectsHttpRespDatumWithNoResultCode(t *testing.T) {
assert.Equal(t, ErrMissingResultCode, err)
}

func TestRejectsHttpReqDatumWithInvalidResultCode(t *testing.T) {
func TestRejectsHTTPReqDatumWithInvalidResultCode(t *testing.T) {
store := persistence.NewInMemBlobStore()

h := emptyHeaders()
Expand Down
2 changes: 1 addition & 1 deletion setup/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func initStorageFromEnv() (persistence.ProviderState, persistence.BlobStore, err
return persistence.NewInMemoryProvider(snapshotInterval), persistence.NewInMemBlobStore(), nil
}

dbConn, err := persistence.CreateDBConnecection(dbURL)
dbConn, err := persistence.CreateDBConnection(dbURL)
if err != nil {
return nil, nil, err
}
Expand Down