Support configurable TLS probes in the API and dashboard
This commit is contained in:
1 parent
0bde5627f0
commit
c7fdd2c430
38 files changed
+495
-203
No files matched your search
@@ -443,6 +443,32 @@ func TestInboundChecksPutUpdatesForm(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestInboundTLSFormRoundTrip(t *testing.T) {
|
||||
_, caURL := newFakeControlAPI(t)
|
||||
ts := newTestServer(t, caURL)
|
||||
form := map[string][]string{
|
||||
"tls_mode": {"custom"}, "tls_port": {"8443", "9443"}, "tls_version": {"1.2", "1.3"},
|
||||
}
|
||||
body := postForm(t, ts, "PUT", "/settings/inbound-checks", form)
|
||||
for _, page := range []string{body, get(t, ts, "/settings")} {
|
||||
for _, value := range []string{`value="custom" selected`, `value="8443"`, `value="9443"`, `value="1.2" selected`, `value="1.3" selected`} {
|
||||
if !strings.Contains(page, value) {
|
||||
t.Errorf("missing %q from persisted TLS form", value)
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, mode := range []string{"disabled", "auto"} {
|
||||
body = postForm(t, ts, "PUT", "/settings/inbound-checks", map[string][]string{"tls_mode": {mode}})
|
||||
if !strings.Contains(body, fmt.Sprintf(`value="%s" selected`, mode)) {
|
||||
t.Errorf("TLS mode %q did not round-trip", mode)
|
||||
}
|
||||
}
|
||||
body = postForm(t, ts, "PUT", "/settings/inbound-checks", map[string][]string{"tls_mode": {"custom"}})
|
||||
if !strings.Contains(body, "добавьте хотя бы одну TLS-проверку") {
|
||||
t.Error("missing validation message for custom TLS with no rows")
|
||||
}
|
||||
}
|
||||
|
||||
func TestIPsPageShowsSettleBadge(t *testing.T) {
|
||||
fake, caURL := newFakeControlAPI(t)
|
||||
now := time.Now()
|
||||
|
||||
Reference in new issue
Block a user