Skip to content

Commit

Permalink
change
Browse files Browse the repository at this point in the history
  • Loading branch information
Chandra Pamuluri committed Oct 19, 2023
1 parent 64212c6 commit c61d7a1
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 63 deletions.
3 changes: 1 addition & 2 deletions pkg/common/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
83 changes: 22 additions & 61 deletions test/e2e/plugin_sync/tmc/plugin_sync_tmc_lifecycle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit c61d7a1

Please sign in to comment.