fix: update TestServerWithMTLS to match Phase 2 TLS configuration
This commit is contained in:
parent
ce6f2ce29d
commit
f1f2b8f9ef
@ -15,6 +15,9 @@ import (
|
|||||||
"git.dws.rip/dubey/kat/internal/pki"
|
"git.dws.rip/dubey/kat/internal/pki"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// TestServerWithMTLS tests the server with TLS configuration
|
||||||
|
// Note: In Phase 2, we've temporarily disabled client certificate verification
|
||||||
|
// to simplify the initial join process. This test has been updated to reflect that.
|
||||||
func TestServerWithMTLS(t *testing.T) {
|
func TestServerWithMTLS(t *testing.T) {
|
||||||
// Skip in short mode
|
// Skip in short mode
|
||||||
if testing.Short() {
|
if testing.Short() {
|
||||||
@ -118,7 +121,7 @@ func TestServerWithMTLS(t *testing.T) {
|
|||||||
t.Errorf("Unexpected response: %s", body)
|
t.Errorf("Unexpected response: %s", body)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test with no client cert (should fail)
|
// Test with no client cert (should succeed in Phase 2)
|
||||||
clientWithoutCert := &http.Client{
|
clientWithoutCert := &http.Client{
|
||||||
Transport: &http.Transport{
|
Transport: &http.Transport{
|
||||||
TLSClientConfig: &tls.Config{
|
TLSClientConfig: &tls.Config{
|
||||||
@ -127,9 +130,18 @@ func TestServerWithMTLS(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = clientWithoutCert.Get("https://localhost:8443/test")
|
resp, err = clientWithoutCert.Get("https://localhost:8443/test")
|
||||||
if err == nil {
|
if err != nil {
|
||||||
t.Error("Request without client cert should fail")
|
t.Errorf("Request without client cert should succeed in Phase 2: %v", err)
|
||||||
|
} else {
|
||||||
|
defer resp.Body.Close()
|
||||||
|
body, err := io.ReadAll(resp.Body)
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("Failed to read response: %v", err)
|
||||||
|
}
|
||||||
|
if !strings.Contains(string(body), "test successful") {
|
||||||
|
t.Errorf("Unexpected response: %s", body)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shutdown server
|
// Shutdown server
|
||||||
|
Loading…
x
Reference in New Issue
Block a user