Skip to content

Commit

Permalink
Merge pull request #11651 from orelmisan/migration-mutator-test
Browse files Browse the repository at this point in the history
Migration create mutator, tests: Avoid name collisions
  • Loading branch information
kubevirt-bot committed Apr 10, 2024
2 parents e8da1f2 + ebe712c commit 635775b
Showing 1 changed file with 4 additions and 4 deletions.
Expand Up @@ -41,12 +41,12 @@ var _ = Describe("VirtualMachineInstanceMigration Mutator", func() {
It("Should mutate the VirtualMachineInstanceMigration object", func() {
migration := newMigration()

admissionReview, err := newAdmissionReview(migration)
admissionReview, err := newAdmissionReviewForVMIMCreation(migration)
Expect(err).ToNot(HaveOccurred())

mutator := &mutators.MigrationCreateMutator{}

expectedJSONPatch, err := expectedJSONPatch(
expectedJSONPatch, err := expectedJSONPatchForVMIMCreation(
expectedMigrationObjectMeta(migration.ObjectMeta, migration.Spec.VMIName),
)
Expect(err).NotTo(HaveOccurred())
Expand All @@ -72,7 +72,7 @@ func newMigration() *v1.VirtualMachineInstanceMigration {
}
}

func newAdmissionReview(migration *v1.VirtualMachineInstanceMigration) (*admissionv1.AdmissionReview, error) {
func newAdmissionReviewForVMIMCreation(migration *v1.VirtualMachineInstanceMigration) (*admissionv1.AdmissionReview, error) {
migrationBytes, err := json.Marshal(migration)
if err != nil {
return nil, err
Expand Down Expand Up @@ -101,7 +101,7 @@ func expectedMigrationObjectMeta(currentObjectMeta k8smetav1.ObjectMeta, vmiName
return expectedObjectMeta
}

func expectedJSONPatch(expectedObjectMeta k8smetav1.ObjectMeta) ([]byte, error) {
func expectedJSONPatchForVMIMCreation(expectedObjectMeta k8smetav1.ObjectMeta) ([]byte, error) {
return patch.GeneratePatchPayload(
patch.PatchOperation{
Op: patch.PatchReplaceOp,
Expand Down

0 comments on commit 635775b

Please sign in to comment.