Enforce ManagedAPIKey for resource ID flag
RequiresManagedResourceID only has meaning for a ManagedAPIKey provider: ManagedConnectorReady consults it exclusively on that path. A non-managed provider that set it would advertise normally with the requirement silently doing nothing. Reject the combination at registration, matching the ManagedAPIKey/SupportsAPIKey mutual-exclusion guard already in Register, and cover it with a TestRegistry_Register subtest. Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
This commit is contained in:
@@ -138,6 +138,19 @@ func TestRegistry_Register(t *testing.T) {
|
||||
assert.Contains(t, err.Error(), "mutually exclusive")
|
||||
})
|
||||
|
||||
t.Run("RequiresManagedResourceID requires ManagedAPIKey", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
r := provider.NewRegistry()
|
||||
err := r.Register(&provider.Registration{
|
||||
Provider: coredata.ConnectorProviderSlack,
|
||||
DisplayName: "Slack",
|
||||
RequiresManagedResourceID: true,
|
||||
})
|
||||
require.Error(t, err)
|
||||
assert.Contains(t, err.Error(), "RequiresManagedResourceID requires ManagedAPIKey")
|
||||
})
|
||||
|
||||
t.Run("duplicate registration", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user