diff --git a/pam/integration-tests/gdm-module-handler_test.go b/pam/integration-tests/gdm-module-handler_test.go index 33120ed6e..c16d6f034 100644 --- a/pam/integration-tests/gdm-module-handler_test.go +++ b/pam/integration-tests/gdm-module-handler_test.go @@ -122,6 +122,22 @@ func (gh *gdmTestModuleHandler) exampleHandleEvent(event *gdm.EventData) error { } gh.brokersInfos = ev.BrokersReceived.BrokersInfos + if gh.currentStage != proto.Stage_brokerSelection { + return nil + } + if gh.selectedBrokerName == ignoredBrokerName { + return nil + } + idx := slices.IndexFunc(gh.brokersInfos, func(bi *authd.ABResponse_BrokerInfo) bool { + return bi.Name == gh.selectedBrokerName + }) + if idx < 0 { + return fmt.Errorf("broker %q is not known", gh.selectedBrokerName) + } + + gh.pollResponses = append(gh.pollResponses, + gdm_test.SelectBrokerEvent(gh.brokersInfos[idx].Id)) + case *gdm.EventData_BrokerSelected: idx := slices.IndexFunc(gh.brokersInfos, func(broker *authd.ABResponse_BrokerInfo) bool { return broker.Id == ev.BrokerSelected.BrokerId @@ -219,11 +235,15 @@ func (gh *gdmTestModuleHandler) exampleHandleAuthDRequest(gdmData *gdm.Data) (*g idx := slices.IndexFunc(gh.brokersInfos, func(bi *authd.ABResponse_BrokerInfo) bool { return bi.Name == gh.selectedBrokerName }) - if idx < 0 { + if idx < 0 && len(gh.brokersInfos) > 0 { return nil, fmt.Errorf("broker '%s' is not known", gh.selectedBrokerName) } + if idx < 0 { + break + } gh.pollResponses = append(gh.pollResponses, gdm_test.SelectBrokerEvent(gh.brokersInfos[idx].Id)) + gh.selectedBrokerName = ignoredBrokerName case proto.Stage_authModeSelection: gh.currentUILayout = nil