Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleanup pluginmanager of unused feature flag code (#484)
This commit removes all the unused code around feature flags from the `manager.go` file. Those changes are: 1. Remove `ValidatePlugin()` which was never used. There is a separate copy of this function in the tanzu-plugin-runtime repository. 2. Remove `discoverPlugins()` and directly use `discoverSpecificPlugins()` 3. Remove `discoverServerPluginsBasedOnCurrentServer` which is no longer used. 4. Include the logic of `discoverServerPluginsBasedOnAllCurrentContexts()` directly into `DiscoverServerPlugins()` which had become a one-liner. 5. Remove the following functions that were no longer used: - `AvailablePlugins()` - `AvailablePluginsFromLocalSource()` - `availablePlugins()` - `combineDuplicatePlugins()` - `getInstalledButNotDiscoveredStandalonePlugins()` - `DiscoveredFromPlugininfo()` - `availablePluginsFromStandaloneAndServerPlugins()` - `pluginIndexForName()` - `legacyPluginInstall()` - `GetRecommendedVersionOfPlugin()` Completely remove the feature flag constant: FeatureDisableCentralRepositoryForTesting * Update the unit tests for the plugin manager. This commit improves our ability to test the pluginmanager. It does this using two techniques: 1. Creating a test plugin inventory DB in the cache and requesting the inventory code to always use the cache (without checking the digest). To force the use of the cache the commit introduces a test variable `TEST_TANZU_CLI_USE_DB_CACHE_ONLY`. This approach allows to discover plugins and groups without needing a real OCI registry. 2. Creating "fake" plugin binaries in the plugin binary cache. This allows installation of plugins to find the binaries in the cache and therefore never have to go to an OCI registry to download them. With these two techniques, the unit tests can discovery and install plugins, and can also do so using groups. The plugin sync can also be tested with this. Note: the unit tests would still benefit from some tests moving to this approach of testing, but this will need to come in a future effort. Signed-off-by: Marc Khouzam <[email protected]>
- Loading branch information