From 8040ebc6dcc8c43cc914d90b4780dbc99b94542c Mon Sep 17 00:00:00 2001 From: docktermj Date: Wed, 22 Mar 2023 17:32:24 -0400 Subject: [PATCH 01/17] #55 Update dependencies --- go.mod | 10 +++++----- go.sum | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/go.mod b/go.mod index e08cce6..97f9269 100644 --- a/go.mod +++ b/go.mod @@ -4,9 +4,9 @@ go 1.20 require ( github.com/aquilax/truncate v1.0.0 - github.com/senzing/g2-sdk-go v0.4.1 - github.com/senzing/g2-sdk-go-base v0.1.2 - github.com/senzing/g2-sdk-proto/go v0.0.0-20230310202231-e2f8d3edf4b8 + github.com/senzing/g2-sdk-go v0.5.0 + github.com/senzing/g2-sdk-go-base v0.1.3 + github.com/senzing/g2-sdk-proto/go v0.0.0-20230315125947-e4aea8f381eb github.com/senzing/go-common v0.1.2 github.com/senzing/go-logging v1.1.3 github.com/senzing/go-observing v0.2.0 @@ -37,8 +37,8 @@ require ( golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.6.0 // indirect golang.org/x/text v0.8.0 // indirect - google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 // indirect - google.golang.org/protobuf v1.29.1 // indirect + google.golang.org/genproto v0.0.0-20230322174352-cde4c949918d // indirect + google.golang.org/protobuf v1.30.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 419590f..3f3d3ad 100644 --- a/go.sum +++ b/go.sum @@ -157,12 +157,12 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/senzing/g2-sdk-go v0.4.1 h1:McZVlNweYtp4rh1AKdOeu0p4J5cPUdBv/z09W6WHRqE= -github.com/senzing/g2-sdk-go v0.4.1/go.mod h1:tz+pX1kT4S5ooDb0DwO8gkSAYZcpPn/jFB0oZfssd84= -github.com/senzing/g2-sdk-go-base v0.1.2 h1:KyxEk7jMiJjPZ9zEAWlatTw5Cha5foYZaEMR+LUBMpE= -github.com/senzing/g2-sdk-go-base v0.1.2/go.mod h1:eP463BSCJQdUxxa/V68crxpprtyacG0sWSGcSk96RL0= -github.com/senzing/g2-sdk-proto/go v0.0.0-20230310202231-e2f8d3edf4b8 h1:JliRWMBMR45nJbt/wsWyeqDTZL4BnibZzQvU4j5CapE= -github.com/senzing/g2-sdk-proto/go v0.0.0-20230310202231-e2f8d3edf4b8/go.mod h1:c8P58slWygCjkg2apMDZfoYXRD97AYuXPx9+gKqm7Ik= +github.com/senzing/g2-sdk-go v0.5.0 h1:rCHKr53i0mM/Vi3C6KjefDOqCTleFDIBviNWgZTsMbo= +github.com/senzing/g2-sdk-go v0.5.0/go.mod h1:SpYcLeU8slSpl76FDivuc8C7mD7Hw2uUkTgb6ANovlY= +github.com/senzing/g2-sdk-go-base v0.1.3 h1:QI9KHJibkdgMLZvR43E15NTdWI775u7W1/0/1EYGJwM= +github.com/senzing/g2-sdk-go-base v0.1.3/go.mod h1:dY1tc9MdIWyV9QWKBHRLBcU9gJCMytMZ9L4E8IoyD5I= +github.com/senzing/g2-sdk-proto/go v0.0.0-20230315125947-e4aea8f381eb h1:ig302ScN/Z1u0Qv0ZAYxXrzGaZCpvCdfE/wwZuCIykM= +github.com/senzing/g2-sdk-proto/go v0.0.0-20230315125947-e4aea8f381eb/go.mod h1:RZR2aUAtCQsllrxNhYAs3WlHJOdHWcBDwylqg16HvI4= github.com/senzing/go-common v0.1.2 h1:d4E4cyKAqBvHvexLvj51WwoU78jTbLlBXmE67o41CM8= github.com/senzing/go-common v0.1.2/go.mod h1:rDosNB5AHPIQvtwxvKvWKlF+dkzI+2WjeOfPWE7Bh2I= github.com/senzing/go-logging v1.1.3 h1:eTWuEgI+4bwyS0gSpYKNbz8gL8ATAqByA3q1sbRJCu4= @@ -465,8 +465,8 @@ google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 h1:DdoeryqhaXp1LtT/emMP1BRJPHHKFi5akj/nbx/zNTA= -google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s= +google.golang.org/genproto v0.0.0-20230322174352-cde4c949918d h1:OE8TncEeAei3Tehf/P/Jdt/K+8GnTUrRY6wzYpbCes4= +google.golang.org/genproto v0.0.0-20230322174352-cde4c949918d/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -497,8 +497,8 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.29.1 h1:7QBf+IK2gx70Ap/hDsOmam3GE0v9HicjfEdAxE62UoM= -google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= +google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From ba53c7e53246a962efd88a9ed86453da3544da79 Mon Sep 17 00:00:00 2001 From: docktermj Date: Wed, 22 Mar 2023 17:57:00 -0400 Subject: [PATCH 02/17] #55 Update test cases --- g2configmgrserver/g2configmgrserver_test.go | 52 ++++++++++------ g2diagnosticserver/g2diagnosticserver_test.go | 59 ++++++++++++------- g2engineserver/g2engineserver.go | 22 +++---- g2engineserver/g2engineserver_test.go | 51 ++++++++++------ 4 files changed, 115 insertions(+), 69 deletions(-) diff --git a/g2configmgrserver/g2configmgrserver_test.go b/g2configmgrserver/g2configmgrserver_test.go index 06e6e6b..c4b43e7 100644 --- a/g2configmgrserver/g2configmgrserver_test.go +++ b/g2configmgrserver/g2configmgrserver_test.go @@ -12,6 +12,7 @@ import ( "github.com/senzing/g2-sdk-go-base/g2config" "github.com/senzing/g2-sdk-go-base/g2configmgr" "github.com/senzing/g2-sdk-go-base/g2engine" + "github.com/senzing/g2-sdk-go/g2error" g2configpb "github.com/senzing/g2-sdk-proto/go/g2config" g2pb "github.com/senzing/g2-sdk-proto/go/g2configmgr" "github.com/senzing/go-common/g2engineconfigurationjson" @@ -35,6 +36,10 @@ var ( // Internal functions // ---------------------------------------------------------------------------- +func createError(errorId int, err error) error { + return g2error.Cast(localLogger.Error(errorId, err), err) +} + func getTestObject(ctx context.Context, test *testing.T) G2ConfigmgrServer { if g2configmgrServerSingleton == nil { g2configmgrServerSingleton = &G2ConfigmgrServer{} @@ -131,6 +136,15 @@ func testErrorNoFail(test *testing.T, ctx context.Context, g2configmgr G2Configm func TestMain(m *testing.M) { err := setup() if err != nil { + if g2error.Is(err, g2error.G2Unrecoverable) { + fmt.Printf("\nUnrecoverable error detected. \n\n") + } + if g2error.Is(err, g2error.G2Retryable) { + fmt.Printf("\nRetryable error detected. \n\n") + } + if g2error.Is(err, g2error.G2BadUserInput) { + fmt.Printf("\nBad user input error detected. \n\n") + } fmt.Print(err) os.Exit(1) } @@ -148,12 +162,12 @@ func setupSenzingConfig(ctx context.Context, moduleName string, iniParams string aG2config := &g2config.G2config{} err := aG2config.Init(ctx, moduleName, iniParams, verboseLogging) if err != nil { - return localLogger.Error(5906, err) + return createError(5906, err) } configHandle, err := aG2config.Create(ctx) if err != nil { - return localLogger.Error(5907, err) + return createError(5907, err) } datasourceNames := []string{"CUSTOMERS", "REFERENCE", "WATCHLIST"} @@ -161,23 +175,23 @@ func setupSenzingConfig(ctx context.Context, moduleName string, iniParams string datasource := truthset.TruthsetDataSources[datasourceName] _, err := aG2config.AddDataSource(ctx, configHandle, datasource.Json) if err != nil { - return localLogger.Error(5908, err) + return createError(5908, err) } } configStr, err := aG2config.Save(ctx, configHandle) if err != nil { - return localLogger.Error(5909, err) + return createError(5909, err) } err = aG2config.Close(ctx, configHandle) if err != nil { - return localLogger.Error(5910, err) + return createError(5910, err) } err = aG2config.Destroy(ctx) if err != nil { - return localLogger.Error(5911, err) + return createError(5911, err) } // Persist the Senzing configuration to the Senzing repository. @@ -185,23 +199,23 @@ func setupSenzingConfig(ctx context.Context, moduleName string, iniParams string aG2configmgr := &g2configmgr.G2configmgr{} err = aG2configmgr.Init(ctx, moduleName, iniParams, verboseLogging) if err != nil { - return localLogger.Error(5912, err) + return createError(5912, err) } configComments := fmt.Sprintf("Created by g2diagnostic_test at %s", now.UTC()) configID, err := aG2configmgr.AddConfig(ctx, configStr, configComments) if err != nil { - return localLogger.Error(5913, err) + return createError(5913, err) } err = aG2configmgr.SetDefaultConfigID(ctx, configID) if err != nil { - return localLogger.Error(5914, err) + return createError(5914, err) } err = aG2configmgr.Destroy(ctx) if err != nil { - return localLogger.Error(5915, err) + return createError(5915, err) } return err } @@ -210,49 +224,49 @@ func setupPurgeRepository(ctx context.Context, moduleName string, iniParams stri aG2engine := &g2engine.G2engine{} err := aG2engine.Init(ctx, moduleName, iniParams, verboseLogging) if err != nil { - return localLogger.Error(5903, err) + return createError(5903, err) } err = aG2engine.PurgeRepository(ctx) if err != nil { - return localLogger.Error(5904, err) + return createError(5904, err) } err = aG2engine.Destroy(ctx) if err != nil { - return localLogger.Error(5905, err) + return createError(5905, err) } return err } func setup() error { + var err error = nil ctx := context.TODO() moduleName := "Test module name" verboseLogging := 0 - localLogger, err := messagelogger.NewSenzingApiLogger(ProductId, IdMessages, IdStatuses, messagelogger.LevelInfo) + localLogger, err = messagelogger.NewSenzingApiLogger(ProductId, IdMessages, IdStatuses, messagelogger.LevelInfo) if err != nil { - return localLogger.Error(5901, err) + return createError(5901, err) } iniParams, err := g2engineconfigurationjson.BuildSimpleSystemConfigurationJson("") if err != nil { - return localLogger.Error(5902, err) + return createError(5902, err) } // Add Data Sources to Senzing configuration. err = setupSenzingConfig(ctx, moduleName, iniParams, verboseLogging) if err != nil { - return localLogger.Error(5920, err) + return createError(5920, err) } // Purge repository. err = setupPurgeRepository(ctx, moduleName, iniParams, verboseLogging) if err != nil { - return localLogger.Error(5921, err) + return createError(5921, err) } - return err } diff --git a/g2diagnosticserver/g2diagnosticserver_test.go b/g2diagnosticserver/g2diagnosticserver_test.go index 364bd0d..5246966 100644 --- a/g2diagnosticserver/g2diagnosticserver_test.go +++ b/g2diagnosticserver/g2diagnosticserver_test.go @@ -12,6 +12,7 @@ import ( "github.com/senzing/g2-sdk-go-base/g2config" "github.com/senzing/g2-sdk-go-base/g2configmgr" "github.com/senzing/g2-sdk-go-base/g2engine" + "github.com/senzing/g2-sdk-go/g2error" g2configmgrpb "github.com/senzing/g2-sdk-proto/go/g2configmgr" g2pb "github.com/senzing/g2-sdk-proto/go/g2diagnostic" "github.com/senzing/go-common/g2engineconfigurationjson" @@ -36,6 +37,10 @@ var ( // Internal functions // ---------------------------------------------------------------------------- +func createError(errorId int, err error) error { + return g2error.Cast(localLogger.Error(errorId, err), err) +} + func getTestObject(ctx context.Context, test *testing.T) G2DiagnosticServer { if g2diagnosticTestSingleton == nil { g2diagnosticTestSingleton = &G2DiagnosticServer{} @@ -134,6 +139,15 @@ func testErrorNoFail(test *testing.T, ctx context.Context, g2diagnostic G2Diagno func TestMain(m *testing.M) { err := setup() if err != nil { + if g2error.Is(err, g2error.G2Unrecoverable) { + fmt.Printf("\nUnrecoverable error detected. \n\n") + } + if g2error.Is(err, g2error.G2Retryable) { + fmt.Printf("\nRetryable error detected. \n\n") + } + if g2error.Is(err, g2error.G2BadUserInput) { + fmt.Printf("\nBad user input error detected. \n\n") + } fmt.Print(err) os.Exit(1) } @@ -151,12 +165,12 @@ func setupSenzingConfig(ctx context.Context, moduleName string, iniParams string aG2config := &g2config.G2config{} err := aG2config.Init(ctx, moduleName, iniParams, verboseLogging) if err != nil { - return localLogger.Error(5906, err) + return createError(5906, err) } configHandle, err := aG2config.Create(ctx) if err != nil { - return localLogger.Error(5907, err) + return createError(5907, err) } datasourceNames := []string{"CUSTOMERS", "REFERENCE", "WATCHLIST"} @@ -164,23 +178,23 @@ func setupSenzingConfig(ctx context.Context, moduleName string, iniParams string datasource := truthset.TruthsetDataSources[datasourceName] _, err := aG2config.AddDataSource(ctx, configHandle, datasource.Json) if err != nil { - return localLogger.Error(5908, err) + return createError(5908, err) } } configStr, err := aG2config.Save(ctx, configHandle) if err != nil { - return localLogger.Error(5909, err) + return createError(5909, err) } err = aG2config.Close(ctx, configHandle) if err != nil { - return localLogger.Error(5910, err) + return createError(5910, err) } err = aG2config.Destroy(ctx) if err != nil { - return localLogger.Error(5911, err) + return createError(5911, err) } // Persist the Senzing configuration to the Senzing repository. @@ -188,23 +202,23 @@ func setupSenzingConfig(ctx context.Context, moduleName string, iniParams string aG2configmgr := &g2configmgr.G2configmgr{} err = aG2configmgr.Init(ctx, moduleName, iniParams, verboseLogging) if err != nil { - return localLogger.Error(5912, err) + return createError(5912, err) } configComments := fmt.Sprintf("Created by g2diagnostic_test at %s", now.UTC()) configID, err := aG2configmgr.AddConfig(ctx, configStr, configComments) if err != nil { - return localLogger.Error(5913, err) + return createError(5913, err) } err = aG2configmgr.SetDefaultConfigID(ctx, configID) if err != nil { - return localLogger.Error(5914, err) + return createError(5914, err) } err = aG2configmgr.Destroy(ctx) if err != nil { - return localLogger.Error(5915, err) + return createError(5915, err) } return err } @@ -214,7 +228,7 @@ func setupAddRecords(ctx context.Context, moduleName string, iniParams string, v aG2engine := &g2engine.G2engine{} err := aG2engine.Init(ctx, moduleName, iniParams, verboseLogging) if err != nil { - return localLogger.Error(5916, err) + return createError(5916, err) } testRecordIds := []string{"1001", "1002", "1003", "1004", "1005", "1039", "1040"} @@ -222,13 +236,13 @@ func setupAddRecords(ctx context.Context, moduleName string, iniParams string, v testRecord := truthset.CustomerRecords[testRecordId] err := aG2engine.AddRecord(ctx, testRecord.DataSource, testRecord.Id, testRecord.Json, "G2Diagnostic_test") if err != nil { - return localLogger.Error(5917, err) + return createError(5917, err) } } err = aG2engine.Destroy(ctx) if err != nil { - return localLogger.Error(5918, err) + return createError(5918, err) } return err } @@ -237,54 +251,55 @@ func setupPurgeRepository(ctx context.Context, moduleName string, iniParams stri aG2engine := &g2engine.G2engine{} err := aG2engine.Init(ctx, moduleName, iniParams, verboseLogging) if err != nil { - return localLogger.Error(5903, err) + return createError(5903, err) } err = aG2engine.PurgeRepository(ctx) if err != nil { - return localLogger.Error(5904, err) + return createError(5904, err) } err = aG2engine.Destroy(ctx) if err != nil { - return localLogger.Error(5905, err) + return createError(5905, err) } return err } func setup() error { + var err error = nil ctx := context.TODO() moduleName := "Test module name" verboseLogging := 0 - localLogger, err := messagelogger.NewSenzingApiLogger(ProductId, IdMessages, IdStatuses, messagelogger.LevelInfo) + localLogger, err = messagelogger.NewSenzingApiLogger(ProductId, IdMessages, IdStatuses, messagelogger.LevelInfo) if err != nil { - return localLogger.Error(5901, err) + return createError(5901, err) } iniParams, err := g2engineconfigurationjson.BuildSimpleSystemConfigurationJson("") if err != nil { - return localLogger.Error(5902, err) + return createError(5902, err) } // Add Data Sources to Senzing configuration. err = setupSenzingConfig(ctx, moduleName, iniParams, verboseLogging) if err != nil { - return localLogger.Error(5920, err) + return createError(5920, err) } // Purge repository. err = setupPurgeRepository(ctx, moduleName, iniParams, verboseLogging) if err != nil { - return localLogger.Error(5921, err) + return createError(5921, err) } // Add records. err = setupAddRecords(ctx, moduleName, iniParams, verboseLogging) if err != nil { - return localLogger.Error(5922, err) + return createError(5922, err) } return err diff --git a/g2engineserver/g2engineserver.go b/g2engineserver/g2engineserver.go index 19a2297..bb2af83 100644 --- a/g2engineserver/g2engineserver.go +++ b/g2engineserver/g2engineserver.go @@ -1128,26 +1128,27 @@ func (server *G2EngineServer) StreamExportCSVEntityReport(request *g2pb.StreamEx ctx := stream.Context() entryTime := time.Now() g2engine := getG2engine() - rowsFetched := 0 - //get the query handle + // Get the query handle. + var queryHandle uintptr queryHandle, err = g2engine.ExportCSVEntityReport(ctx, request.GetCsvColumnList(), request.GetFlags()) if err != nil { return err } - //defer the CloseExport in case we exit early for any reason + // Defer the CloseExport in case we exit early for any reason. + defer func() { err = g2engine.CloseExport(ctx, queryHandle) if server.isTrace { server.traceExit(159, request, rowsFetched, err, time.Since(entryTime)) } - return }() - //stream the results + // Stream the results. + for { var fetchResult string fetchResult, err = g2engine.FetchNext(ctx, queryHandle) @@ -1178,26 +1179,27 @@ func (server *G2EngineServer) StreamExportJSONEntityReport(request *g2pb.StreamE ctx := stream.Context() entryTime := time.Now() g2engine := getG2engine() - rowsFetched := 0 - //get the query handle + // Get the query handle. + var queryHandle uintptr queryHandle, err = g2engine.ExportJSONEntityReport(ctx, request.GetFlags()) if err != nil { return err } - //defer the CloseExport in case we exit early for any reason + // Defer the CloseExport in case we exit early for any reason. + defer func() { err = g2engine.CloseExport(ctx, queryHandle) if server.isTrace { server.traceExit(162, request, rowsFetched, err, time.Since(entryTime)) } - return }() - //stream the results + // Stream the results. + for { var fetchResult string fetchResult, err = g2engine.FetchNext(ctx, queryHandle) diff --git a/g2engineserver/g2engineserver_test.go b/g2engineserver/g2engineserver_test.go index fa63cce..854f5ec 100644 --- a/g2engineserver/g2engineserver_test.go +++ b/g2engineserver/g2engineserver_test.go @@ -13,6 +13,7 @@ import ( "github.com/senzing/g2-sdk-go-base/g2config" "github.com/senzing/g2-sdk-go-base/g2configmgr" "github.com/senzing/g2-sdk-go-base/g2engine" + "github.com/senzing/g2-sdk-go/g2error" g2pb "github.com/senzing/g2-sdk-proto/go/g2engine" "github.com/senzing/go-common/g2engineconfigurationjson" "github.com/senzing/go-common/record" @@ -42,6 +43,10 @@ var ( // Internal functions // ---------------------------------------------------------------------------- +func createError(errorId int, err error) error { + return g2error.Cast(localLogger.Error(errorId, err), err) +} + func getTestObject(ctx context.Context, test *testing.T) G2EngineServer { if g2engineTestSingleton == nil { g2engineTestSingleton = &G2EngineServer{} @@ -158,6 +163,15 @@ func testErrorNoFail(test *testing.T, ctx context.Context, g2engine G2EngineServ func TestMain(m *testing.M) { err := setup() if err != nil { + if g2error.Is(err, g2error.G2Unrecoverable) { + fmt.Printf("\nUnrecoverable error detected. \n\n") + } + if g2error.Is(err, g2error.G2Retryable) { + fmt.Printf("\nRetryable error detected. \n\n") + } + if g2error.Is(err, g2error.G2BadUserInput) { + fmt.Printf("\nBad user input error detected. \n\n") + } fmt.Print(err) os.Exit(1) } @@ -175,12 +189,12 @@ func setupSenzingConfig(ctx context.Context, moduleName string, iniParams string aG2config := &g2config.G2config{} err := aG2config.Init(ctx, moduleName, iniParams, verboseLogging) if err != nil { - return localLogger.Error(5906, err) + return createError(5906, err) } configHandle, err := aG2config.Create(ctx) if err != nil { - return localLogger.Error(5907, err) + return createError(5907, err) } datasourceNames := []string{"CUSTOMERS", "REFERENCE", "WATCHLIST"} @@ -188,23 +202,23 @@ func setupSenzingConfig(ctx context.Context, moduleName string, iniParams string datasource := truthset.TruthsetDataSources[datasourceName] _, err := aG2config.AddDataSource(ctx, configHandle, datasource.Json) if err != nil { - return localLogger.Error(5908, err) + return createError(5908, err) } } configStr, err := aG2config.Save(ctx, configHandle) if err != nil { - return localLogger.Error(5909, err) + return createError(5909, err) } err = aG2config.Close(ctx, configHandle) if err != nil { - return localLogger.Error(5910, err) + return createError(5910, err) } err = aG2config.Destroy(ctx) if err != nil { - return localLogger.Error(5911, err) + return createError(5911, err) } // Persist the Senzing configuration to the Senzing repository. @@ -212,23 +226,23 @@ func setupSenzingConfig(ctx context.Context, moduleName string, iniParams string aG2configmgr := &g2configmgr.G2configmgr{} err = aG2configmgr.Init(ctx, moduleName, iniParams, verboseLogging) if err != nil { - return localLogger.Error(5912, err) + return createError(5912, err) } configComments := fmt.Sprintf("Created by g2diagnostic_test at %s", now.UTC()) configID, err := aG2configmgr.AddConfig(ctx, configStr, configComments) if err != nil { - return localLogger.Error(5913, err) + return createError(5913, err) } err = aG2configmgr.SetDefaultConfigID(ctx, configID) if err != nil { - return localLogger.Error(5914, err) + return createError(5914, err) } err = aG2configmgr.Destroy(ctx) if err != nil { - return localLogger.Error(5915, err) + return createError(5915, err) } return err } @@ -237,47 +251,48 @@ func setupPurgeRepository(ctx context.Context, moduleName string, iniParams stri aG2engine := &g2engine.G2engine{} err := aG2engine.Init(ctx, moduleName, iniParams, verboseLogging) if err != nil { - return localLogger.Error(5903, err) + return createError(5903, err) } err = aG2engine.PurgeRepository(ctx) if err != nil { - return localLogger.Error(5904, err) + return createError(5904, err) } err = aG2engine.Destroy(ctx) if err != nil { - return localLogger.Error(5905, err) + return createError(5905, err) } return err } func setup() error { + var err error = nil ctx := context.TODO() moduleName := "Test module name" verboseLogging := 0 - localLogger, err := messagelogger.NewSenzingApiLogger(ProductId, IdMessages, IdStatuses, messagelogger.LevelInfo) + localLogger, err = messagelogger.NewSenzingApiLogger(ProductId, IdMessages, IdStatuses, messagelogger.LevelInfo) if err != nil { - return localLogger.Error(5901, err) + return createError(5901, err) } iniParams, err := g2engineconfigurationjson.BuildSimpleSystemConfigurationJson("") if err != nil { - return localLogger.Error(5902, err) + return createError(5902, err) } // Add Data Sources to Senzing configuration. err = setupSenzingConfig(ctx, moduleName, iniParams, verboseLogging) if err != nil { - return localLogger.Error(5920, err) + return createError(5920, err) } // Purge repository. err = setupPurgeRepository(ctx, moduleName, iniParams, verboseLogging) if err != nil { - return localLogger.Error(5921, err) + return createError(5921, err) } return err } From 68b196895ba5074032e4113104ebb2aea3c0f078 Mon Sep 17 00:00:00 2001 From: docktermj Date: Wed, 22 Mar 2023 18:01:37 -0400 Subject: [PATCH 03/17] #55 Update test cases --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f1ef1c..092eb1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - +## [0.3.9] - 2023-03-22 + +### Added in 0.3.9 + +- Update dependencies + ## [0.3.8] - 2023-03-14 ### Changed in 0.3.8 From 443954747c41b532a773960fa8f504447c33660e Mon Sep 17 00:00:00 2001 From: docktermj Date: Thu, 23 Mar 2023 09:34:27 -0400 Subject: [PATCH 04/17] #55 Improve documentation --- docs/development.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/development.md b/docs/development.md index 9d90957..c6995a9 100644 --- a/docs/development.md +++ b/docs/development.md @@ -59,6 +59,18 @@ Since the Senzing library is a prerequisite, it must be installed first. ``` +## Run + +1. After building, run: + + ```console + export LD_LIBRARY_PATH=/opt/senzing/g2/lib/ + ${GIT_REPOSITORY_DIR}/target/linux/servegrpc + + ``` + +## Test + ### Test using SQLite database 1. Run tests. From ea2a24f60eb275bc1f91e970e6f2adfcb43ff370 Mon Sep 17 00:00:00 2001 From: docktermj Date: Thu, 23 Mar 2023 09:41:56 -0400 Subject: [PATCH 05/17] #55 Improve documentation --- docs/development.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/docs/development.md b/docs/development.md index c6995a9..3d296fe 100644 --- a/docs/development.md +++ b/docs/development.md @@ -61,7 +61,24 @@ Since the Senzing library is a prerequisite, it must be installed first. ## Run -1. After building, run: +After running `make build`, +the binary built can be run. + +1. :pencil2: Identify the database by setting the `SENZING_TOOLS_DATABASE_URL` environment variable. + Examples: + + ```console + export SENZING_TOOLS_DATABASE_URL=sqlite3://na:na@/tmp/sqlite/G2C.db + + ```` + + ```console + export SENZING_TOOLS_DATABASE_URL=postgresql://postgres:postgres@${LOCAL_IP_ADDRESS}:5432/G2/?sslmode=disable + + ``` + +1. Set `LD_LIBRARY_PATH` and run the command. + Example: ```console export LD_LIBRARY_PATH=/opt/senzing/g2/lib/ From de3951649f8d49c77c96513e5fa901d8901eaebe Mon Sep 17 00:00:00 2001 From: docktermj Date: Thu, 23 Mar 2023 09:53:11 -0400 Subject: [PATCH 06/17] #55 Improve documentation --- docs/development.md | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/docs/development.md b/docs/development.md index 3d296fe..b88621b 100644 --- a/docs/development.md +++ b/docs/development.md @@ -64,18 +64,27 @@ Since the Senzing library is a prerequisite, it must be installed first. After running `make build`, the binary built can be run. -1. :pencil2: Identify the database by setting the `SENZING_TOOLS_DATABASE_URL` environment variable. - Examples: +1. Identify the database by setting the `SENZING_TOOLS_DATABASE_URL` environment variable. - ```console - export SENZING_TOOLS_DATABASE_URL=sqlite3://na:na@/tmp/sqlite/G2C.db + 1. From scratch, create and initialize a Sqlite database. + Examples: - ```` + ```console + export DATABASE_DIRECTORY=/tmp/sqlite + mkdir -p ${DATABASE_DIRECTORY} + touch ${DATABASE_DIRECTORY}/G2C.db + export SENZING_TOOLS_DATABASE_URL=sqlite3://na:na@${DATABASE_DIRECTORY}/G2C.db + export LD_LIBRARY_PATH=/opt/senzing/g2/lib/ + senzing-tools initdatabase + ``` - ```console - export SENZING_TOOLS_DATABASE_URL=postgresql://postgres:postgres@${LOCAL_IP_ADDRESS}:5432/G2/?sslmode=disable + 1. :pencil2: Identify an existing PostgreSQL database. + Example: - ``` + ```console + export SENZING_TOOLS_DATABASE_URL=postgresql://postgres:postgres@${LOCAL_IP_ADDRESS}:5432/G2/?sslmode=disable + + ``` 1. Set `LD_LIBRARY_PATH` and run the command. Example: From 555600c515c4d10433eb4cbdfffa8fe13bf65b5f Mon Sep 17 00:00:00 2001 From: docktermj Date: Thu, 23 Mar 2023 14:23:05 -0400 Subject: [PATCH 07/17] #55 Improve documentation --- docs/development.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/docs/development.md b/docs/development.md index b88621b..d46f250 100644 --- a/docs/development.md +++ b/docs/development.md @@ -66,14 +66,11 @@ the binary built can be run. 1. Identify the database by setting the `SENZING_TOOLS_DATABASE_URL` environment variable. - 1. From scratch, create and initialize a Sqlite database. + 1. :pencil2: Create a new Sqlite database. Examples: ```console - export DATABASE_DIRECTORY=/tmp/sqlite - mkdir -p ${DATABASE_DIRECTORY} - touch ${DATABASE_DIRECTORY}/G2C.db - export SENZING_TOOLS_DATABASE_URL=sqlite3://na:na@${DATABASE_DIRECTORY}/G2C.db + export SENZING_TOOLS_DATABASE_URL=sqlite3://na:na@/tmp/sqlite/G2C.db export LD_LIBRARY_PATH=/opt/senzing/g2/lib/ senzing-tools initdatabase ``` From e0c2a8cb396a1178ccfe5859c1efb19a976bcd14 Mon Sep 17 00:00:00 2001 From: docktermj Date: Thu, 23 Mar 2023 14:25:24 -0400 Subject: [PATCH 08/17] #55 Update dependencies --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 97f9269..9efde0d 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/senzing/go-common v0.1.2 github.com/senzing/go-logging v1.1.3 github.com/senzing/go-observing v0.2.0 - github.com/senzing/senzing-tools v0.1.4 + github.com/senzing/senzing-tools v0.1.5 github.com/spf13/cobra v1.6.1 github.com/spf13/viper v1.15.0 github.com/stretchr/testify v1.8.2 @@ -37,7 +37,7 @@ require ( golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.6.0 // indirect golang.org/x/text v0.8.0 // indirect - google.golang.org/genproto v0.0.0-20230322174352-cde4c949918d // indirect + google.golang.org/genproto v0.0.0-20230323172734-21a4fbf068fa // indirect google.golang.org/protobuf v1.30.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/go.sum b/go.sum index 3f3d3ad..f8281b9 100644 --- a/go.sum +++ b/go.sum @@ -169,8 +169,8 @@ github.com/senzing/go-logging v1.1.3 h1:eTWuEgI+4bwyS0gSpYKNbz8gL8ATAqByA3q1sbRJ github.com/senzing/go-logging v1.1.3/go.mod h1:FarStyY/kYd7+ymtawOXvOk48j/6fHRZ8unSwpi4FzI= github.com/senzing/go-observing v0.2.0 h1:QTFFTaZJ/1S2u96N17w2aCh/AHGHSOZCwX+VNU5v6tc= github.com/senzing/go-observing v0.2.0/go.mod h1:M5zrUXIYC4dL1fevBezB+aXIaU6uut/wynlQ93OcZhg= -github.com/senzing/senzing-tools v0.1.4 h1:ubixuMJEEej/6v4bmKTvqDYNuGoVl8pf51iEj0ctvpE= -github.com/senzing/senzing-tools v0.1.4/go.mod h1:7xHqJlD9xTkDxGMvrtaCMZu+pBPQCyDzbFyOMOC01XI= +github.com/senzing/senzing-tools v0.1.5 h1:nty0H3M+bGQcFD1deDFYwkSNugN1zwpc6E987tvlF+Y= +github.com/senzing/senzing-tools v0.1.5/go.mod h1:UXnBF3P5sB3Q5Sx3PlZuG2qZB336Rvb+9gysIa0LsEU= github.com/spf13/afero v1.9.5 h1:stMpOSZFs//0Lv29HduCmli3GUfpFoF3Y1Q/aXj/wVM= github.com/spf13/afero v1.9.5/go.mod h1:UBogFpq8E9Hx+xc5CNTTEpTnuHVmXDwZcZcE1eb/UhQ= github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= @@ -465,8 +465,8 @@ google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20230322174352-cde4c949918d h1:OE8TncEeAei3Tehf/P/Jdt/K+8GnTUrRY6wzYpbCes4= -google.golang.org/genproto v0.0.0-20230322174352-cde4c949918d/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s= +google.golang.org/genproto v0.0.0-20230323172734-21a4fbf068fa h1:XVBYwREW1uCFErFiWeyqyz+K0bDTAPWj/gvTC4zsml0= +google.golang.org/genproto v0.0.0-20230323172734-21a4fbf068fa/go.mod h1:L5DnnYzuVmyfoIL2tjtKQVgql48U0/Q4aiAMWkXKqMc= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= From c1f27b623821df077c17dad1e392ffee0a493bd0 Mon Sep 17 00:00:00 2001 From: docktermj Date: Mon, 27 Mar 2023 11:25:42 -0400 Subject: [PATCH 09/17] #55 change initdatabase to servegrpc --- cmd/root.go | 2 +- doc.go | 8 ++++---- docs/development.md | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index c6d9ca5..8d690b1 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -37,7 +37,7 @@ const ( var ( buildIteration string = "0" buildVersion string = "0.3.7" - defaultEngineModuleName string = fmt.Sprintf("initdatabase-%d", time.Now().Unix()) + defaultEngineModuleName string = fmt.Sprintf("servegrpc-%d", time.Now().Unix()) ) // If a configuration file is present, load it. diff --git a/doc.go b/doc.go index 98865f1..72dd8cc 100644 --- a/doc.go +++ b/doc.go @@ -7,7 +7,7 @@ One or two paragraph overview of this module... (This page describes the nature of the entire Go module or the top-level command, not an individual package.) -More information at https://github.com/senzing/initdatabase +More information at https://github.com/senzing/servegrpc # Example Package @@ -16,7 +16,7 @@ documentation, tests, and examples should be done. This paragraph (or two) should provide a brief overview while linking the reader to the documentation included in the package itself. -More information can be found in the [pkg/github.com/senzing/initdatabase/examplepackage] documentation. +More information can be found in the [pkg/github.com/senzing/servegrpc/examplepackage] documentation. # Another Header: Package or other module features... @@ -33,8 +33,8 @@ Examples of use can be seen in the main_test.go files. import ( fmt - "github.com/senzing/initdatabase/examplepackage" - "github.com/senzing/initdatabase/anotherpackage" + "github.com/senzing/servegrpc/examplepackage" + "github.com/senzing/servegrpc/anotherpackage" ) func main() { diff --git a/docs/development.md b/docs/development.md index 7221dd9..8114e3e 100644 --- a/docs/development.md +++ b/docs/development.md @@ -72,7 +72,7 @@ the binary built can be run. ```console export SENZING_TOOLS_DATABASE_URL=sqlite3://na:na@/tmp/sqlite/G2C.db export LD_LIBRARY_PATH=/opt/senzing/g2/lib/ - senzing-tools initdatabase + senzing-tools servegrpc ``` 1. :pencil2: Identify an existing PostgreSQL database. From fa87d4a976145a170aaba47d289c14a1035eb8cd Mon Sep 17 00:00:00 2001 From: docktermj Date: Mon, 27 Mar 2023 13:11:44 -0400 Subject: [PATCH 10/17] #55 Update dependencies --- CHANGELOG.md | 2 +- go.mod | 4 ++-- go.sum | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 092eb1f..5f7ec67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - -## [0.3.9] - 2023-03-22 +## [0.3.9] - 2023-03-27 ### Added in 0.3.9 diff --git a/go.mod b/go.mod index 915a540..8e0f938 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( github.com/aquilax/truncate v1.0.0 - github.com/senzing/g2-sdk-go v0.5.0 + github.com/senzing/g2-sdk-go v0.5.1 github.com/senzing/g2-sdk-go-base v0.1.3 github.com/senzing/g2-sdk-proto/go v0.0.0-20230315125947-e4aea8f381eb github.com/senzing/go-common v0.1.2 @@ -37,7 +37,7 @@ require ( golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.6.0 // indirect golang.org/x/text v0.8.0 // indirect - google.golang.org/genproto v0.0.0-20230323212658-478b75c54725 // indirect + google.golang.org/genproto v0.0.0-20230327152035-dc694ad2151e // indirect google.golang.org/protobuf v1.30.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/go.sum b/go.sum index c310c1a..14a9e5a 100644 --- a/go.sum +++ b/go.sum @@ -157,8 +157,8 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/senzing/g2-sdk-go v0.5.0 h1:rCHKr53i0mM/Vi3C6KjefDOqCTleFDIBviNWgZTsMbo= -github.com/senzing/g2-sdk-go v0.5.0/go.mod h1:SpYcLeU8slSpl76FDivuc8C7mD7Hw2uUkTgb6ANovlY= +github.com/senzing/g2-sdk-go v0.5.1 h1:d3stZ0NE9EXjN4PREBzKbI8Y5JxZlOPqHEzO2FPHXps= +github.com/senzing/g2-sdk-go v0.5.1/go.mod h1:SpYcLeU8slSpl76FDivuc8C7mD7Hw2uUkTgb6ANovlY= github.com/senzing/g2-sdk-go-base v0.1.3 h1:QI9KHJibkdgMLZvR43E15NTdWI775u7W1/0/1EYGJwM= github.com/senzing/g2-sdk-go-base v0.1.3/go.mod h1:dY1tc9MdIWyV9QWKBHRLBcU9gJCMytMZ9L4E8IoyD5I= github.com/senzing/g2-sdk-proto/go v0.0.0-20230315125947-e4aea8f381eb h1:ig302ScN/Z1u0Qv0ZAYxXrzGaZCpvCdfE/wwZuCIykM= @@ -465,8 +465,8 @@ google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20230323212658-478b75c54725 h1:VmCWItVXcKboEMCwZaWge+1JLiTCQSngZeINF+wzO+g= -google.golang.org/genproto v0.0.0-20230323212658-478b75c54725/go.mod h1:UUQDJDOlWu4KYeJZffbWgBkS1YFobzKbLVfK69pe0Ak= +google.golang.org/genproto v0.0.0-20230327152035-dc694ad2151e h1:rRGPYd0STm9H4Ci+iGrSLG35mkAKY41/nzCcG7PQADw= +google.golang.org/genproto v0.0.0-20230327152035-dc694ad2151e/go.mod h1:UUQDJDOlWu4KYeJZffbWgBkS1YFobzKbLVfK69pe0Ak= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= From f46fc32b14af973f349e563d62b33a3b539fec2d Mon Sep 17 00:00:00 2001 From: docktermj Date: Mon, 27 Mar 2023 13:14:37 -0400 Subject: [PATCH 11/17] #55 Update dependencies --- docs/development.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/development.md b/docs/development.md index 8114e3e..7221dd9 100644 --- a/docs/development.md +++ b/docs/development.md @@ -72,7 +72,7 @@ the binary built can be run. ```console export SENZING_TOOLS_DATABASE_URL=sqlite3://na:na@/tmp/sqlite/G2C.db export LD_LIBRARY_PATH=/opt/senzing/g2/lib/ - senzing-tools servegrpc + senzing-tools initdatabase ``` 1. :pencil2: Identify an existing PostgreSQL database. From fd52341bb7a05313bf1ef45d82d61b4a8cbaf063 Mon Sep 17 00:00:00 2001 From: docktermj Date: Mon, 27 Mar 2023 13:34:45 -0400 Subject: [PATCH 12/17] #55 Update dependencies --- docs/development.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/development.md b/docs/development.md index 7221dd9..b0cb234 100644 --- a/docs/development.md +++ b/docs/development.md @@ -50,15 +50,6 @@ Since the Senzing library is a prerequisite, it must be installed first. ``` -1. Clean up. - Example: - - ```console - cd ${GIT_REPOSITORY_DIR} - make clean - - ``` - ## Run After running `make build`, @@ -377,4 +368,13 @@ The actual packaging is done in the [senzing-tools](https://github.com/Senzing/s ``` -### FIXME: remove +### Cleanup + +1. Clean up. + Example: + + ```console + cd ${GIT_REPOSITORY_DIR} + make clean + + ``` From e456de9c58c3c54bd00c233550cb60af0c09dd51 Mon Sep 17 00:00:00 2001 From: docktermj Date: Mon, 27 Mar 2023 13:49:20 -0400 Subject: [PATCH 13/17] #55 Update dependencies --- Makefile | 9 ++++++--- docs/development.md | 3 ++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 5fbafe0..da22438 100644 --- a/Makefile +++ b/Makefile @@ -150,6 +150,12 @@ run-servegrpc-trace: build # Utility targets # ----------------------------------------------------------------------------- +.PHONY: new-sqlite +new-sqlite: + @rm -rf /tmp/sqlite + @mkdir /tmp/sqlite + @cp testdata/sqlite/G2C.db /tmp/sqlite/G2C.db + .PHONY: update-pkg-cache update-pkg-cache: @GOPROXY=https://proxy.golang.org GO111MODULE=on \ @@ -164,9 +170,6 @@ clean: @docker rmi --force $(DOCKER_IMAGE_NAME) $(DOCKER_BUILD_IMAGE_NAME) 2> /dev/null || true @rm -rf $(TARGET_DIRECTORY) || true @rm -f $(GOPATH)/bin/$(PROGRAM_NAME) || true - @rm -rf /tmp/sqlite - @mkdir /tmp/sqlite - @cp testdata/sqlite/G2C.db /tmp/sqlite/G2C.db .PHONY: print-make-variables diff --git a/docs/development.md b/docs/development.md index b0cb234..14103d6 100644 --- a/docs/development.md +++ b/docs/development.md @@ -64,6 +64,7 @@ the binary built can be run. export SENZING_TOOLS_DATABASE_URL=sqlite3://na:na@/tmp/sqlite/G2C.db export LD_LIBRARY_PATH=/opt/senzing/g2/lib/ senzing-tools initdatabase + ``` 1. :pencil2: Identify an existing PostgreSQL database. @@ -91,7 +92,7 @@ the binary built can be run. ```console cd ${GIT_REPOSITORY_DIR} - make clean test + make clean new-sqlite test ``` From 59999dbef246fa11fef07addc1d3b979c2e17525 Mon Sep 17 00:00:00 2001 From: docktermj Date: Mon, 27 Mar 2023 13:57:30 -0400 Subject: [PATCH 14/17] #55 Update dependencies --- docs/development.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/development.md b/docs/development.md index 14103d6..1f086ff 100644 --- a/docs/development.md +++ b/docs/development.md @@ -71,6 +71,7 @@ the binary built can be run. Example: ```console + export LOCAL_IP_ADDRESS=$(curl --silent https://raw.githubusercontent.com/Senzing/knowledge-base/main/gists/find-local-ip-address/find-local-ip-address.py | python3 -) export SENZING_TOOLS_DATABASE_URL=postgresql://postgres:postgres@${LOCAL_IP_ADDRESS}:5432/G2/?sslmode=disable ``` From df88e43ea51f8de9dc19c8b952a7e7c70915a137 Mon Sep 17 00:00:00 2001 From: docktermj Date: Tue, 28 Mar 2023 10:28:06 -0400 Subject: [PATCH 15/17] #55 Add go-test.yaml --- .github/workflows/go-test.yaml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/go-test.yaml diff --git a/.github/workflows/go-test.yaml b/.github/workflows/go-test.yaml new file mode 100644 index 0000000..15d9256 --- /dev/null +++ b/.github/workflows/go-test.yaml @@ -0,0 +1,34 @@ +# Based on +# -https://github.com/marketplace/actions/setup-go-environment + +name: go-test.yaml + +on: [push] + +env: + LD_LIBRARY_PATH: /opt/senzing/g2/lib + SENZING_ACCEPT_EULA: I_ACCEPT_THE_SENZING_EULA + SENZING_TOOLS_DATABASE_URL: "sqlite3://na:na@/tmp/sqlite/G2C.db" + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + go: ["1.20"] + name: Go ${{ matrix.go }} sample + steps: + - uses: actions/checkout@v3 + - name: Setup go + uses: actions/setup-go@v4 + with: + go-version: ${{ matrix.go }} + - run: pwd + - run: go test -v -p 1 ./... + # - run: go test -v ./. + # - run: go test -v ./g2config + # - run: go test -v ./g2configmgr + # - run: go test -v ./g2diagnostic + # - run: go test -v ./g2engine + # - run: go test -v ./g2product + # - run: go test -v ./helper From 0fdc734078adadd1c1ff4dde711126e1a4636440 Mon Sep 17 00:00:00 2001 From: docktermj Date: Tue, 28 Mar 2023 10:32:26 -0400 Subject: [PATCH 16/17] #55 Add go-test.yaml --- .github/workflows/go-test.yaml | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/.github/workflows/go-test.yaml b/.github/workflows/go-test.yaml index 15d9256..17ccba9 100644 --- a/.github/workflows/go-test.yaml +++ b/.github/workflows/go-test.yaml @@ -24,11 +24,26 @@ jobs: with: go-version: ${{ matrix.go }} - run: pwd + - run: wget -qO /tmp/senzingrepo_1.0.1-1_amd64.deb https://senzing-production-apt.s3.amazonaws.com/senzingrepo_1.0.1-1_amd64.deb + - run: sudo apt-get -y install /tmp/senzingrepo_1.0.1-1_amd64.deb + - run: sudo apt-get update + - run: sudo --preserve-env apt-get -y install senzingapi + - run: sudo mv /opt/senzing/data/3.0.0/* /opt/senzing/data/ + - run: sudo mkdir /etc/opt/senzing + - run: sudo cp /opt/senzing/g2/resources/templates/cfgVariant.json /etc/opt/senzing + - run: sudo cp /opt/senzing/g2/resources/templates/customGn.txt /etc/opt/senzing + - run: sudo cp /opt/senzing/g2/resources/templates/customOn.txt /etc/opt/senzing + - run: sudo cp /opt/senzing/g2/resources/templates/customSn.txt /etc/opt/senzing + - run: sudo cp /opt/senzing/g2/resources/templates/defaultGNRCP.config /etc/opt/senzing + - run: sudo cp /opt/senzing/g2/resources/templates/stb.config /etc/opt/senzing + - run: sudo cp testdata/senzing-license/g2.lic /etc/opt/senzing + - run: mkdir /tmp/sqlite + - run: cp testdata/sqlite/G2C.db /tmp/sqlite/G2C.db - run: go test -v -p 1 ./... # - run: go test -v ./. - # - run: go test -v ./g2config - # - run: go test -v ./g2configmgr - # - run: go test -v ./g2diagnostic - # - run: go test -v ./g2engine - # - run: go test -v ./g2product - # - run: go test -v ./helper + # - run: go test -v ./g2configserver + # - run: go test -v ./g2configmgrserver + # - run: go test -v ./g2diagnosticserver + # - run: go test -v ./g2engineserver + # - run: go test -v ./g2productserver + # - run: go test -v ./grpcserver From f90a0813dd8cd70b7146ec51c9512a5bd72187ec Mon Sep 17 00:00:00 2001 From: docktermj Date: Tue, 28 Mar 2023 10:43:27 -0400 Subject: [PATCH 17/17] #55 Prepare for versioned release --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f7ec67..fc05fe4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added in 0.3.9 +- Added Stream methods + - g2diagnosticserver.StreamEntityListBySize() + - g2engineserver.StreamExportCSVEntityReport() + - g2engineserver.StreamExportJSONEntityReport() - Update dependencies ## [0.3.8] - 2023-03-14