@@ -20,8 +20,6 @@ import (
20
20
"strings"
21
21
"testing"
22
22
23
- "gotest.tools/v3/icmd"
24
-
25
23
"github.com/containerd/nerdctl/v2/pkg/testutil"
26
24
)
27
25
@@ -35,12 +33,11 @@ It will regularly succeed or fail, making random PR fail the Kube check.
35
33
func TestKubeCommitPush (t * testing.T ) {
36
34
t .Parallel ()
37
35
38
- t .Skip ("Test that confirm that #827 is still broken is too flaky" )
39
-
40
36
base := testutil .NewBaseForKubernetes (t )
41
37
tID := testutil .Identifier (t )
42
38
43
39
var containerID string
40
+ // var registryIP string
44
41
45
42
setup := func () {
46
43
testutil .KubectlHelper (base , "run" , "--image" , testutil .CommonImage , tID , "--" , "sleep" , "Inf" ).
@@ -55,26 +52,45 @@ func TestKubeCommitPush(t *testing.T) {
55
52
cmd := testutil .KubectlHelper (base , "get" , "pods" , tID , "-o" , "jsonpath={ .status.containerStatuses[0].containerID }" )
56
53
cmd .Run ()
57
54
containerID = strings .TrimPrefix (cmd .Out (), "containerd://" )
55
+
56
+ // This below is missing configuration to allow for plain http communication
57
+ // This is left here for future work to successfully start a registry usable in the cluster
58
+ /*
59
+ // Start a registry
60
+ testutil.KubectlHelper(base, "run", "--port", "5000", "--image", testutil.RegistryImageStable, "testregistry").
61
+ AssertOK()
62
+
63
+ testutil.KubectlHelper(base, "wait", "pod", "testregistry", "--for=condition=ready", "--timeout=1m").
64
+ AssertOK()
65
+
66
+ cmd = testutil.KubectlHelper(base, "get", "pods", tID, "-o", "jsonpath={ .status.hostIPs[0].ip }")
67
+ cmd.Run()
68
+ registryIP = cmd.Out()
69
+
70
+ cmd = testutil.KubectlHelper(base, "apply", "-f", "-", fmt.Sprintf(`apiVersion: v1
71
+ kind: ConfigMap
72
+ metadata:
73
+ name: local-registry
74
+ namespace: nerdctl-test
75
+ data:
76
+ localRegistryHosting.v1: |
77
+ host: "%s:5000"
78
+ help: "https://kind.sigs.k8s.io/docs/user/local-registry/"
79
+ `, registryIP))
80
+ */
81
+
58
82
}
59
83
60
84
tearDown := func () {
61
- testutil .KubectlHelper (base , "delete" , "pod" , "-f" , tID ).Run ()
85
+ testutil .KubectlHelper (base , "delete" , "pod" , "--all" ).Run ()
62
86
}
63
87
64
88
tearDown ()
65
89
t .Cleanup (tearDown )
66
90
setup ()
67
91
68
92
t .Run ("test commit / push on Kube (https://github.com/containerd/nerdctl/issues/827)" , func (t * testing.T ) {
69
- t .Log ("This test is meant to verify that we can commit / push an image from a pod." +
70
- "Currently, this is broken, hence the test assumes it will fail. Once the problem is fixed, we should just" +
71
- "change the expectation to 'success'." )
72
-
73
- base .Cmd ("commit" , containerID , "registry.example.com/my-app:v1" ).AssertOK ()
74
- // See note above.
75
- base .Cmd ("push" , "registry.example.com/my-app:v1" ).Assert (icmd.Expected {
76
- ExitCode : 1 ,
77
- Err : "failed to create a tmp single-platform image" ,
78
- })
93
+ base .Cmd ("commit" , containerID , "testcommitsave" ).AssertOK ()
94
+ base .Cmd ("save" , "testcommitsave" ).AssertOK ()
79
95
})
80
96
}
0 commit comments