From 8eb51289f11e2445a11804e900480de69fb5bb6e Mon Sep 17 00:00:00 2001 From: Salah Al Saleh Date: Mon, 26 Feb 2024 22:16:46 +0000 Subject: [PATCH] fix tests --- pkg/collect/certificates_test.go | 52 +++++++++---------- .../host_certificates_collection_test.go | 16 +++--- 2 files changed, 33 insertions(+), 35 deletions(-) diff --git a/pkg/collect/certificates_test.go b/pkg/collect/certificates_test.go index 9b358ab89..a13bbab9f 100644 --- a/pkg/collect/certificates_test.go +++ b/pkg/collect/certificates_test.go @@ -91,25 +91,23 @@ vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep +OkuE6N36B9K -----END CERTIFICATE-----`, "validCert": `-----BEGIN CERTIFICATE----- -MIIDejCCAmKgAwIBAgIEAZaq0DANBgkqhkiG9w0BAQsFADAuMRgwFgYDVQQDEw9Q -cm9qZWN0IENvbnRvdXIxEjAQBgNVBAUTCTYxNTkyOTg5MTAeFw0yMzAyMjQwNDI3 -MThaFw0yNDAyMjUwNDI3MTZaMBAxDjAMBgNVBAMTBWVudm95MIIBIjANBgkqhkiG -9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqsNmmxb1ICso6Ay25lapcRyvLxAX/5u422uV -eiNn5jseCVXfg1jJr2Symrgou2dgMtIpZoVKT7w0el8sNpD+az5oMOWUNfTGEpYI -5zNAhtiedxCWcX15gfezOZ/DECL7HP8U37JFVdazm0CjvlQWI+8rFGvFQJJFDLYJ -h0fHGfbX6L/ST6cANtkXZyIU6CYFSgniuuDjHmQnQr6CC8lkisJxY5QVS7MZ02RR -nU/dK14ABY+mo/0ZeBKR5si04hr4i18nJJnk4DnHN+jQ/WWWSO1yLqr9kAOj37dA -nRAeKuzkx/VbU8DC/3sh0otcazoWO470D+irOy1is0whDArLNwIDAQABo4G9MIG6 -MA4GA1UdDwEB/wQEAwIE8DAdBgNVHQ4EFgQUbAavOY+vIXgc44k8GvLHH6mdzzYw -HwYDVR0jBBgw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VYVQHxYQllLjDDRcbz2DJh2DQXMZTiTLE63tC0m2RjAgMBAAGjVDBS +MDEGA1UdEQQqMCiCCGV4YW1wbGUxgghleGFtcGxlMoIIZXhhbXBsZTOCCGV4YW1w +bGU0MB0GA1UdDgQWBBTEkowqyNS1ez5XJ0shro/18UQlqTANBgkqhkiG9w0BAQsF +AAOCAQEANhnxV81NZmt8FcgrcRt73WdKDCE0hQbci65ZkAbcTVOCAs6Rw+aEC04L +0gKJT4Zmx3kR3fUwcDQRhjoXIrhmvP59k/8SN0N+Ua50oEYikaetsxEDr8oikwP2 +eHDKU451jZZfcyII2Jx8XjgtiExcNZL3N9ZtSstp3I9n9BSmMdQHDIvPxNeGdJri +l4YGTm+sJLs+c5efSNaEPw1Dr6bhAPamNQwvIspuASJlCTcMCLw2+F3dEolAFUuM +E5wI9498c+P3pvl85UfiQISTu95jOl7YmZOYl8xBpu9yhQ7kjWhVRdVAnhl9Ts9F +3TD68rCMXegJYyg5VbiwVdSPkcw3eQ== -----END CERTIFICATE-----`, "nonCert": `-----BEGIN CERTIFICATE----- Oy1is0whDArLNwIDAQABo4G9MIG6 @@ -248,16 +246,16 @@ func TestCertParser(t *testing.T) { CertificateChain: []ParsedCertificate{ { CertName: "tls.crt", - Subject: "CN=envoy", + Subject: "CN=ExampleServer", SubjectAlternativeNames: []string{ - "envoy", - "envoy.projectcontour", - "envoy.projectcontour.svc", - "envoy.projectcontour.svc.cluster.local", + "example1", + "example2", + "example3", + "example4", }, - Issuer: "SERIALNUMBER=615929891,CN=Project Contour", - NotAfter: time.Date(2025, time.February, 25, 4, 27, 16, 0, time.UTC), - NotBefore: time.Date(2024, time.February, 24, 4, 27, 18, 0, time.UTC), + Issuer: "CN=ExampleServer", + NotAfter: time.Date(2029, time.February, 24, 22, 9, 27, 0, time.UTC), + NotBefore: time.Date(2024, time.February, 26, 22, 9, 27, 0, time.UTC), IsValid: true, IsCA: false, }, diff --git a/pkg/collect/host_certificates_collection_test.go b/pkg/collect/host_certificates_collection_test.go index c374eb42d..651ba48c5 100644 --- a/pkg/collect/host_certificates_collection_test.go +++ b/pkg/collect/host_certificates_collection_test.go @@ -24,16 +24,16 @@ func Test_HostCertParser(t *testing.T) { CertificatePath: path, CertificateChain: []ParsedCertificate{ { - Subject: "CN=envoy", + Subject: "CN=ExampleServer", SubjectAlternativeNames: []string{ - "envoy", - "envoy.projectcontour", - "envoy.projectcontour.svc", - "envoy.projectcontour.svc.cluster.local", + "example1", + "example2", + "example3", + "example4", }, - Issuer: "SERIALNUMBER=615929891,CN=Project Contour", - NotAfter: time.Date(2024, time.February, 25, 4, 27, 16, 0, time.UTC), - NotBefore: time.Date(2023, time.February, 24, 4, 27, 18, 0, time.UTC), + Issuer: "CN=ExampleServer", + NotAfter: time.Date(2029, time.February, 24, 22, 9, 27, 0, time.UTC), + NotBefore: time.Date(2024, time.February, 26, 22, 9, 27, 0, time.UTC), IsValid: true, IsCA: false, },