@@ -914,32 +914,58 @@ func TestPodNodeSelector(t *testing.T) {
914
914
915
915
func TestPullPolicy (t * testing.T ) {
916
916
var table = []struct {
917
- image string
918
- policy corev1.PullPolicy
917
+ image string
918
+ policy corev1.PullPolicy
919
+ opmImage string
920
+ extractContent bool
919
921
}{
920
922
{
921
- image : "quay.io/operator-framework/olm@sha256:b9d011c0fbfb65b387904f8fafc47ee1a9479d28d395473341288ee126ed993b" ,
922
- policy : corev1 .PullIfNotPresent ,
923
+ image : "quay.io/operator-framework/olm@sha256:b9d011c0fbfb65b387904f8fafc47ee1a9479d28d395473341288ee126ed993b" ,
924
+ policy : corev1 .PullIfNotPresent ,
925
+ opmImage : "opmImage" ,
926
+ extractContent : false ,
923
927
},
924
928
{
925
- image : "gcc@sha256:06a6f170d7fff592e44b089c0d2e68d870573eb9a23d9c66d4b6ea11f8fad18b" ,
926
- policy : corev1 .PullIfNotPresent ,
929
+ image : "gcc@sha256:06a6f170d7fff592e44b089c0d2e68d870573eb9a23d9c66d4b6ea11f8fad18b" ,
930
+ policy : corev1 .PullIfNotPresent ,
931
+ opmImage : "opmImage" ,
932
+ extractContent : false ,
927
933
},
928
934
{
929
- image : "myimage:1.0" ,
930
- policy : corev1 .PullAlways ,
935
+ image : "myimage:1.0" ,
936
+ policy : corev1 .PullAlways ,
937
+ opmImage : "opmImage" ,
938
+ extractContent : false ,
931
939
},
932
940
{
933
- image : "busybox" ,
934
- policy : corev1 .PullAlways ,
941
+ image : "busybox" ,
942
+ policy : corev1 .PullAlways ,
943
+ opmImage : "opmImage" ,
944
+ extractContent : false ,
935
945
},
936
946
{
937
- image : "gcc@sha256:06a6f170d7fff592e44b089c0d2e68" ,
938
- policy : corev1 .PullIfNotPresent ,
947
+ image : "gcc@sha256:06a6f170d7fff592e44b089c0d2e68" ,
948
+ policy : corev1 .PullIfNotPresent ,
949
+ opmImage : "opmImage" ,
950
+ extractContent : false ,
939
951
},
940
952
{
941
- image : "hello@md5:b1946ac92492d2347c6235b4d2611184" ,
942
- policy : corev1 .PullIfNotPresent ,
953
+ image : "hello@md5:b1946ac92492d2347c6235b4d2611184" ,
954
+ policy : corev1 .PullIfNotPresent ,
955
+ opmImage : "opmImage" ,
956
+ extractContent : false ,
957
+ },
958
+ {
959
+ image : "quay.io/operator-framework/olm@sha256:b9d011c0fbfb65b387904f8fafc47ee1a9479d28d395473341288ee126ed993b" ,
960
+ policy : corev1 .PullIfNotPresent ,
961
+ opmImage : "quay.io/operator-framework/olm@sha256:b9d011c0fbfb65b387904f8fafc47ee1a9479d28d395473341288ee126ed993b" ,
962
+ extractContent : true ,
963
+ },
964
+ {
965
+ image : "quay.io/operator-framework/olm@sha256:b9d011c0fbfb65b387904f8fafc47ee1a9479d28d395473341288ee126ed993b" ,
966
+ policy : corev1 .PullAlways ,
967
+ opmImage : "quay.io/operator-framework/olm:latest" ,
968
+ extractContent : true ,
943
969
},
944
970
}
945
971
@@ -951,7 +977,16 @@ func TestPullPolicy(t *testing.T) {
951
977
}
952
978
953
979
for _ , tt := range table {
954
- p , err := Pod (source , "catalog" , "opmImage" , "utilImage" , tt .image , serviceAccount ("" , "service-account" ), nil , nil , int32 (0 ), int32 (0 ), int64 (workloadUserID ), v1alpha1 .Legacy )
980
+ if tt .extractContent {
981
+ grpcPodConfig := & v1alpha1.GrpcPodConfig {
982
+ ExtractContent : & v1alpha1.ExtractContentConfig {
983
+ CacheDir : "/tmp/cache" ,
984
+ CatalogDir : "/catalog" ,
985
+ },
986
+ }
987
+ source .Spec .GrpcPodConfig = grpcPodConfig
988
+ }
989
+ p , err := Pod (source , "catalog" , tt .opmImage , "utilImage" , tt .image , serviceAccount ("" , "service-account" ), nil , nil , int32 (0 ), int32 (0 ), int64 (workloadUserID ), v1alpha1 .Legacy )
955
990
require .NoError (t , err )
956
991
policy := p .Spec .Containers [0 ].ImagePullPolicy
957
992
if policy != tt .policy {
0 commit comments