Skip to content

Commit

Permalink
chore: Add tests for the Kata Containers extension
Browse files Browse the repository at this point in the history
Let's add a very basic test for the Kata Containers extension, mimicing
what's already in place for gVisor.

This depends on the work being done in:
siderolabs/extensions#279

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
  • Loading branch information
fidencio committed Dec 7, 2023
1 parent 270604b commit 3132681
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions internal/integration/api/extensions_qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,39 @@ func (suite *ExtensionsSuiteQEMU) TestExtensionsGvisor() {
suite.Require().NoError(suite.WaitForPodToBeRunning(suite.ctx, 5*time.Minute, "default", "nginx-gvisor"))
}

// TestExtensionsKataContainers verifies gvisor runtime class is working.
func (suite *ExtensionsSuiteQEMU) TestExtensionsKataContainers() {
_, err := suite.Clientset.NodeV1().RuntimeClasses().Create(suite.ctx, &nodev1.RuntimeClass{
ObjectMeta: metav1.ObjectMeta{
Name: "kata",
},
Handler: "kata",
}, metav1.CreateOptions{})
defer suite.Clientset.NodeV1().RuntimeClasses().Delete(suite.ctx, "kata", metav1.DeleteOptions{}) //nolint:errcheck

suite.Require().NoError(err)

_, err = suite.Clientset.CoreV1().Pods("default").Create(suite.ctx, &corev1.Pod{
ObjectMeta: metav1.ObjectMeta{
Name: "nginx-kata",
},
Spec: corev1.PodSpec{
Containers: []corev1.Container{
{
Name: "nginx-kata",
Image: "nginx",
},
},
},
}, metav1.CreateOptions{})
defer suite.Clientset.CoreV1().Pods("default").Delete(suite.ctx, "nginx-kata", metav1.DeleteOptions{}) //nolint:errcheck

suite.Require().NoError(err)

// wait for the pod to be ready
suite.Require().NoError(suite.WaitForPodToBeRunning(suite.ctx, 5*time.Minute, "default", "nginx-gvisor"))
}

// TestExtensionsStargz verifies stargz snapshotter.
func (suite *ExtensionsSuiteQEMU) TestExtensionsStargz() {
_, err := suite.Clientset.CoreV1().Pods("default").Create(suite.ctx, &corev1.Pod{
Expand Down

0 comments on commit 3132681

Please sign in to comment.