Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Base64 encoded certificates in test data to make pre-commit check happy #584

Merged
merged 2 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ repos:
- id: check-merge-conflict
- id: check-shebang-scripts-are-executable
- id: detect-private-key
exclude: ^testdata/certs/old/tls.key$|^testdata/certs/new/tls.key$
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace
Expand Down
16 changes: 8 additions & 8 deletions main_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main

import (
"io"
"encoding/base64"
"net/http"
"net/http/httptest"
"os"
Expand Down Expand Up @@ -54,7 +54,7 @@ func Test_healthCheck(t *testing.T) {
}

func copyCertificate(path string) error {
r, err := os.Open(path + "/tls.crt")
r, err := os.ReadFile(path + "/tls-b64.crt")
if err != nil {
return err
}
Expand All @@ -64,12 +64,12 @@ func copyCertificate(path string) error {
return err
}

_, err = io.Copy(w, r)
crt, err := base64.StdEncoding.DecodeString(string(r))
if err != nil {
return err
}

err = r.Close()
_, err = w.Write(crt)
if err != nil {
return err
}
Expand All @@ -79,22 +79,22 @@ func copyCertificate(path string) error {
return err
}

r, err = os.Open(path + "/tls.key")
r, err = os.ReadFile(path + "/tls-b64.key")
if err != nil {
return err
}

w, err = os.Create("testdata/certs/current/tls.key")
key, err := base64.StdEncoding.DecodeString(string(r))
if err != nil {
return err
}

_, err = io.Copy(w, r)
w, err = os.Create("testdata/certs/current/tls.key")
if err != nil {
return err
}

err = r.Close()
_, err = w.Write(key)
if err != nil {
return err
}
Expand Down
1 change: 1 addition & 0 deletions testdata/certs/new/tls-b64.crt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUN4ekNDQWErZ0F3SUJBZ0lVR1k1anA3MlpEZ3Zmby9HRjhVZFovcUhCT2NZd0RRWUpLb1pJaHZjTkFRRUwKQlFBd0FEQWVGdzB5TkRFd01Ea3hOREl5TVRGYUZ3MHpOREV3TURjeE5ESXlNVEZhTUFBd2dnRWlNQTBHQ1NxRwpTSWIzRFFFQkFRVUFBNElCRHdBd2dnRUtBb0lCQVFEY0EyN1J4elFFN0Z3ckg4QkFXYjd5K1NLVU1EN1lDczd4CnBUWVpPUEdhZ0EwV1RzSnlDL29Tb1RtZUUzOGhKRFFJZng0Q3hPcklocjVCdm9yZFJkem1LNVFwZDhDa1FIMTEKWHZDa3ZnSU81bDIwbHo5S09obHYwV2ZFNTlab0J5WTUyTTVBNHVSSEZsRGY0RE5MRDdpb2F1VU5weDcvRWVxYgpkQlFlZDFSWDVTV1VwOU9RSGFqSXVzVCtpV0ZoZnl6T2pRbHJvcWFPN1diNm10bDdWVzdyWkdESDFGYUdwQi92CmZGMm02dVpKRGNpQ1VCOUxjd0FhUlI0QldueUJLOVBWYVlVbnFEMk1uWFpQcmVzYWkxYnMvcFJ3bk5YNTJKMFQKSWJYbzNrL01vbGN1eVc3aFlIUnRERXFQQWltR2liSEtySVBJTW8rTERaZzNQT3dnaEpSTkFnTUJBQUdqT1RBMwpNQXNHQTFVZER3UUVBd0lGNERBSkJnTlZIUk1FQWpBQU1CMEdBMVVkRGdRV0JCVElJQmZSVDlRS0xBTjZHbDZDCmpJWVJwbDNMVFRBTkJna3Foa2lHOXcwQkFRc0ZBQU9DQVFFQXRFSkZkRWhTREVObVhVdFMrVEZPNUV3c3prK1EKOFVsZldMdlhJRkg4T2VFTHVKOURjVXFWKzlrSkRObzFNSnp0ZXMzc0FmZzQ5elZISUh5Ry9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Nnp0RWpzZm5ranBXVzB4Q2tpZ3BZbjkxbEh5eTVkZS9pTlMKNDIrUndLZFJ5TGQ2KzNzRFJTcktXZUVSOTdPa2daQ2poQ21RcE5uU3Q2ZXVjYUZMR3ZTKy9xa3h0d0tCZ1FDMApkSFh0TmpkVG5tLzJLUXFCMkRlM1p0Lzl4cjRhaHRtNVkzeWxXSmloT3pwVWl0MDlKTmIreVVabVVlampod0FaCnJVWHlhY09rdzVGWlVRcEZ2UG9rY0hVUG9GVDhCeXdWeklueG82S1laQ2wvbmVqVWkvQjRmMFQ5bkY3UHREVXcKYkN2Z2U0UzQ4Q21lMEw3OTF3QjhZaDdzRTAvZGNCY3NGbGsybGhoVDJ3S0JnUURsZW50MDlJWGFBdm8xenk1Two3ZThEbDFmOC8vWkgwekhpcyt2dDgrNzJEbkhTelRFdlFtZ2ZjNEZVWW1ybnpKdG5PQ3RFSVl6SXk1TXNybDhkCnF5Wms1eDRqQ3ZaS2JyaU9WR1QvZE90WG54N0cvUXJCejE4c1NEVDNaMUFVb2kzb29oZnZWaDliTHowbWlHZm0KaCtPaElUMmtDc2FjalRuQ1NJZGNXaGVtRFE9PQotLS0tLUVORCBQUklWQVRFIEtFWS0tLS0tCg==
17 changes: 0 additions & 17 deletions testdata/certs/new/tls.crt

This file was deleted.

28 changes: 0 additions & 28 deletions testdata/certs/new/tls.key

This file was deleted.

1 change: 1 addition & 0 deletions testdata/certs/old/tls-b64.crt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUN4akNDQWE2Z0F3SUJBZ0lUVFZ6ZUgxR0ZjTHVmMmVocWU2MUR5eWtTNGpBTkJna3Foa2lHOXcwQkFRc0YKQURBQU1CNFhEVEkwTVRBd09URXpOVEl3TWxvWERUTTBNVEF3TnpFek5USXdNbG93QURDQ0FTSXdEUVlKS29aSQpodmNOQVFFQkJRQURnZ0VQQURDQ0FRb0NnZ0VCQU5majN3MHRX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1dW4zbEgxeVR3SwotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
1 change: 1 addition & 0 deletions testdata/certs/old/tls-b64.key
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
LS0tLS1CRUdJTiBQUklWQVRFIEtFWS0tLS0tCk1JSUV2UUlCQURBTkJna3Foa2lHOXcwQkFRRUZBQVNDQktjd2dnU2pBZ0VBQW9JQkFRRFg0OThOTFZ0bEhIN0QKZm5zQXU0OURwVCtyNWFqS1V6N2pWSU44akJqWnFZUVN1Z3Z3K1ZXdDBRRjFzYzlPekl1TGl0OGFMMWdCdmN6cQpiWUlrZ3g1RjFHV2E0Z0oxTlVSWTZocFRsMy82RDh1bWZoMzBPYlVrbGV6b2VMai9JTUcwUE9IRHFqaEQzN3VzCng4QS9qZVBZYXJON3lPNkxsS2RuSURBbEtJaGRycnhvbVZ1MjBtelU2ck4xQUE0Z2xDVHpsUmZRK0tGOUJYQXUKdGU0TktxQUJYcUo3b2hBaWVUUWpmbVRDUEJ6akNFWmxWUGZ5dDBkd1d0MmVuSzJlQmFWMno4Uzc2am8xbkVjbApaZ01sNkRpdnB6VUk0RDA5bGd3RzlxNDc5dkxLTTZBZEd4Y2gwbW1xUEQrNC9BeFNieGNvaHVib0I3emhyeXFGCk9Hek1RdFBkQWdNQkFBRUNnZ0VBSlBka0EwL2JxUy9NcGVGVG92KzZxNERSYXZmdlk3dUcxbXFyZkFsS0hRVVoKZEJKdXhvT1BEK3pzbE5CT09NWXQ4OFlpNXdzcHhOeVF5S2haSXpMZlhXSWR4cnhCNHZ0c3VWUFdqNjh1anUwaQorQjU2dHcybGpuN3NlcTduTUdwVnVLeS9GSitpTkQ4TVZleTdKcmEvUjVpWHBJKzJodWg4bEp3dW1rSTdQVjBFCmF0N28rd2xjeGYyZGFPY21KT1JEMmROcjArUEdNOGZMVnFqT3VaNC85T0N0SHNXclloSTBYMVNvUGJWampUKzAKTVFpbmZNRWR0MC9ZQjFHZUs4V2c4RUVVYX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rQ2dZRUE0RFRJeXppaHVVOEdEOTRFTDJEcAo4K29rcEJPRW9ZdnphdnNqRngvUEJvZmxmWGZ5QmR0QTFZbmZNcHpuSldpSE43eG93cUNsMVBmaTU5bEtJcElOCmtDZDdtRjlYNzc0U0VFWEJVR0kzSFFJbllxZk5VRnM4TEQyNC9EZXJ0MStYWEFEYkJ2THFKdnJVbVZURjBwalMKYlBKcWppQ1ZFSlRKdzVNYXl6UWRGaXM9Ci0tLS0tRU5EIFBSSVZBVEUgS0VZLS0tLS0K
17 changes: 0 additions & 17 deletions testdata/certs/old/tls.crt

This file was deleted.

28 changes: 0 additions & 28 deletions testdata/certs/old/tls.key

This file was deleted.

Loading