diff --git a/internal/services/manager_test.go b/internal/services/manager_test.go index a10e83690..d36a12aa5 100644 --- a/internal/services/manager_test.go +++ b/internal/services/manager_test.go @@ -1,11 +1,13 @@ package services_test import ( + "cmp" "context" "fmt" "net" "os" "path/filepath" + "slices" "testing" "github.com/stretchr/testify/require" @@ -59,6 +61,12 @@ func TestRegisterGRPCServices(t *testing.T) { defer require.NoError(t, m.Stop(), "Teardown: Stop should not have returned an error, but did") got := m.RegisterGRPCServices(context.Background()).GetServiceInfo() + // Make the content of the golden file deterministic by sorting the methods by name. + for _, info := range got { + slices.SortFunc(info.Methods, func(a, b grpc.MethodInfo) int { + return cmp.Compare(a.Name, b.Name) + }) + } want := testutils.LoadWithUpdateFromGoldenYAML(t, got) requireEqualServices(t, want, got) } diff --git a/internal/services/testdata/TestRegisterGRPCServices/golden b/internal/services/testdata/TestRegisterGRPCServices/golden index cf205ee0e..429865e61 100644 --- a/internal/services/testdata/TestRegisterGRPCServices/golden +++ b/internal/services/testdata/TestRegisterGRPCServices/golden @@ -1,54 +1,54 @@ authd.NSS: methods: - - name: GetPasswdByUID + - name: GetGroupByGID isclientstream: false isserverstream: false - - name: GetPasswdEntries + - name: GetGroupByName isclientstream: false isserverstream: false - - name: GetGroupByName + - name: GetGroupEntries isclientstream: false isserverstream: false - - name: GetGroupByGID + - name: GetPasswdByName isclientstream: false isserverstream: false - - name: GetGroupEntries + - name: GetPasswdByUID isclientstream: false isserverstream: false - - name: GetShadowByName + - name: GetPasswdEntries isclientstream: false isserverstream: false - - name: GetShadowEntries + - name: GetShadowByName isclientstream: false isserverstream: false - - name: GetPasswdByName + - name: GetShadowEntries isclientstream: false isserverstream: false metadata: authd.proto authd.PAM: methods: - - name: SelectAuthenticationMode + - name: AvailableBrokers isclientstream: false isserverstream: false - - name: IsAuthenticated + - name: EndSession isclientstream: false isserverstream: false - - name: EndSession + - name: GetAuthenticationModes isclientstream: false isserverstream: false - - name: SetDefaultBrokerForUser + - name: GetPreviousBroker isclientstream: false isserverstream: false - - name: AvailableBrokers + - name: IsAuthenticated isclientstream: false isserverstream: false - - name: GetPreviousBroker + - name: SelectAuthenticationMode isclientstream: false isserverstream: false - name: SelectBroker isclientstream: false isserverstream: false - - name: GetAuthenticationModes + - name: SetDefaultBrokerForUser isclientstream: false isserverstream: false metadata: authd.proto