refactor: remove unused ctx from resolveAllowedNetworkIDs function and related tests

This commit is contained in:
Nirmal N R
2026-04-02 10:54:38 +05:30
parent db330663bd
commit 8997b0e802
2 changed files with 4 additions and 6 deletions

View File

@@ -36,7 +36,7 @@ func (d dediRegistryProvider) New(ctx context.Context, config map[string]string)
}
}
allowedNetworkIDs, err := resolveAllowedNetworkIDs(ctx, config)
allowedNetworkIDs, err := resolveAllowedNetworkIDs(config)
if err != nil {
return nil, nil, err
}
@@ -67,7 +67,7 @@ func parseAllowedNetworkIDs(raw string) []string {
return networkIDs
}
func resolveAllowedNetworkIDs(ctx context.Context, config map[string]string) ([]string, error) {
func resolveAllowedNetworkIDs(config map[string]string) ([]string, error) {
if rawParentNamespaces, exists := config["allowedParentNamespaces"]; exists && rawParentNamespaces != "" {
if _, hasAllowedNetworkIDs := config["allowedNetworkIDs"]; !hasAllowedNetworkIDs {
return nil, fmt.Errorf("config key 'allowedParentNamespaces' is no longer supported; use 'allowedNetworkIDs' with full network IDs")

View File

@@ -108,12 +108,11 @@ func TestParseAllowedNetworkIDs(t *testing.T) {
}
func TestResolveAllowedNetworkIDs_DeprecatedAllowedParentNamespacesErrorsWithoutAllowedNetworkIDs(t *testing.T) {
ctx := context.Background()
config := map[string]string{
"allowedParentNamespaces": "commerce-network.org/prod, local-commerce.org/production",
}
got, err := resolveAllowedNetworkIDs(ctx, config)
got, err := resolveAllowedNetworkIDs(config)
if err == nil {
t.Fatal("expected error when only allowedParentNamespaces is configured")
}
@@ -123,7 +122,6 @@ func TestResolveAllowedNetworkIDs_DeprecatedAllowedParentNamespacesErrorsWithout
}
func TestResolveAllowedNetworkIDs_AllowedNetworkIDsTakesPrecedence(t *testing.T) {
ctx := context.Background()
config := map[string]string{
"url": "https://test.com/dedi",
"registryName": "subscribers.beckn.one",
@@ -131,7 +129,7 @@ func TestResolveAllowedNetworkIDs_AllowedNetworkIDsTakesPrecedence(t *testing.T)
"allowedNetworkIDs": "commerce-network.org/prod, local-commerce.org/production",
}
got, err := resolveAllowedNetworkIDs(ctx, config)
got, err := resolveAllowedNetworkIDs(config)
if err != nil {
t.Fatalf("expected no error, got %v", err)
}