@Override
    public ElasticAgentPluginInfo pluginInfoFor(GoPluginDescriptor descriptor) {
        String pluginId = descriptor.id();

        PluggableInstanceSettings pluggableInstanceSettings = null;
        if (!extension.supportsClusterProfiles(pluginId)) {
            pluggableInstanceSettings = getPluginSettingsAndView(descriptor, extension);
        }

        return new ElasticAgentPluginInfo(descriptor,
                elasticElasticAgentProfileSettings(pluginId),
                elasticClusterProfileSettings(pluginId),
                image(pluginId),
                pluggableInstanceSettings,
                capabilities(pluginId));
    }
@Test
    public void shouldFetchPluginSettingsForPluginsNotSupportingClusterProfiles() {
        GoPluginDescriptor descriptor = GoPluginDescriptor.builder().id("plugin1").build();

        PluginSettingsConfiguration pluginSettingsConfiguration = new PluginSettingsConfiguration();
        pluginSettingsConfiguration.add(new PluginSettingsProperty("ami-id", "ami-123"));

        when(extension.getPluginSettingsConfiguration(descriptor.id())).thenReturn(pluginSettingsConfiguration);
        when(extension.getPluginSettingsView(descriptor.id())).thenReturn("some html");

        when(extension.supportsClusterProfiles("plugin1")).thenReturn(false);

        ElasticAgentPluginInfoBuilder builder = new ElasticAgentPluginInfoBuilder(extension);
        ElasticAgentPluginInfo pluginInfo = builder.pluginInfoFor(descriptor);

        assertThat(pluginInfo.getPluginSettings(), is(new PluggableInstanceSettings(builder.configurations(pluginSettingsConfiguration), new PluginView("some html"))));
    }