@@ -49,28 +49,29 @@ func TestImagePruning(t *testing.T) {
49
49
registryURL := "https://" + registryHost
50
50
51
51
tests := []struct {
52
- name string
53
- pruneOverSizeLimit * bool
54
- allImages * bool
55
- pruneRegistry * bool
56
- keepTagRevisions * int
57
- namespace string
58
- images imageapi.ImageList
59
- pods kapi.PodList
60
- streams imageapi.ImageStreamList
61
- rcs kapi.ReplicationControllerList
62
- bcs buildapi.BuildConfigList
63
- builds buildapi.BuildList
64
- dss kapisext.DaemonSetList
65
- deployments kapisext.DeploymentList
66
- dcs appsapi.DeploymentConfigList
67
- rss kapisext.ReplicaSetList
68
- limits map [string ][]* kapi.LimitRange
69
- expectedImageDeletions []string
70
- expectedStreamUpdates []string
71
- expectedLayerLinkDeletions []string
72
- expectedBlobDeletions []string
73
- expectedErrorString string
52
+ name string
53
+ pruneOverSizeLimit * bool
54
+ allImages * bool
55
+ pruneRegistry * bool
56
+ keepTagRevisions * int
57
+ namespace string
58
+ images imageapi.ImageList
59
+ pods kapi.PodList
60
+ streams imageapi.ImageStreamList
61
+ rcs kapi.ReplicationControllerList
62
+ bcs buildapi.BuildConfigList
63
+ builds buildapi.BuildList
64
+ dss kapisext.DaemonSetList
65
+ deployments kapisext.DeploymentList
66
+ dcs appsapi.DeploymentConfigList
67
+ rss kapisext.ReplicaSetList
68
+ limits map [string ][]* kapi.LimitRange
69
+ expectedImageDeletions []string
70
+ expectedStreamUpdates []string
71
+ expectedLayerLinkDeletions []string
72
+ expectedManifestLinkDeletions []string
73
+ expectedBlobDeletions []string
74
+ expectedErrorString string
74
75
}{
75
76
{
76
77
name : "1 pod - phase pending - don't prune" ,
@@ -384,9 +385,10 @@ func TestImagePruning(t *testing.T) {
384
385
),
385
386
)),
386
387
),
387
- expectedImageDeletions : []string {"sha256:0000000000000000000000000000000000000000000000000000000000000004" },
388
- expectedStreamUpdates : []string {"foo/bar|sha256:0000000000000000000000000000000000000000000000000000000000000004" },
389
- expectedBlobDeletions : []string {registryURL + "|" + "sha256:0000000000000000000000000000000000000000000000000000000000000004" },
388
+ expectedImageDeletions : []string {"sha256:0000000000000000000000000000000000000000000000000000000000000004" },
389
+ expectedStreamUpdates : []string {"foo/bar|sha256:0000000000000000000000000000000000000000000000000000000000000004" },
390
+ expectedManifestLinkDeletions : []string {registryURL + "|foo/bar|sha256:0000000000000000000000000000000000000000000000000000000000000004" },
391
+ expectedBlobDeletions : []string {registryURL + "|" + "sha256:0000000000000000000000000000000000000000000000000000000000000004" },
390
392
},
391
393
392
394
{
@@ -541,6 +543,12 @@ func TestImagePruning(t *testing.T) {
541
543
"foo/bar|sha256:0000000000000000000000000000000000000000000000000000000000000004" ,
542
544
"foo/bar|sha256:0000000000000000000000000000000000000000000000000000000000000005" ,
543
545
},
546
+ expectedManifestLinkDeletions : []string {
547
+ registryURL + "|foo/bar|sha256:0000000000000000000000000000000000000000000000000000000000000001" ,
548
+ registryURL + "|foo/bar|sha256:0000000000000000000000000000000000000000000000000000000000000003" ,
549
+ registryURL + "|foo/bar|sha256:0000000000000000000000000000000000000000000000000000000000000004" ,
550
+ registryURL + "|foo/bar|sha256:0000000000000000000000000000000000000000000000000000000000000005" ,
551
+ },
544
552
expectedBlobDeletions : []string {
545
553
registryURL + "|sha256:0000000000000000000000000000000000000000000000000000000000000001" ,
546
554
registryURL + "|" + "sha256:0000000000000000000000000000000000000000000000000000000000000003" ,
@@ -734,6 +742,7 @@ func TestImagePruning(t *testing.T) {
734
742
registryURL + "|foo/bar|layer7" ,
735
743
registryURL + "|foo/bar|layer8" ,
736
744
},
745
+ expectedManifestLinkDeletions : []string {registryURL + "|foo/bar|sha256:0000000000000000000000000000000000000000000000000000000000000004" },
737
746
expectedBlobDeletions : []string {
738
747
registryURL + "|sha256:0000000000000000000000000000000000000000000000000000000000000004" ,
739
748
registryURL + "|layer5" ,
@@ -771,6 +780,7 @@ func TestImagePruning(t *testing.T) {
771
780
registryURL + "|foo/bar|layer7" ,
772
781
registryURL + "|foo/bar|layer8" ,
773
782
},
783
+ expectedManifestLinkDeletions : []string {registryURL + "|foo/bar|sha256:0000000000000000000000000000000000000000000000000000000000000004" },
774
784
expectedBlobDeletions : []string {
775
785
registryURL + "|sha256:0000000000000000000000000000000000000000000000000000000000000004" ,
776
786
registryURL + "|sha256:0000000000000000000000000000000000000000000000000000000000000005" ,
@@ -814,9 +824,10 @@ func TestImagePruning(t *testing.T) {
814
824
limits : map [string ][]* kapi.LimitRange {
815
825
"foo" : testutil .LimitList (100 , 200 ),
816
826
},
817
- expectedImageDeletions : []string {"sha256:0000000000000000000000000000000000000000000000000000000000000003" },
818
- expectedStreamUpdates : []string {"foo/bar|sha256:0000000000000000000000000000000000000000000000000000000000000003" },
819
- expectedBlobDeletions : []string {registryURL + "|sha256:0000000000000000000000000000000000000000000000000000000000000003" },
827
+ expectedImageDeletions : []string {"sha256:0000000000000000000000000000000000000000000000000000000000000003" },
828
+ expectedStreamUpdates : []string {"foo/bar|sha256:0000000000000000000000000000000000000000000000000000000000000003" },
829
+ expectedManifestLinkDeletions : []string {registryURL + "|foo/bar|sha256:0000000000000000000000000000000000000000000000000000000000000003" },
830
+ expectedBlobDeletions : []string {registryURL + "|sha256:0000000000000000000000000000000000000000000000000000000000000003" },
820
831
},
821
832
822
833
{
@@ -848,6 +859,10 @@ func TestImagePruning(t *testing.T) {
848
859
},
849
860
expectedImageDeletions : []string {"sha256:0000000000000000000000000000000000000000000000000000000000000002" , "sha256:0000000000000000000000000000000000000000000000000000000000000004" },
850
861
expectedStreamUpdates : []string {"foo/bar|sha256:0000000000000000000000000000000000000000000000000000000000000002" , "bar/foo|sha256:0000000000000000000000000000000000000000000000000000000000000004" },
862
+ expectedManifestLinkDeletions : []string {
863
+ registryURL + "|foo/bar|sha256:0000000000000000000000000000000000000000000000000000000000000002" ,
864
+ registryURL + "|bar/foo|sha256:0000000000000000000000000000000000000000000000000000000000000004" ,
865
+ },
851
866
expectedBlobDeletions : []string {
852
867
registryURL + "|sha256:0000000000000000000000000000000000000000000000000000000000000002" ,
853
868
registryURL + "|sha256:0000000000000000000000000000000000000000000000000000000000000004" ,
@@ -1002,10 +1017,10 @@ func TestImagePruning(t *testing.T) {
1002
1017
t .Errorf ("unexpected layer link deletions: %s" , diff .ObjectDiff (a , e ))
1003
1018
}
1004
1019
1005
- /*
1006
- TODO: add this check
1007
- expectedManifestLinkDeletions := sets.NewString(test.expectedManifestLinkDeletions... )
1008
- */
1020
+ expectedManifestLinkDeletions := sets . NewString ( test . expectedManifestLinkDeletions ... )
1021
+ if a , e := manifestDeleter . invocations , expectedManifestLinkDeletions ; ! reflect . DeepEqual ( a , e ) {
1022
+ t . Errorf ( "unexpected manifest link deletions: %s" , diff . ObjectDiff ( a , e ) )
1023
+ }
1009
1024
1010
1025
expectedBlobDeletions := sets .NewString (test .expectedBlobDeletions ... )
1011
1026
if a , e := blobDeleter .invocations , expectedBlobDeletions ; ! reflect .DeepEqual (a , e ) {
0 commit comments