Gate the smoke test's SDK paths on routers that handle OIDC sessions

- turns the oidc capability from a config switch into a test gate: OIDC stays on, as a 2.x
  controller runs it by default, and tests skip SDK client and SDK-hosted paths through routers older
  than 1.6, whose OIDC handling had many bugs that 1.6 fixed
- stops defaulting the oidc flag off for old routers, which did nothing once the controller started
  binding OIDC by default
- requires OIDC on the client routers for SDK clients, and on the hosting routers alongside SDK hosting
  for SDK-hosted services; ERT client and ERT-hosted paths always run
- adds Support.And for checks that span both ends of a path
This commit is contained in:
Paul Lorenz
2026-10-19 20:21:16 -04:00
parent 9c673c9bfb
commit 2425ba04d5
7 changed files with 52 additions and 22 deletions
+17 -17
View File
@@ -50,11 +50,12 @@ var (
Description: "binds SDK-hosted terminators with the JWT service sessions a 2.x controller issues",
}
// The floor is the oldest line the compat test has run with OIDC on, not a confirmed boundary.
// Routers before 1.6 handle OIDC api sessions only partly: 1.1 rejects them outright, and 1.6
// fixed many bugs in the rest.
CapOidc = Capability{
Name: "oidc",
MinVersion: "v1.6.0",
Description: "accepts OIDC api sessions from a 2.x controller",
Description: "handles the OIDC api sessions SDK clients get from a 2.x controller",
}
)
@@ -84,6 +85,17 @@ func RouterSupports(m *model.Model, c *model.Component, capability Capability) S
return capability.supportedBy(c.Id, router.Version, override, overridden)
}
// And reports whether both s and other hold, with both reasons when they don't.
func (s Support) And(other Support) Support {
var reasons []string
for _, support := range []Support{s, other} {
if !support.Supported {
reasons = append(reasons, support.Reason)
}
}
return combine(reasons)
}
// RoutersSupport reports whether every router selected by selector has every one of capabilities.
// When one doesn't, Reason lists each gap.
func RoutersSupport(m *model.Model, selector string, capabilities ...Capability) Support {
@@ -139,8 +151,8 @@ func combine(reasons []string) Support {
}
// applyCapabilities fits the model's config to what its edge routers support: a router without
// managed link config keeps its link config local, and OIDC defaults off when any router lacks it,
// though an oidc label still decides. It runs after the routers' versions are set.
// managed link config keeps its link config local. It also rejects malformed capability overrides and
// logs what each router lacks. It runs after the routers' versions are set.
func applyCapabilities(m *model.Model) error {
for _, capability := range Capabilities {
if override, found := m.GetStringVariable(capability.variable()); found && override != "on" && override != "off" {
@@ -148,8 +160,7 @@ func applyCapabilities(m *model.Model) error {
}
}
oidc := true
err := m.ForEachComponent(".edge-router", 1, func(c *model.Component) error {
return m.ForEachComponent(".edge-router", 1, func(c *model.Component) error {
if support := combine(gaps(m, c, Capabilities)); !support.Supported {
pfxlog.Logger().Infof("router capabilities: %s", support.Reason)
}
@@ -159,17 +170,6 @@ func applyCapabilities(m *model.Model) error {
return tag == "ctrl-managed-link"
})
}
if !RouterSupports(m, c, CapOidc).Supported {
oidc = false
}
return nil
})
if err != nil {
return err
}
if !oidc {
m.Scope.Defaults["oidc"] = false
}
return nil
}
@@ -59,3 +59,14 @@ func TestCapabilityMinVersionsParse(t *testing.T) {
require.NoError(t, err, capability.Name)
}
}
func TestSupportAnd(t *testing.T) {
yes := Support{Supported: true}
noClient := Support{Reason: "client router lacks it"}
noHost := Support{Reason: "host router lacks it"}
require.Equal(t, yes, yes.And(yes))
require.Equal(t, noClient, noClient.And(yes))
require.Equal(t, noHost, yes.And(noHost))
require.Equal(t, Support{Reason: "client router lacks it; host router lacks it"}, noClient.And(noHost))
}
+1 -1
View File
@@ -111,7 +111,7 @@ func testFileDownload(t *testing.T, hostSelector string, client smoke.HttpClient
}
name := fmt.Sprintf("%v-(%s<-%s)-%s-%v", client, hostSelector, hostType, fileSize, encDesk)
if support := hostingSupport(hostType); !support.Supported {
if support := pathSupport(hostSelector, hostType); !support.Supported {
t.Run(name, func(t *testing.T) { t.Skip(support.Reason) })
return true
}
+20 -1
View File
@@ -27,9 +27,23 @@ import (
"github.com/openziti/ziti/zititest/zitirest"
)
// sdkClientSupport reports whether the client routers can carry SDK clients' connections.
func sdkClientSupport() smoke.Support {
return smoke.RoutersSupport(run.GetModel(), ".client", smoke.CapOidc)
}
// sdkHostingSupport reports whether the hosting routers can carry SDK-hosted services.
func sdkHostingSupport() smoke.Support {
return smoke.RoutersSupport(run.GetModel(), ".host", smoke.CapSdkHosting)
return smoke.RoutersSupport(run.GetModel(), ".host", smoke.CapSdkHosting, smoke.CapOidc)
}
// clientSupport reports whether the client routers can carry connections from clients of clientType.
// Every client type but the router's own tunneler, "ert", connects through the SDK.
func clientSupport(clientType string) smoke.Support {
if clientType == "ert" {
return smoke.Support{Supported: true}
}
return sdkClientSupport()
}
// hostingSupport reports whether the hosting routers can carry services hosted by hostType. Every host
@@ -41,6 +55,11 @@ func hostingSupport(hostType string) smoke.Support {
return sdkHostingSupport()
}
// pathSupport reports whether clients of clientType can reach services hosted by hostType.
func pathSupport(clientType, hostType string) smoke.Support {
return clientSupport(clientType).And(hostingSupport(hostType))
}
// hostedServices returns the encrypted and unencrypted kind services of each of hostTypes that the
// hosting routers can carry.
func hostedServices(kind string, hostTypes ...string) []string {
+1 -1
View File
@@ -81,7 +81,7 @@ func testIPerf(t *testing.T, hostSelector string, hostType string, encrypted boo
success := false
t.Run(fmt.Sprintf("(%s%s%s)-%v", hostSelector, direction, hostType, encDesk), func(t *testing.T) {
if support := hostingSupport(hostType); !support.Supported {
if support := pathSupport(hostSelector, hostType); !support.Supported {
t.Skip(support.Reason)
}
o, err := smoke.TestIperf(hostSelector, hostType, encrypted, reversed, run)
+1 -1
View File
@@ -84,7 +84,7 @@ func testScp(t *testing.T, hostSelector string, hostType string, encrypted bool)
encDesk = "unencrypted"
}
if support := hostingSupport(hostType); !support.Supported {
if support := pathSupport(hostSelector, hostType); !support.Supported {
t.Run(fmt.Sprintf("(%s<->%s)-%v", hostSelector, hostType, encDesk), func(t *testing.T) { t.Skip(support.Reason) })
return true
}
+1 -1
View File
@@ -25,7 +25,7 @@ import (
)
func TestSdkSim(t *testing.T) {
if support := sdkHostingSupport(); !support.Supported {
if support := sdkClientSupport().And(sdkHostingSupport()); !support.Supported {
t.Skip(support.Reason)
}
waitForTerminators(t, 30*time.Second, "sim")