Skip to content

Commit d68b1fa

Browse files
committed
OCPNODE-3138: Add zstd:chunked image test
Signed-off-by: Ayato Tokubi <[email protected]>
1 parent ea71886 commit d68b1fa

File tree

3 files changed

+80
-0
lines changed

3 files changed

+80
-0
lines changed

test/extended/node/ztsd_chunked.go

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
package node
2+
3+
import (
4+
"context"
5+
"fmt"
6+
"github.com/openshift/origin/test/extended/util/image"
7+
e2eoutput "k8s.io/kubernetes/test/e2e/framework/pod/output"
8+
"time"
9+
10+
g "github.com/onsi/ginkgo/v2"
11+
o "github.com/onsi/gomega"
12+
13+
corev1 "k8s.io/api/core/v1"
14+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
15+
e2epod "k8s.io/kubernetes/test/e2e/framework/pod"
16+
17+
exutil "github.com/openshift/origin/test/extended/util"
18+
)
19+
20+
var _ = g.Describe("zstd:chunked Image", func() {
21+
defer g.GinkgoRecover()
22+
var oc *exutil.CLI
23+
24+
g.BeforeEach(func() {
25+
oc = exutil.NewCLI("zstd-chunked-image")
26+
})
27+
28+
g.It("should successfully run date command", func(ctx context.Context) {
29+
namespace := oc.Namespace()
30+
31+
zstdChunkedImage := "quay.io/crio/busybox:zstd-chunked"
32+
// manifestEndpoint is used to check the image is zstd:chunked
33+
manifestEndpoint := "https://quay.io/v2/crio/busybox/manifests/zstd-chunked"
34+
35+
// Define a pod that runs the date command using the zstd-chunked image
36+
pod := &corev1.Pod{
37+
ObjectMeta: metav1.ObjectMeta{
38+
Name: "zstd-chunked-pod",
39+
Namespace: namespace,
40+
},
41+
Spec: corev1.PodSpec{
42+
RestartPolicy: corev1.RestartPolicyNever,
43+
Containers: []corev1.Container{
44+
{
45+
Name: "zstd-chunked-container",
46+
Image: image.LocationFor(zstdChunkedImage),
47+
Command: []string{"date"},
48+
},
49+
},
50+
},
51+
}
52+
53+
g.By("Checking that the image is zstd:chunked")
54+
execpod := exutil.CreateExecPodOrFail(oc.KubeClient(), namespace, "execpod")
55+
_, err := e2eoutput.RunHostCmd(execpod.Namespace, execpod.Name,
56+
fmt.Sprintf(
57+
"curl %s -H 'Accept: application/vnd.oci.image.manifest.v1+json' | jq -e '.layers[0].annotations.\"io.github.containers.zstd-chunked.manifest-checksum\"'",
58+
manifestEndpoint,
59+
),
60+
)
61+
o.Expect(err).NotTo(o.HaveOccurred())
62+
63+
g.By("Creating a pod")
64+
pod, err = oc.KubeClient().CoreV1().Pods(namespace).Create(context.Background(), pod, metav1.CreateOptions{})
65+
o.Expect(err).NotTo(o.HaveOccurred())
66+
67+
g.By("Waiting for pod to complete")
68+
err = e2epod.WaitForPodSuccessInNamespaceTimeout(ctx, oc.KubeClient(), pod.Name, namespace, 1*time.Minute)
69+
o.Expect(err).NotTo(o.HaveOccurred())
70+
71+
g.By("Verifying pod completed successfully")
72+
pod, err = oc.KubeClient().CoreV1().Pods(namespace).Get(context.Background(), pod.Name, metav1.GetOptions{})
73+
o.Expect(err).NotTo(o.HaveOccurred())
74+
o.Expect(pod.Status.Phase).To(o.Equal(corev1.PodSucceeded))
75+
})
76+
})

test/extended/util/image/image.go

+3
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ var (
5858

5959
// used by KubeVirt test to start fedora VMs
6060
"quay.io/kubevirt/fedora-with-test-tooling-container-disk:20241024_891122a6fc": -1,
61+
62+
// used by zstd:chunked test
63+
"quay.io/crio/busybox:zstd-chunked": -1,
6164
}
6265
)
6366

test/extended/util/image/zz_generated.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# This file is generated by hack/update-generated.sh
22
docker.io/library/registry:2.8.0-beta.1 quay.io/openshift/community-e2e-images:e2e-docker-io-library-registry-2-8-0-beta-1-8x_YFKSuz9Xw6lZD
3+
quay.io/crio/busybox:zstd-chunked quay.io/openshift/community-e2e-images:e2e-quay-io-crio-busybox-zstd-chunked-tGTlEaDfd20SmOkh
34
quay.io/kubevirt/fedora-with-test-tooling-container-disk:20241024_891122a6fc quay.io/openshift/community-e2e-images:e2e-quay-io-kubevirt-fedora-with-test-tooling-container-disk-20241024_891122a6fc-IycYTh-87XrXse4E
45
quay.io/openshifttest/ldap:1.2 quay.io/openshift/community-e2e-images:e2e-quay-io-openshifttest-ldap-1-2-O3f5zPgtmWzEtasv
56
quay.io/openshifttest/multicast:1.1 quay.io/openshift/community-e2e-images:e2e-quay-io-openshifttest-multicast-1-1-XSI8Fm3bAh556UCx

0 commit comments

Comments
 (0)