@@ -1487,6 +1487,43 @@ func TestValidateInstallConfig(t *testing.T) {
14871487 return c
14881488 }(),
14891489 },
1490+ {
1491+ name : "valid release image source ImageDigstSource with valid mirror and sourcePolicy" ,
1492+ installConfig : func () * types.InstallConfig {
1493+ c := validInstallConfig ()
1494+ c .ImageDigestSources = []types.ImageDigestSource {{
1495+ Source : "quay.io/ocp/release-x.y" ,
1496+ Mirrors : []string {"mirror.example.com:5000" },
1497+ SourcePolicy : "NeverContactSource" ,
1498+ }}
1499+ return c
1500+ }(),
1501+ },
1502+ {
1503+ name : "valid release image source ImageDigstSource with no mirror and valid sourcePolicy" ,
1504+ installConfig : func () * types.InstallConfig {
1505+ c := validInstallConfig ()
1506+ c .ImageDigestSources = []types.ImageDigestSource {{
1507+ Source : "quay.io/ocp/release-x.y" ,
1508+ SourcePolicy : "NeverContactSource" ,
1509+ }}
1510+ return c
1511+ }(),
1512+ expectedError : `^imageDigestSources\[0\]\.sourcePolicy: Invalid value: "NeverContactSource": sourcePolicy cannot be configured without a mirror$` ,
1513+ },
1514+ {
1515+ name : "valid release image source ImageDigstSource with invalid sourcePolicy" ,
1516+ installConfig : func () * types.InstallConfig {
1517+ c := validInstallConfig ()
1518+ c .ImageDigestSources = []types.ImageDigestSource {{
1519+ Source : "quay.io/ocp/release-x.y" ,
1520+ Mirrors : []string {"mirror.example.com:5000" },
1521+ SourcePolicy : "InvalidPolicy" ,
1522+ }}
1523+ return c
1524+ }(),
1525+ expectedError : `^imageDigestSources\[0\]\.sourcePolicy: Invalid value: "InvalidPolicy": supported values are "NeverContactSource" and "AllowContactingSource"$` ,
1526+ },
14901527 {
14911528 name : "error out ImageContentSources and ImageDigestSources and are set at the same time" ,
14921529 installConfig : func () * types.InstallConfig {
0 commit comments