@@ -34,6 +34,44 @@ var _ = g.Describe("[Feature:ImageLayers] Image layer subresource", func() {
34
34
35
35
oc = exutil .NewCLI ("image-layers" , exutil .KubeConfigPath ())
36
36
37
+ g .It ("should identify a deleted image as missing" , func () {
38
+ client := imageclientset .NewForConfigOrDie (oc .AdminConfig ()).Image ()
39
+ _ , err := client .ImageStreams (oc .Namespace ()).Create (& imageapi.ImageStream {
40
+ ObjectMeta : metav1.ObjectMeta {
41
+ Name : "test" ,
42
+ },
43
+ })
44
+ o .Expect (err ).NotTo (o .HaveOccurred ())
45
+ _ , err = client .ImageStreamMappings (oc .Namespace ()).Create (& imageapi.ImageStreamMapping {
46
+ ObjectMeta : metav1.ObjectMeta {
47
+ Name : "test" ,
48
+ },
49
+ Image : imageapi.Image {
50
+ ObjectMeta : metav1.ObjectMeta {
51
+ Name : "an_image_to_be_deleted" ,
52
+ },
53
+ DockerImageReference : "example.com/random/image:latest" ,
54
+ },
55
+ Tag : "missing" ,
56
+ })
57
+ o .Expect (err ).NotTo (o .HaveOccurred ())
58
+ err = client .Images ().Delete ("an_image_to_be_deleted" , nil )
59
+ o .Expect (err ).NotTo (o .HaveOccurred ())
60
+ err = wait .PollImmediate (time .Second , time .Minute , func () (bool , error ) {
61
+ layers , err := client .ImageStreams (oc .Namespace ()).Layers ("test" , metav1.GetOptions {})
62
+ if err != nil {
63
+ return false , err
64
+ }
65
+ ref , ok := layers .Images ["an_image_to_be_deleted" ]
66
+ if ! ok {
67
+ return false , nil
68
+ }
69
+ o .Expect (ref .ImageMissing ).To (o .BeTrue ())
70
+ return true , nil
71
+ })
72
+ o .Expect (err ).NotTo (o .HaveOccurred ())
73
+ })
74
+
37
75
g .It ("should return layers from tagged images" , func () {
38
76
ns = []string {oc .Namespace ()}
39
77
client := imageclientset .NewForConfigOrDie (oc .UserConfig ()).Image ()
0 commit comments