From c61d7a132a233c18d6af2282fa550e6377cf5b3c Mon Sep 17 00:00:00 2001 From: Chandra Pamuluri Date: Wed, 18 Oct 2023 21:02:43 -0500 Subject: [PATCH] change --- pkg/common/constants.go | 3 +- .../tmc/plugin_sync_tmc_lifecycle_test.go | 83 +++++-------------- 2 files changed, 23 insertions(+), 63 deletions(-) diff --git a/pkg/common/constants.go b/pkg/common/constants.go index 221a42df1..d59a47786 100644 --- a/pkg/common/constants.go +++ b/pkg/common/constants.go @@ -30,8 +30,7 @@ const ( // Shared strings const ( - TargetList = "kubernetes[k8s]/mission-control[tmc]/global" - ContextTypeList = "kubernetes[k8s]/mission-control[tmc]/application-engine[tae]" + TargetList = "kubernetes[k8s]/mission-control[tmc]/global" ) // CoreName is the name of the core binary. diff --git a/test/e2e/plugin_sync/tmc/plugin_sync_tmc_lifecycle_test.go b/test/e2e/plugin_sync/tmc/plugin_sync_tmc_lifecycle_test.go index b3023a4f4..244a07485 100644 --- a/test/e2e/plugin_sync/tmc/plugin_sync_tmc_lifecycle_test.go +++ b/test/e2e/plugin_sync/tmc/plugin_sync_tmc_lifecycle_test.go @@ -775,67 +775,6 @@ var _ = f.CLICoreDescribe("[Tests:E2E][Feature:Plugin-Sync-TMC-lifecycle]", func Expect(err).To(BeNil(), noErrorForPluginList) }) - // Test case: sync specific contexType - k8s - // set both k8s and tmc context as active - // clean plugins - // perform contextType specific sync (k8s specific) - // sync should not happen for both context's even though both are active - // sync should happen only for the contextType specific context (k8s context) - It("sync specific contexType - k8s", func() { - err = tf.ContextCmd.UseContext(contextNameK8s) - Expect(err).To(BeNil(), "use context should not return any error") - - err = tf.ContextCmd.UseContext(contextNameTMC) - Expect(err).To(BeNil(), "use context should not return any error") - - err = tf.PluginCmd.CleanPlugins() - Expect(err).To(BeNil(), "plugin clean should not return any error") - - // run contextType specific sync - _, _, err = tf.PluginCmd.Sync(f.AddAdditionalFlagAndValue("--type k8s")) - Expect(err).To(BeNil(), "there should not be an error for plugin sync for k8s context") - // k8s contextType specific plugins only should be installed - installedPluginsListK8s, err = tf.PluginCmd.ListPluginsForGivenContext(contextNameK8s, true) - Expect(err).To(BeNil(), "should not get any error for plugin list") - Expect(f.CheckAllPluginsExists(installedPluginsListK8s, pluginsInfoForCRsApplied)).Should(BeTrue(), " plugins being installed and plugins info for which CRs applied should be same") - - // Sync should not happen for the tmc context specific plugins, as its contextType specific sync - installedPluginsListTMC, err = tf.PluginCmd.ListPluginsForGivenContext(contextNameTMC, true) - Expect(len(installedPluginsListTMC)).Should(Equal(0)) - Expect(err).To(BeNil(), noErrorForPluginList) - }) - - // Test case: sync specific contexType - TMC - // set both k8s and tmc context as active - // clean plugins - // perform contextType specific sync (tmc type) - // sync should not happen for both context's even though both are active - // sync should happen only for the contextType specific context (tmc context) - It("sync specific contexType - TMC", func() { - err = tf.ContextCmd.UseContext(contextNameK8s) - Expect(err).To(BeNil(), "use context should not return any error") - - err = tf.ContextCmd.UseContext(contextNameTMC) - Expect(err).To(BeNil(), "use context should not return any error") - - err = tf.PluginCmd.CleanPlugins() - Expect(err).To(BeNil(), "plugin clean should not return any error") - - // run contextType specific sync - _, _, err = tf.PluginCmd.Sync(f.AddAdditionalFlagAndValue("--type tmc")) - Expect(err).To(BeNil(), "there should not be an error for plugin sync for tmc context") - // tmc contextType specific plugins only should be installed - installedPluginsListTMC, err = tf.PluginCmd.ListPluginsForGivenContext(contextNameTMC, true) - Expect(err).To(BeNil(), noErrorForPluginList) - Expect(len(installedPluginsListTMC)).Should(Equal(len(pluginsToGenerateMockResponseTMC)), numberOfPluginsSameAsNoOfPluginsInfoMocked) - Expect(f.CheckAllPluginsExists(installedPluginsListTMC, pluginsToGenerateMockResponseTMC)).Should(BeTrue(), pluginsInstalledAndMockedShouldBeSame) - - // Sync should not happen for the k8s context specific plugins, as its contextType specific sync - installedPluginsListK8s, err = tf.PluginCmd.ListPluginsForGivenContext(contextNameK8s, true) - Expect(len(installedPluginsListK8s)).Should(Equal(0)) - Expect(err).To(BeNil(), noErrorForPluginList) - }) - // Test case: context use (K8S) - should sync only specific context not all active context's // set both k8s and tmc context as active // clean plugins @@ -940,6 +879,28 @@ var _ = f.CLICoreDescribe("[Tests:E2E][Feature:Plugin-Sync-TMC-lifecycle]", func Expect(err).To(BeNil(), noErrorForPluginList) }) + + // Test case: context use for TMC context and K8s context + // plugin should get sync for both tmc and k8s context + It("use first context, check plugin list", func() { + err = tf.ContextCmd.UseContext(contextNameK8s) + Expect(err).To(BeNil(), "use context should not return any error") + + err = tf.ContextCmd.UseContext(contextNameTMC) + Expect(err).To(BeNil(), "use context should not return any error") + + // tmc contextType specific plugins should be installed + installedPluginsListTMC, err = tf.PluginCmd.ListPluginsForGivenContext(contextNameTMC, true) + Expect(err).To(BeNil(), noErrorForPluginList) + Expect(len(installedPluginsListTMC)).Should(Equal(len(pluginsToGenerateMockResponseTMC)), numberOfPluginsSameAsNoOfPluginsInfoMocked) + Expect(f.CheckAllPluginsExists(installedPluginsListTMC, pluginsToGenerateMockResponseTMC)).Should(BeTrue(), pluginsInstalledAndMockedShouldBeSame) + + // k8s contextType specific plugins should be installed + installedPluginsListK8s, err = tf.PluginCmd.ListPluginsForGivenContext(contextNameK8s, true) + Expect(err).To(BeNil(), noErrorForPluginList) + Expect(f.CheckAllPluginsExists(installedPluginsListK8s, pluginsInfoForCRsApplied)).Should(BeTrue(), "plugins being installed and plugins info for which CRs applied should be same") + }) + // Test case: l. delete tmc/k8s contexts and the KIND cluster It("delete tmc/k8s contexts and the KIND cluster", func() { _, _, err = tf.ContextCmd.DeleteContext(contextNameTMC)