Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add end to end tests #51

Merged
merged 1 commit into from
Oct 27, 2024
Merged

Add end to end tests #51

merged 1 commit into from
Oct 27, 2024

Conversation

machacekondra
Copy link
Collaborator

@machacekondra machacekondra commented Oct 26, 2024

This PR add end to end testing.
We use github action CI called end to end, which is executed in every PR.
Github CI's ubuntu now support KVM, so tests are quite fast.
The process is:

  • setup kind and libvirt
  • Deploy vCsim, which is used has vcenter
  • Deploy registry where we push agent container
  • Build container of agent and push it to registry
  • Build container of agent-service and deploy it on kind
  • run tests

The tests are using ginkgo. There are few helper methods implemented to help manage VM and sources.
The first end to end test flow:

Before each test:

  • Create source
  • Download OVA image & extract it
  • Run libvirt VM using the ISO from OVA
  • Wait for VM IP
  • Wait for planner-agent service to be running

Test flow:

  • Send the vCenter credentials to agent
  • Wait until the source is reporting the up-to-date state

After each test:

  • Remove source and & vm, so we have clean environment.

If failed:

  • We ssh to the VM and print the logs of planner-agent service

See the test run: https://github.com/kubev2v/migration-planner/actions/runs/11531405152/job/32102064538?pr=51

@machacekondra machacekondra force-pushed the kind branch 2 times, most recently from c0a6aa0 to f722b3c Compare October 26, 2024 11:23
This PR add end to end testing.
We use github action CI called end to end, which is executed in every PR.
Github CI's ubuntu now support KVM, so tests are quite fast.
The process is:

    setup kind and libvirt
    Deploy vCsim, which is used has vcenter
    Deploy registry where we push agent container
    Build container of agent and push it to registry
    Build container of agent-service and deploy it on kind
    run tests

The tests are using ginkgo. There are few helper methods implemented to
help manage VM and sources. The first end to end test flow:

Before each test:

    Create source
    Download OVA image & extract it
    Run libvirt VM using the ISO from OVA
    Wait for VM IP
    Wait for planner-agent service to be running

Test flow:

    Send the vCenter credentials to agent
    Wait until the source is reporting the up-to-date state

Signed-off-by: Ondra Machacek <[email protected]>
@@ -0,0 +1,20 @@
# Running integration tests
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

sourceId, err = svc.Create("testsource")
Expect(err).To(BeNil())
Expect(sourceId).ToNot(BeNil())
err = agent.Run(sourceId)
Copy link
Collaborator

@bardielle bardielle Oct 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greate work!
I see that agent.Run creates a n agent VM but I can't find where do we remove it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In AfterEach method we call 'agent.Remove()' that will remove the VM

Copy link
Collaborator

@bardielle bardielle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!!
I had one comment

@bardielle bardielle merged commit eed5721 into kubev2v:main Oct 27, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants