@@ -1334,7 +1334,16 @@ var _ = Describe("getHTTPSTransport", func() {
13341334 Namespace : "openshift-config-managed" ,
13351335 },
13361336 Data : map [string ]string {
1337- "ca.crt" : "-----BEGIN CERTIFICATE-----\n MIIBhTCCASugAwIBAgIQIRi6zePL6mKjOipn+dNuaTAKBggqhkjOPQQDAjASMRAw\n DgYDVQQKEwdBY21lIENvMB4XDTE3MTAyMDE5NDMwNloXDTE4MTAyMDE5NDMwNlow\n EjEQMA4GA1UEChMHQWNtZSBDbzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABLU3\n jSayahkJYT5/UqIqViZFMVh16yrQ1mOA8V/k3H8Pk/DL1tJ1yXYEptzhKELNJIjp\n zUv0jVJHPnLGVaikzlKjYzBhMA4GA1UdDwEB/wQEAwICpDATBgNVHSUEDDAKBggr\n BgEFBQcDATAPBgNVHRMBAf8EBTADAQH/MCkGA1UdEQQiMCCCDmxvY2FsaG9zdDo1\n NDUzgg4xMjcuMC4wLjE6NTQ1MzAKBggqhkjOPQQDAgNIADBFAiEA2wpSek3WdNcr\n jSuvziv6OERWSEZObKHVIJl/Cj9SWWECIGB/W0PCjZjKXBzgoW0OzXRiDP/WRxW6\n frNHC7GJcIqs\n -----END CERTIFICATE-----\n " ,
1337+ "ca.crt" : "-----BEGIN CERTIFICATE-----\n " +
1338+ "MIIBhTCCASugAwIBAgIQIRi6zePL6mKjOipn+dNuaTAKBggqhkjOPQQDAjASMRAw\n " +
1339+ "DgYDVQQKEwdBY21lIENvMB4XDTE3MTAyMDE5NDMwNloXDTE4MTAyMDE5NDMwNlow\n " +
1340+ "EjEQMA4GA1UEChMHQWNtZSBDbzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABLU3\n " +
1341+ "jSayahkJYT5/UqIqViZFMVh16yrQ1mOA8V/k3H8Pk/DL1tJ1yXYEptzhKELNJIjp\n " +
1342+ "zUv0jVJHPnLGVaikzlKjYzBhMA4GA1UdDwEB/wQEAwICpDATBgNVHSUEDDAKBggr\n " +
1343+ "BgEFBQcDATAPBgNVHRMBAf8EBTADAQH/MCkGA1UdEQQiMCCCDmxvY2FsaG9zdDo1\n " +
1344+ "NDUzgg4xMjcuMC4wLjE6NTQ1MzAKBggqhkjOPQQDAgNIADBFAiEA2wpSek3WdNcr\n " +
1345+ "jSuvziv6OERWSEZObKHVIJl/Cj9SWWECIGB/W0PCjZjKXBzgoW0OzXRiDP/WRxW6\n " +
1346+ "frNHC7GJcIqs\n -----END CERTIFICATE-----\n " ,
13381347 },
13391348 }
13401349 _ , err := kubeClient .CoreV1 ().ConfigMaps ("openshift-config-managed" ).Create (context .TODO (), cm , metav1.CreateOptions {})
@@ -1396,7 +1405,7 @@ var _ = Describe("GenerateRandomPassword", func() {
13961405 Expect (err ).ToNot (HaveOccurred ())
13971406 Expect (password ).ToNot (BeEmpty ())
13981407 // base64 encoded 15 bytes = 20 chars
1399- Expect (len ( password )) .To (Equal (20 ))
1408+ Expect (password ).To (HaveLen (20 ))
14001409 })
14011410 })
14021411
@@ -1477,7 +1486,7 @@ var _ = Describe("writeConfigMapKeyToFile", func() {
14771486 Expect (err ).ToNot (HaveOccurred ())
14781487
14791488 filePath := filepath .Join (td , "ca.crt" )
1480- err = os .WriteFile (filePath , []byte ("existing-data\n " ), 0644 )
1489+ err = os .WriteFile (filePath , []byte ("existing-data\n " ), 0600 )
14811490 Expect (err ).ToNot (HaveOccurred ())
14821491
14831492 err = writeConfigMapKeyToFile (kubeClient , "test-ns" , "test-cm" , "ca.crt" , filePath , true )
@@ -1664,7 +1673,7 @@ var _ = Describe("getClusterWideArgoNamespace", func() {
16641673 })
16651674})
16661675
1667- var _ = Describe ("getPatternConditionByStatus " , func () {
1676+ var _ = Describe ("Pattern condition search functions " , func () {
16681677 var conditions []api.PatternCondition
16691678
16701679 BeforeEach (func () {
@@ -1680,70 +1689,57 @@ var _ = Describe("getPatternConditionByStatus", func() {
16801689 }
16811690 })
16821691
1683- Context ("when conditions is nil" , func () {
1684- It ("should return -1 and nil" , func () {
1685- idx , cond := getPatternConditionByStatus (nil , corev1 .ConditionTrue )
1686- Expect (idx ).To (Equal (- 1 ))
1687- Expect (cond ).To (BeNil ())
1692+ Describe ("getPatternConditionByStatus" , func () {
1693+ Context ("when conditions is nil" , func () {
1694+ It ("should return -1 and nil" , func () {
1695+ idx , cond := getPatternConditionByStatus (nil , corev1 .ConditionTrue )
1696+ Expect (idx ).To (Equal (- 1 ))
1697+ Expect (cond ).To (BeNil ())
1698+ })
16881699 })
1689- })
16901700
1691- Context ("when condition exists" , func () {
1692- It ("should return the index and condition" , func () {
1693- idx , cond := getPatternConditionByStatus (conditions , corev1 .ConditionTrue )
1694- Expect (idx ).To (Equal (0 ))
1695- Expect (cond ).ToNot (BeNil ())
1696- Expect (cond .Type ).To (Equal (api .Synced ))
1701+ Context ("when condition exists" , func () {
1702+ It ("should return the index and condition" , func () {
1703+ idx , cond := getPatternConditionByStatus (conditions , corev1 .ConditionTrue )
1704+ Expect (idx ).To (Equal (0 ))
1705+ Expect (cond ).ToNot (BeNil ())
1706+ Expect (cond .Type ).To (Equal (api .Synced ))
1707+ })
16971708 })
1698- })
16991709
1700- Context ("when condition does not exist" , func () {
1701- It ("should return -1 and nil" , func () {
1702- idx , cond := getPatternConditionByStatus (conditions , corev1 .ConditionUnknown )
1703- Expect (idx ).To (Equal (- 1 ))
1704- Expect (cond ).To (BeNil ())
1710+ Context ("when condition does not exist" , func () {
1711+ It ("should return -1 and nil" , func () {
1712+ idx , cond := getPatternConditionByStatus (conditions , corev1 .ConditionUnknown )
1713+ Expect (idx ).To (Equal (- 1 ))
1714+ Expect (cond ).To (BeNil ())
1715+ })
17051716 })
17061717 })
1707- })
1708-
1709- var _ = Describe ("getPatternConditionByType" , func () {
1710- var conditions []api.PatternCondition
1711-
1712- BeforeEach (func () {
1713- conditions = []api.PatternCondition {
1714- {
1715- Type : api .Synced ,
1716- Status : corev1 .ConditionTrue ,
1717- },
1718- {
1719- Type : api .Degraded ,
1720- Status : corev1 .ConditionFalse ,
1721- },
1722- }
1723- })
17241718
1725- Context ("when conditions is nil" , func () {
1726- It ("should return -1 and nil" , func () {
1727- idx , cond := getPatternConditionByType (nil , api .Synced )
1728- Expect (idx ).To (Equal (- 1 ))
1729- Expect (cond ).To (BeNil ())
1719+ Describe ("getPatternConditionByType" , func () {
1720+ Context ("when conditions is nil" , func () {
1721+ It ("should return -1 and nil" , func () {
1722+ idx , cond := getPatternConditionByType (nil , api .Synced )
1723+ Expect (idx ).To (Equal (- 1 ))
1724+ Expect (cond ).To (BeNil ())
1725+ })
17301726 })
1731- })
17321727
1733- Context ("when condition type exists" , func () {
1734- It ("should return the index and condition" , func () {
1735- idx , cond := getPatternConditionByType (conditions , api .Degraded )
1736- Expect (idx ).To (Equal (1 ))
1737- Expect (cond ).ToNot (BeNil ())
1738- Expect (cond .Status ).To (Equal (corev1 .ConditionFalse ))
1728+ Context ("when condition type exists" , func () {
1729+ It ("should return the index and condition" , func () {
1730+ idx , cond := getPatternConditionByType (conditions , api .Degraded )
1731+ Expect (idx ).To (Equal (1 ))
1732+ Expect (cond ).ToNot (BeNil ())
1733+ Expect (cond .Status ).To (Equal (corev1 .ConditionFalse ))
1734+ })
17391735 })
1740- })
17411736
1742- Context ("when condition type does not exist" , func () {
1743- It ("should return -1 and nil" , func () {
1744- idx , cond := getPatternConditionByType (conditions , api .Unknown )
1745- Expect (idx ).To (Equal (- 1 ))
1746- Expect (cond ).To (BeNil ())
1737+ Context ("when condition type does not exist" , func () {
1738+ It ("should return -1 and nil" , func () {
1739+ idx , cond := getPatternConditionByType (conditions , api .Unknown )
1740+ Expect (idx ).To (Equal (- 1 ))
1741+ Expect (cond ).To (BeNil ())
1742+ })
17471743 })
17481744 })
17491745})
0 commit comments