github.com/openshift/installer@v1.4.17/pkg/asset/ignition/bootstrap/bootstrap_ignition_test.go (about) 1 package bootstrap 2 3 import ( 4 "fmt" 5 "testing" 6 7 igntypes "github.com/coreos/ignition/v2/config/v3_2/types" 8 ) 9 10 func Test_parseCertificateBundle(t *testing.T) { 11 type checkFunc func([]igntypes.Resource, error) error 12 check := func(fns ...checkFunc) []checkFunc { return fns } 13 14 hasNilError := func(_ []igntypes.Resource, have error) error { 15 if have != nil { 16 return fmt.Errorf("expected nil error, found %q", have) 17 } 18 return nil 19 } 20 21 hasSomeError := func(_ []igntypes.Resource, have error) error { 22 if have == nil { 23 return fmt.Errorf("expected error, found nil") 24 } 25 return nil 26 } 27 28 chainHasLength := func(want int) checkFunc { 29 return func(caref []igntypes.Resource, _ error) error { 30 if have := len(caref); want != have { 31 return fmt.Errorf("expected bundle length %d, found %d", want, have) 32 } 33 return nil 34 } 35 } 36 37 for _, tc := range [...]struct { 38 name string 39 bundle string 40 checks []checkFunc 41 }{{ 42 "no certificate", 43 ``, 44 check( 45 hasNilError, 46 chainHasLength(0), 47 ), 48 }, { 49 "no certificate, EOLs", 50 ` 51 52 53 54 55 `, 56 check( 57 hasNilError, 58 chainHasLength(0), 59 ), 60 }, { 61 "one certificate", 62 `-----BEGIN CERTIFICATE----- 63 MIIF5zCCA8+gAwIBAgIJAJGoemeMXvTiMA0GCSqGSIb3DQEBCwUAMIGIMQswCQYD 64 VQQGEwJVUzEXMBUGA1UECAwOTm9ydGggQ2Fyb2xpbmExDTALBgNVBAcMBEFwZXgx 65 EDAOBgNVBAoMB1JlZCBIYXQxEzARBgNVBAsMClRpZ2VyIFRlYW0xFDASBgNVBAMM 66 CzE3Mi4zMS44LjEwMRQwEgYDVQQDDAsxNzIuMzEuMC4xMDAgFw0xNzA4MTExNTQy 67 NDlaGA8yMjE3MDYyNDE1NDI0OVowgYgxCzAJBgNVBAYTAlVTMRcwFQYDVQQIDA5O 68 b3J0aCBDYXJvbGluYTENMAsGA1UEBwwEQ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DcZtlSChLBQtyPwHez+8VcBxJqGF39FrYTqDaVKE+W 85 u1EV8oiC/JKjT9StTWNUKHrzrzNfVP378D8PShJOnlasTwIjbp4XycTV6uju8NDb 86 XKq8Lsd5XkpX+syhfvSw8KyuRP8nzrmUh7usokqXoMuohk94fp0nqFA2lo+16Xj5 87 zmZX+Ukyyho5Uh7Rpcx0W/ergsxsyfGt3yBVQO/ohsau9ezyBJwucY8vCLQ8Vd1i 88 OQao4dnOg4eIV8g5jPhll4nEgZqOp9NLmnoXWqOVPZ4FQ6V19nd21pRTvHmTXDFG 89 HO33EZdRAsSFr6f5cnHqqrv5PoTZQtyiXe01FUE9dpFS+gQf4cd98tr/Z39AYNZ7 90 5cllfZkM0xVuhR5fOzGlbDfVQD5eSqwM0Qp5wwMwJhGkxCLe/6l6xV0TDV5Rcb7i 91 BQ3zPGw7uJtOrxeFnGHWNWYdl24gxA1h7G3uKeKo/MNiJHvOLNul9wuvlWCCEJI0 92 bxr7iKAGSun8qkAWkYQy6ClARIGSiy+ah6pwOgObbge6eR2o/QOYFhIE1yleTNJU 93 JqYys+7rMa2qN2mfsnkn/IN2G80+Qs+qTLv2LDucO2PweBaslWh2ejc6axzLBJza 94 11Bq4Ry36CAT3PoIXyhO78iAL6Aly+gheyFT 95 -----END CERTIFICATE-----`, 96 check( 97 hasNilError, 98 chainHasLength(1), 99 ), 100 }, { 101 "one certificate with additional EOL", 102 `-----BEGIN CERTIFICATE----- 103 MIIF5zCCA8+gAwIBAgIJAJGoemeMXvTiMA0GCSqGSIb3DQEBCwUAMIGIMQswCQYD 104 VQQGEwJVUzEXMBUGA1UECAwOTm9ydGggQ2Fyb2xpbmExDTALBgNVBAcMBEFwZXgx 105 EDAOBgNVBAoMB1JlZCBIYXQxEzARBgNVBAsMClRpZ2VyIFRlYW0xFDASBgNVBAMM 106 CzE3Mi4zMS44LjEwMRQwEgYDVQQDDAsxNzIuMzEuMC4xMDAgFw0xNzA4MTExNTQy 107 NDlaGA8yMjE3MDY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x7iE/KNy6MAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggIBAECgEP0w 124 AP9BG3b7xXJdPV5oHkOIDmDcZtlSChLBQtyPwHez+8VcBxJqGF39FrYTqDaVKE+W 125 u1EV8oiC/JKjT9StTWNUKHrzrzNfVP378D8PShJOnlasTwIjbp4XycTV6uju8NDb 126 XKq8Lsd5XkpX+syhfvSw8KyuRP8nzrmUh7usokqXoMuohk94fp0nqFA2lo+16Xj5 127 zmZX+Ukyyho5Uh7Rpcx0W/ergsxsyfGt3yBVQO/ohsau9ezyBJwucY8vCLQ8Vd1i 128 OQao4dnOg4eIV8g5jPhll4nEgZqOp9NLmnoXWqOVPZ4FQ6V19nd21pRTvHmTXDFG 129 HO33EZdRAsSFr6f5cnHqqrv5PoTZQtyiXe01FUE9dpFS+gQf4cd98tr/Z39AYNZ7 130 5cllfZkM0xVuhR5fOzGlbDfVQD5eSqwM0Qp5wwMwJhGkxCLe/6l6xV0TDV5Rcb7i 131 BQ3zPGw7uJtOrxeFnGHWNWYdl24gxA1h7G3uKeKo/MNiJHvOLNul9wuvlWCCEJI0 132 bxr7iKAGSun8qkAWkYQy6ClARIGSiy+ah6pwOgObbge6eR2o/QOYFhIE1yleTNJU 133 JqYys+7rMa2qN2mfsnkn/IN2G80+Qs+qTLv2LDucO2PweBaslWh2ejc6axzLBJza 134 11Bq4Ry36CAT3PoIXyhO78iAL6Aly+gheyFT 135 -----END CERTIFICATE----- 136 137 `, 138 check( 139 hasNilError, 140 chainHasLength(1), 141 ), 142 }, { 143 "two certificates", 144 `-----BEGIN CERTIFICATE----- 145 MIIF5zCCA8+gAwIBAgIJAJGoemeMXvTiMA0GCSqGSIb3DQEBCwUAMIGIMQswCQYD 146 VQQGEwJVUzEXMBUGA1UECAwOTm9ydGggQ2Fyb2xpbmExDTALBgNVBAcMBEFwZXgx 147 EDAOBgNVBAoMB1JlZCBIYXQxEzARBgNVBAsMClRpZ2VyIFRlYW0xFDASBgNVBAMM 148 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TEZZyFEdwlYXZnj8UCAwEAAaNQME4wHQYDVR0O 198 BBYEFBpbryhpHb6rSdaYsn1x7iE/KNy6MB8GA1UdIwQYMBaAFBpbryhpHb6rSdaY 199 sn1x7iE/KNy6MAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggIBAECgEP0w 200 AP9BG3b7xXJdPV5oHkOIDmDcZtlSChLBQtyPwHez+8VcBxJqGF39FrYTqDaVKE+W 201 u1EV8oiC/JKjT9StTWNUKHrzrzNfVP378D8PShJOnlasTwIjbp4XycTV6uju8NDb 202 XKq8Lsd5XkpX+syhfvSw8KyuRP8nzrmUh7usokqXoMuohk94fp0nqFA2lo+16Xj5 203 zmZX+Ukyyho5Uh7Rpcx0W/ergsxsyfGt3yBVQO/ohsau9ezyBJwucY8vCLQ8Vd1i 204 OQao4dnOg4eIV8g5jPhll4nEgZqOp9NLmnoXWqOVPZ4FQ6V19nd21pRTvHmTXDFG 205 HO33EZdRAsSFr6f5cnHqqrv5PoTZQtyiXe01FUE9dpFS+gQf4cd98tr/Z39AYNZ7 206 5cllfZkM0xVuhR5fOzGlbDfVQD5eSqwM0Qp5wwMwJhGkxCLe/6l6xV0TDV5Rcb7i 207 BQ3zPGw7uJtOrxeFnGHWNWYdl24gxA1h7G3uKeKo/MNiJHvOLNul9wuvlWCCEJI0 208 bxr7iKAGSun8qkAWkYQy6ClARIGSiy+ah6pwOgObbge6eR2o/QOYFhIE1yleTNJU 209 JqYys+7rMa2qN2mfsnkn/IN2G80+Qs+qTLv2LDucO2PweBaslWh2ejc6axzLBJza 210 11Bq4Ry36CAT3PoIXyhO78iAL6Aly+gheyFT 211 -----END CERTIFICATE-----`, 212 check( 213 hasNilError, 214 chainHasLength(2), 215 ), 216 }, { 217 "two certificates with many EOLs", 218 ` 219 220 -----BEGIN CERTIFICATE----- 221 MIIF5zCCA8+gAwIBAgIJAJGoemeMXvTiMA0GCSqGSIb3DQEBCwUAMIGIMQswCQYD 222 VQQGEwJVUzEXMBU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bEWsUTCfuokvJHRWUrkwZUpcgwBMFNHqOeq78NcUGlEpkbdoptWHpjxe+w6xZsz 239 AGJaFcvUU1EohoFdzsnF7ra7l4TEZZyFEdwlYXZnj8UCAwEAAaNQME4wHQYDVR0O 240 BBYEFBpbryhpHb6rSdaYsn1x7iE/KNy6MB8GA1UdIwQYMBaAFBpbryhpHb6rSdaY 241 sn1x7iE/KNy6MAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggIBAECgEP0w 242 AP9BG3b7xXJdPV5oHkOIDmDcZtlSChLBQtyPwHez+8VcBxJqGF39FrYTqDaVKE+W 243 u1EV8oiC/JKjT9StTWNUKHrzrzNfVP378D8PShJOnlasTwIjbp4XycTV6uju8NDb 244 XKq8Lsd5XkpX+syhfvSw8KyuRP8nzrmUh7usokqXoMuohk94fp0nqFA2lo+16Xj5 245 zmZX+Ukyyho5Uh7Rpcx0W/ergsxsyfGt3yBVQO/ohsau9ezyBJwucY8vCLQ8Vd1i 246 OQao4dnOg4eIV8g5jPhll4nEgZqOp9NLmnoXWqOVPZ4FQ6V19nd21pRTvHmTXDFG 247 HO33EZdRAsSFr6f5cnHqqrv5PoTZQtyiXe01FUE9dpFS+gQf4cd98tr/Z39AYNZ7 248 5cllfZkM0xVuhR5fOzGlbDfVQD5eSqwM0Qp5wwMwJhGkxCLe/6l6xV0TDV5Rcb7i 249 BQ3zPGw7uJtOrxeFnGHWNWYdl24gxA1h7G3uKeKo/MNiJHvOLNul9wuvlWCCEJI0 250 bxr7iKAGSun8qkAWkYQy6ClARIGSiy+ah6pwOgObbge6eR2o/QOYFhIE1yleTNJU 251 JqYys+7rMa2qN2mfsnkn/IN2G80+Qs+qTLv2LDucO2PweBaslWh2ejc6axzLBJza 252 11Bq4Ry36CAT3PoIXyhO78iAL6Aly+gheyFT 253 -----END CERTIFICATE----- 254 255 256 257 258 -----BEGIN CERTIFICATE----- 259 MIIF5zCCA8+gAwIBAgIJAJGoemeMXvTiMA0GCSqGSIb3DQ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yPpGf0BCZl1PbxVXeN+jOg29XX01mhG6x 276 7bEWsUTCfuokvJHRWUrkwZUpcgwBMFNHqOeq78NcUGlEpkbdoptWHpjxe+w6xZsz 277 AGJaFcvUU1EohoFdzsnF7ra7l4TEZZyFEdwlYXZnj8UCAwEAAaNQME4wHQYDVR0O 278 BBYEFBpbryhpHb6rSdaYsn1x7iE/KNy6MB8GA1UdIwQYMBaAFBpbryhpHb6rSdaY 279 sn1x7iE/KNy6MAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggIBAECgEP0w 280 AP9BG3b7xXJdPV5oHkOIDmDcZtlSChLBQtyPwHez+8VcBxJqGF39FrYTqDaVKE+W 281 u1EV8oiC/JKjT9StTWNUKHrzrzNfVP378D8PShJOnlasTwIjbp4XycTV6uju8NDb 282 XKq8Lsd5XkpX+syhfvSw8KyuRP8nzrmUh7usokqXoMuohk94fp0nqFA2lo+16Xj5 283 zmZX+Ukyyho5Uh7Rpcx0W/ergsxsyfGt3yBVQO/ohsau9ezyBJwucY8vCLQ8Vd1i 284 OQao4dnOg4eIV8g5jPhll4nEgZqOp9NLmnoXWqOVPZ4FQ6V19nd21pRTvHmTXDFG 285 HO33EZdRAsSFr6f5cnHqqrv5PoTZQtyiXe01FUE9dpFS+gQf4cd98tr/Z39AYNZ7 286 5cllfZkM0xVuhR5fOzGlbDfVQD5eSqwM0Qp5wwMwJhGkxCLe/6l6xV0TDV5Rcb7i 287 BQ3zPGw7uJtOrxeFnGHWNWYdl24gxA1h7G3uKeKo/MNiJHvOLNul9wuvlWCCEJI0 288 bxr7iKAGSun8qkAWkYQy6ClARIGSiy+ah6pwOgObbge6eR2o/QOYFhIE1yleTNJU 289 JqYys+7rMa2qN2mfsnkn/IN2G80+Qs+qTLv2LDucO2PweBaslWh2ejc6axzLBJza 290 11Bq4Ry36CAT3PoIXyhO78iAL6Aly+gheyFT 291 -----END CERTIFICATE----- 292 293 `, 294 check( 295 hasNilError, 296 chainHasLength(2), 297 ), 298 }, { 299 "invalid certificate", 300 `-----BEGIN CERTIFICATE----- 301 invalid 302 -----END CERTIFICATE-----`, 303 check( 304 hasSomeError, 305 ), 306 }} { 307 t.Run(tc.name, func(t *testing.T) { 308 caref, err := parseCertificateBundle([]byte(tc.bundle)) 309 for _, check := range tc.checks { 310 if e := check(caref, err); e != nil { 311 t.Error(e) 312 } 313 } 314 }) 315 } 316 }