Moved generic and broadly useful helper functions upstream into feedkit
All checks were successful
ci/woodpecker/push/build-image Pipeline was successful
All checks were successful
ci/woodpecker/push/build-image Pipeline was successful
This commit is contained in:
@@ -7,10 +7,11 @@ import (
|
||||
"time"
|
||||
|
||||
"gitea.maximumdirect.net/ejr/feedkit/config"
|
||||
fksinks "gitea.maximumdirect.net/ejr/feedkit/sinks"
|
||||
)
|
||||
|
||||
func TestRegisterPostgresSchemasNilConfig(t *testing.T) {
|
||||
err := RegisterPostgresSchemas(nil)
|
||||
err := fksinks.RegisterPostgresSchemaForConfiguredSinks(nil, PostgresSchema())
|
||||
if err == nil {
|
||||
t.Fatalf("RegisterPostgresSchemas(nil) expected error")
|
||||
}
|
||||
@@ -27,7 +28,7 @@ func TestRegisterPostgresSchemasNonPostgresNoOp(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
if err := RegisterPostgresSchemas(cfg); err != nil {
|
||||
if err := fksinks.RegisterPostgresSchemaForConfiguredSinks(cfg, PostgresSchema()); err != nil {
|
||||
t.Fatalf("RegisterPostgresSchemas(non-postgres) error = %v", err)
|
||||
}
|
||||
}
|
||||
@@ -40,11 +41,11 @@ func TestRegisterPostgresSchemasDuplicateRegistrationFails(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
if err := RegisterPostgresSchemas(cfg); err != nil {
|
||||
if err := fksinks.RegisterPostgresSchemaForConfiguredSinks(cfg, PostgresSchema()); err != nil {
|
||||
t.Fatalf("first RegisterPostgresSchemas() error = %v", err)
|
||||
}
|
||||
|
||||
err := RegisterPostgresSchemas(cfg)
|
||||
err := fksinks.RegisterPostgresSchemaForConfiguredSinks(cfg, PostgresSchema())
|
||||
if err == nil {
|
||||
t.Fatalf("second RegisterPostgresSchemas() expected duplicate error")
|
||||
}
|
||||
@@ -54,9 +55,9 @@ func TestRegisterPostgresSchemasDuplicateRegistrationFails(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestWeatherPostgresSchemaShape(t *testing.T) {
|
||||
s := weatherPostgresSchema()
|
||||
s := PostgresSchema()
|
||||
if s.MapEvent == nil {
|
||||
t.Fatalf("weatherPostgresSchema().MapEvent is nil")
|
||||
t.Fatalf("PostgresSchema().MapEvent is nil")
|
||||
}
|
||||
|
||||
wantTables := map[string]bool{
|
||||
@@ -70,7 +71,7 @@ func TestWeatherPostgresSchemaShape(t *testing.T) {
|
||||
}
|
||||
|
||||
if len(s.Tables) != len(wantTables) {
|
||||
t.Fatalf("weatherPostgresSchema().Tables len = %d, want %d", len(s.Tables), len(wantTables))
|
||||
t.Fatalf("PostgresSchema().Tables len = %d, want %d", len(s.Tables), len(wantTables))
|
||||
}
|
||||
|
||||
seenIndexes := map[string]bool{}
|
||||
|
||||
Reference in New Issue
Block a user