feat(t222): add freight ingestion admin flow
This commit is contained in:
@@ -42,18 +42,30 @@ func TestLoadUsesSafeDefaults(t *testing.T) {
|
||||
if cfg.ShutdownTimeout > 30*time.Second {
|
||||
t.Fatalf("ShutdownTimeout = %s", cfg.ShutdownTimeout)
|
||||
}
|
||||
if cfg.ERPConnectorURL != "http://127.0.0.1:8091" ||
|
||||
cfg.ERPConnectorAPIKey != "" ||
|
||||
cfg.ERPConnectorTimeout != 90*time.Second {
|
||||
t.Fatalf(
|
||||
"ERP connector defaults = %q / %q / %s",
|
||||
cfg.ERPConnectorURL,
|
||||
cfg.ERPConnectorAPIKey,
|
||||
cfg.ERPConnectorTimeout,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
func TestLoadAcceptsExplicitConfiguration(t *testing.T) {
|
||||
values := map[string]string{
|
||||
HTTPAddressEnvironment: "192.0.2.10:9090",
|
||||
DatabasePathEnvironment: "tmp/test.db",
|
||||
AssetDirectoryEnvironment: "tmp/assets",
|
||||
TLSCertificateEnvironment: "tmp/server.crt",
|
||||
TLSPrivateKeyEnvironment: "tmp/server.key",
|
||||
ClaimLeaseEnvironment: "15m",
|
||||
RunningLeaseEnvironment: "45m",
|
||||
ReadinessTTLEnvironment: "3m",
|
||||
HTTPAddressEnvironment: "192.0.2.10:9090",
|
||||
DatabasePathEnvironment: "tmp/test.db",
|
||||
AssetDirectoryEnvironment: "tmp/assets",
|
||||
TLSCertificateEnvironment: "tmp/server.crt",
|
||||
TLSPrivateKeyEnvironment: "tmp/server.key",
|
||||
ClaimLeaseEnvironment: "15m",
|
||||
RunningLeaseEnvironment: "45m",
|
||||
ReadinessTTLEnvironment: "3m",
|
||||
ERPConnectorURLEnvironment: "http://localhost:18091",
|
||||
ERPConnectorAPIKeyEnvironment: "12345678901234567890123456789012",
|
||||
}
|
||||
|
||||
cfg, err := Load(mapEnvironment(values))
|
||||
@@ -88,6 +100,14 @@ func TestLoadAcceptsExplicitConfiguration(t *testing.T) {
|
||||
cfg.ReadinessTTL,
|
||||
)
|
||||
}
|
||||
if cfg.ERPConnectorURL != values[ERPConnectorURLEnvironment] ||
|
||||
cfg.ERPConnectorAPIKey != values[ERPConnectorAPIKeyEnvironment] {
|
||||
t.Fatalf(
|
||||
"ERP connector = %q / %q",
|
||||
cfg.ERPConnectorURL,
|
||||
cfg.ERPConnectorAPIKey,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
func TestLoadRejectsUnsafeOrInvalidValues(t *testing.T) {
|
||||
@@ -95,6 +115,24 @@ func TestLoadRejectsUnsafeOrInvalidValues(t *testing.T) {
|
||||
name string
|
||||
values map[string]string
|
||||
}{
|
||||
{
|
||||
name: "non-loopback ERP connector",
|
||||
values: map[string]string{
|
||||
ERPConnectorURLEnvironment: "http://192.0.2.10:8091",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "ERP connector path",
|
||||
values: map[string]string{
|
||||
ERPConnectorURLEnvironment: "http://127.0.0.1:8091/private",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "short ERP connector key",
|
||||
values: map[string]string{
|
||||
ERPConnectorAPIKeyEnvironment: "short",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "blank explicit address",
|
||||
values: map[string]string{
|
||||
|
||||
Reference in New Issue
Block a user