Updates to track upstream feedkit v0.8.2
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:
@@ -1,58 +1,6 @@
|
||||
package postgres
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"gitea.maximumdirect.net/ejr/feedkit/config"
|
||||
fksinks "gitea.maximumdirect.net/ejr/feedkit/sinks"
|
||||
)
|
||||
|
||||
func TestRegisterPostgresSchemasNilConfig(t *testing.T) {
|
||||
err := fksinks.RegisterPostgresSchemaForConfiguredSinks(nil, PostgresSchema())
|
||||
if err == nil {
|
||||
t.Fatalf("RegisterPostgresSchemas(nil) expected error")
|
||||
}
|
||||
if !strings.Contains(err.Error(), "config is nil") {
|
||||
t.Fatalf("error = %q, want config is nil", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRegisterPostgresSchemasNonPostgresNoOp(t *testing.T) {
|
||||
cfg := &config.Config{
|
||||
Sinks: []config.SinkConfig{
|
||||
{Name: "stdout_only", Driver: "stdout"},
|
||||
{Name: "nats_only", Driver: "nats"},
|
||||
},
|
||||
}
|
||||
|
||||
if err := fksinks.RegisterPostgresSchemaForConfiguredSinks(cfg, PostgresSchema()); err != nil {
|
||||
t.Fatalf("RegisterPostgresSchemas(non-postgres) error = %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRegisterPostgresSchemasDuplicateRegistrationFails(t *testing.T) {
|
||||
sinkName := uniqueSinkName("pg_test")
|
||||
cfg := &config.Config{
|
||||
Sinks: []config.SinkConfig{
|
||||
{Name: sinkName, Driver: "postgres"},
|
||||
},
|
||||
}
|
||||
|
||||
if err := fksinks.RegisterPostgresSchemaForConfiguredSinks(cfg, PostgresSchema()); err != nil {
|
||||
t.Fatalf("first RegisterPostgresSchemas() error = %v", err)
|
||||
}
|
||||
|
||||
err := fksinks.RegisterPostgresSchemaForConfiguredSinks(cfg, PostgresSchema())
|
||||
if err == nil {
|
||||
t.Fatalf("second RegisterPostgresSchemas() expected duplicate error")
|
||||
}
|
||||
if !strings.Contains(err.Error(), "already registered") {
|
||||
t.Fatalf("error = %q, want already registered", err)
|
||||
}
|
||||
}
|
||||
import "testing"
|
||||
|
||||
func TestWeatherPostgresSchemaShape(t *testing.T) {
|
||||
s := PostgresSchema()
|
||||
@@ -90,7 +38,3 @@ func TestWeatherPostgresSchemaShape(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func uniqueSinkName(prefix string) string {
|
||||
return fmt.Sprintf("%s_%d", prefix, time.Now().UnixNano())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user