chore: fix import ordering and add MinVersion to test TLS clients
- commit
- d623483b480b77214c9654a9bca2f61a6bcf8ea8
- author
- brice · · 2026-03-29 18:19 UTC
- parent
- 32363a8
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
6 files · +15 -8
M internal/adapters/in/cli/ca.go +3 -2
| @@ -9,10 +9,11 @@ import ( | |||
| 9 | 9 | "path/filepath" | |
| 10 | 10 | "time" | |
| 11 | 11 | ||
| 12 | - | pkiadapter "github.com/bnema/gordon/internal/adapters/out/pki" | |
| 13 | - | "github.com/bnema/gordon/internal/app" | |
| 14 | 12 | "github.com/bnema/zerowrap" | |
| 15 | 13 | "github.com/spf13/cobra" | |
| 14 | + | ||
| 15 | + | pkiadapter "github.com/bnema/gordon/internal/adapters/out/pki" | |
| 16 | + | "github.com/bnema/gordon/internal/app" | |
| 16 | 17 | ) | |
| 17 | 18 | ||
| 18 | 19 | func newCACmd() *cobra.Command { | |
| @@ -9,10 +9,11 @@ import ( | |||||
| 9 | "path/filepath" | 9 | "path/filepath" | ||
| 10 | "time" | 10 | "time" | ||
| 11 | 11 | ||||
| 12 | - | pkiadapter "github.com/bnema/gordon/internal/adapters/out/pki" | |||
| 13 | - | "github.com/bnema/gordon/internal/app" | |||
| 14 | "github.com/bnema/zerowrap" | 12 | "github.com/bnema/zerowrap" | ||
| 15 | "github.com/spf13/cobra" | 13 | "github.com/spf13/cobra" | ||
| 14 | + | ||||
| 15 | + | pkiadapter "github.com/bnema/gordon/internal/adapters/out/pki" | |||
| 16 | + | "github.com/bnema/gordon/internal/app" | |||
| 16 | ) | 17 | ) | ||
| 17 | 18 | ||||
| 18 | func newCACmd() *cobra.Command { | 19 | func newCACmd() *cobra.Command { | ||
M internal/adapters/in/http/onboarding/handler_test.go +2 -1
| @@ -5,8 +5,9 @@ import ( | |||
| 5 | 5 | "net/http/httptest" | |
| 6 | 6 | "testing" | |
| 7 | 7 | ||
| 8 | - | "github.com/bnema/gordon/internal/adapters/in/http/onboarding" | |
| 9 | 8 | "github.com/stretchr/testify/assert" | |
| 9 | + | ||
| 10 | + | "github.com/bnema/gordon/internal/adapters/in/http/onboarding" | |
| 10 | 11 | ) | |
| 11 | 12 | ||
| 12 | 13 | func TestHandler_CACert(t *testing.T) { | |
| @@ -5,8 +5,9 @@ import ( | |||||
| 5 | "net/http/httptest" | 5 | "net/http/httptest" | ||
| 6 | "testing" | 6 | "testing" | ||
| 7 | 7 | ||||
| 8 | - | "github.com/bnema/gordon/internal/adapters/in/http/onboarding" | |||
| 9 | "github.com/stretchr/testify/assert" | 8 | "github.com/stretchr/testify/assert" | ||
| 9 | + | ||||
| 10 | + | "github.com/bnema/gordon/internal/adapters/in/http/onboarding" | |||
| 10 | ) | 11 | ) | ||
| 11 | 12 | ||||
| 12 | func TestHandler_CACert(t *testing.T) { | 13 | func TestHandler_CACert(t *testing.T) { | ||
M internal/adapters/out/pki/mobileconfig_test.go +2 -1
| @@ -4,9 +4,10 @@ import ( | |||
| 4 | 4 | "strings" | |
| 5 | 5 | "testing" | |
| 6 | 6 | ||
| 7 | - | "github.com/bnema/gordon/internal/adapters/out/pki" | |
| 8 | 7 | "github.com/stretchr/testify/assert" | |
| 9 | 8 | "github.com/stretchr/testify/require" | |
| 9 | + | ||
| 10 | + | "github.com/bnema/gordon/internal/adapters/out/pki" | |
| 10 | 11 | ) | |
| 11 | 12 | ||
| 12 | 13 | func TestGenerateMobileconfig(t *testing.T) { | |
| @@ -4,9 +4,10 @@ import ( | |||||
| 4 | "strings" | 4 | "strings" | ||
| 5 | "testing" | 5 | "testing" | ||
| 6 | 6 | ||||
| 7 | - | "github.com/bnema/gordon/internal/adapters/out/pki" | |||
| 8 | "github.com/stretchr/testify/assert" | 7 | "github.com/stretchr/testify/assert" | ||
| 9 | "github.com/stretchr/testify/require" | 8 | "github.com/stretchr/testify/require" | ||
| 9 | + | ||||
| 10 | + | "github.com/bnema/gordon/internal/adapters/out/pki" | |||
| 10 | ) | 11 | ) | ||
| 11 | 12 | ||||
| 12 | func TestGenerateMobileconfig(t *testing.T) { | 13 | func TestGenerateMobileconfig(t *testing.T) { | ||
M internal/app/pki_integration_test.go +2 -0
| @@ -62,6 +62,7 @@ func TestTLSHandshake_OnDemandCert(t *testing.T) { | |||
| 62 | 62 | client := &http.Client{ | |
| 63 | 63 | Transport: &http.Transport{ | |
| 64 | 64 | TLSClientConfig: &tls.Config{ | |
| 65 | + | MinVersion: tls.VersionTLS12, | |
| 65 | 66 | RootCAs: rootPool, | |
| 66 | 67 | ServerName: "test.local", | |
| 67 | 68 | }, | |
| @@ -108,6 +109,7 @@ func TestTLSHandshake_UnknownDomain_Rejected(t *testing.T) { | |||
| 108 | 109 | client := &http.Client{ | |
| 109 | 110 | Transport: &http.Transport{ | |
| 110 | 111 | TLSClientConfig: &tls.Config{ | |
| 112 | + | MinVersion: tls.VersionTLS12, | |
| 111 | 113 | RootCAs: rootPool, | |
| 112 | 114 | ServerName: "unknown.local", // not in route table | |
| 113 | 115 | }, | |
| @@ -62,6 +62,7 @@ func TestTLSHandshake_OnDemandCert(t *testing.T) { | |||||
| 62 | client := &http.Client{ | 62 | client := &http.Client{ | ||
| 63 | Transport: &http.Transport{ | 63 | Transport: &http.Transport{ | ||
| 64 | TLSClientConfig: &tls.Config{ | 64 | TLSClientConfig: &tls.Config{ | ||
| 65 | + | MinVersion: tls.VersionTLS12, | |||
| 65 | RootCAs: rootPool, | 66 | RootCAs: rootPool, | ||
| 66 | ServerName: "test.local", | 67 | ServerName: "test.local", | ||
| 67 | }, | 68 | }, | ||
| @@ -108,6 +109,7 @@ func TestTLSHandshake_UnknownDomain_Rejected(t *testing.T) { | |||||
| 108 | client := &http.Client{ | 109 | client := &http.Client{ | ||
| 109 | Transport: &http.Transport{ | 110 | Transport: &http.Transport{ | ||
| 110 | TLSClientConfig: &tls.Config{ | 111 | TLSClientConfig: &tls.Config{ | ||
| 112 | + | MinVersion: tls.VersionTLS12, | |||
| 111 | RootCAs: rootPool, | 113 | RootCAs: rootPool, | ||
| 112 | ServerName: "unknown.local", // not in route table | 114 | ServerName: "unknown.local", // not in route table | ||
| 113 | }, | 115 | }, | ||
M internal/usecase/pki/service.go +2 -1
| @@ -7,9 +7,10 @@ import ( | |||
| 7 | 7 | "sync" | |
| 8 | 8 | "time" | |
| 9 | 9 | ||
| 10 | + | "github.com/bnema/zerowrap" | |
| 11 | + | ||
| 10 | 12 | "github.com/bnema/gordon/internal/boundaries/out" | |
| 11 | 13 | "github.com/bnema/gordon/internal/domain" | |
| 12 | - | "github.com/bnema/zerowrap" | |
| 13 | 14 | ) | |
| 14 | 15 | ||
| 15 | 16 | const ( | |
| @@ -7,9 +7,10 @@ import ( | |||||
| 7 | "sync" | 7 | "sync" | ||
| 8 | "time" | 8 | "time" | ||
| 9 | 9 | ||||
| 10 | + | "github.com/bnema/zerowrap" | |||
| 11 | + | ||||
| 10 | "github.com/bnema/gordon/internal/boundaries/out" | 12 | "github.com/bnema/gordon/internal/boundaries/out" | ||
| 11 | "github.com/bnema/gordon/internal/domain" | 13 | "github.com/bnema/gordon/internal/domain" | ||
| 12 | - | "github.com/bnema/zerowrap" | |||
| 13 | ) | 14 | ) | ||
| 14 | 15 | ||||
| 15 | const ( | 16 | const ( | ||
M internal/usecase/pki/service_test.go +4 -3
| @@ -5,12 +5,13 @@ import ( | |||
| 5 | 5 | "crypto/tls" | |
| 6 | 6 | "testing" | |
| 7 | 7 | ||
| 8 | - | pkiadapter "github.com/bnema/gordon/internal/adapters/out/pki" | |
| 9 | - | "github.com/bnema/gordon/internal/domain" | |
| 10 | - | pkiusecase "github.com/bnema/gordon/internal/usecase/pki" | |
| 11 | 8 | "github.com/bnema/zerowrap" | |
| 12 | 9 | "github.com/stretchr/testify/assert" | |
| 13 | 10 | "github.com/stretchr/testify/require" | |
| 11 | + | ||
| 12 | + | pkiadapter "github.com/bnema/gordon/internal/adapters/out/pki" | |
| 13 | + | "github.com/bnema/gordon/internal/domain" | |
| 14 | + | pkiusecase "github.com/bnema/gordon/internal/usecase/pki" | |
| 14 | 15 | ) | |
| 15 | 16 | ||
| 16 | 17 | // stubConfigService satisfies pkiusecase.RouteChecker | |
| @@ -5,12 +5,13 @@ import ( | |||||
| 5 | "crypto/tls" | 5 | "crypto/tls" | ||
| 6 | "testing" | 6 | "testing" | ||
| 7 | 7 | ||||
| 8 | - | pkiadapter "github.com/bnema/gordon/internal/adapters/out/pki" | |||
| 9 | - | "github.com/bnema/gordon/internal/domain" | |||
| 10 | - | pkiusecase "github.com/bnema/gordon/internal/usecase/pki" | |||
| 11 | "github.com/bnema/zerowrap" | 8 | "github.com/bnema/zerowrap" | ||
| 12 | "github.com/stretchr/testify/assert" | 9 | "github.com/stretchr/testify/assert" | ||
| 13 | "github.com/stretchr/testify/require" | 10 | "github.com/stretchr/testify/require" | ||
| 11 | + | ||||
| 12 | + | pkiadapter "github.com/bnema/gordon/internal/adapters/out/pki" | |||
| 13 | + | "github.com/bnema/gordon/internal/domain" | |||
| 14 | + | pkiusecase "github.com/bnema/gordon/internal/usecase/pki" | |||
| 14 | ) | 15 | ) | ||
| 15 | 16 | ||||
| 16 | // stubConfigService satisfies pkiusecase.RouteChecker | 17 | // stubConfigService satisfies pkiusecase.RouteChecker | ||