Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
liu-657667 committed Sep 24, 2023
1 parent 96de3f9 commit 1278f01
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,14 @@ var _ = Describe("Module Controller", func() {

Context("delete module deployment with ip by deleting module", func() {
moduleReplicaSetName := "test-modulereplicaset"
updateModuleUrl := "https://module-test-url"
It("should be deleted and recreate a new one", func() {
module.Labels[label.ModuleReplicasetLabel] = moduleReplicaSetName
module.Labels[label.ModuleNameLabel] = "test-module"
Expect(k8sClient.Update(context.TODO(), &module)).Should(Succeed())
Expect(k8sClient.Delete(context.TODO(), &module)).Should(Succeed())
moduleReplicaSet := prepareModuleReplicaSet(namespace, moduleReplicaSetName)
moduleReplicaSet.Spec.Template.Spec.Module.Url = updateModuleUrl
Expect(k8sClient.Create(context.TODO(), &moduleReplicaSet)).Should(Succeed())
key := types.NamespacedName{
Name: moduleName,
Expand All @@ -97,7 +99,7 @@ var _ = Describe("Module Controller", func() {
err = k8sClient.List(context.TODO(), modules, &client.ListOptions{Namespace: module.Namespace, LabelSelector: selector})
if err == nil && len(modules.Items) > 0 {
module = modules.Items[0]
return true
return module.Spec.Module.Url == updateModuleUrl
}
}
return false
Expand Down

0 comments on commit 1278f01

Please sign in to comment.