Skip to content

Commit

Permalink
Fix spelling in strings (#728)
Browse files Browse the repository at this point in the history
  • Loading branch information
adombeck authored Jan 15, 2025
2 parents c636df9 + 892a29d commit 1127cf2
Show file tree
Hide file tree
Showing 14 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions internal/brokers/broker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ func TestNewBroker(t *testing.T) {
// Missing field errors
"Error when config does not have name field": {configFile: "no_name.conf", wantErr: true},
"Error when config does not have brand_icon field": {configFile: "no_brand_icon.conf", wantErr: true},
"Error when config does not have dbus.name field": {configFile: "no_dbus_name.conf", wantErr: true},
"Error when config does not have dbus.object field": {configFile: "no_dbus_object.conf", wantErr: true},
"Error when config does not have dbus_name field": {configFile: "no_dbus_name.conf", wantErr: true},
"Error when config does not have dbus_object field": {configFile: "no_dbus_object.conf", wantErr: true},
}
for name, tc := range tests {
t.Run(name, func(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions internal/brokers/dbusbroker.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ type dbusBroker struct {

// newDbusBroker returns a dbus broker and broker attributes from its configuration file.
func newDbusBroker(ctx context.Context, bus *dbus.Conn, configFile string) (b dbusBroker, name, brandIcon string, err error) {
defer decorate.OnError(&err, "dbus broker from configuration file: %q", configFile)
defer decorate.OnError(&err, "D-Bus broker from configuration file: %q", configFile)

log.Debugf(ctx, "Dbus broker configuration at %q", configFile)
log.Debugf(ctx, "D-Bus broker configuration at %q", configFile)

cfg, err := ini.Load(configFile)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions internal/daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ func (d *Daemon) Serve(ctx context.Context) (err error) {
log.Debug(context.Background(), "Ready state sent to systemd")
}

log.Infof(ctx, "Serving GRPC requests on %v", d.lis.Addr())
log.Infof(ctx, "Serving gRPC requests on %v", d.lis.Addr())
if err := d.grpcServer.Serve(d.lis); err != nil {
return fmt.Errorf("grpc error: %v", err)
return fmt.Errorf("gRPC error: %v", err)
}
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion internal/daemon/daemon_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func TestNew(t *testing.T) {
}
require.NoError(t, err, "New() should not return an error")

require.True(t, registered, "daemon should register GRPC services")
require.True(t, registered, "daemon should register gRPC services")
require.Equal(t, tc.wantSelectedSocket, filepath.Base(d.SelectedSocketAddr()), "Desired socket is selected")
})
}
Expand Down
4 changes: 2 additions & 2 deletions internal/services/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func NewManager(ctx context.Context, cacheDir, brokersConfPath string, configure

// RegisterGRPCServices returns a new grpc Server after registering both NSS and PAM services.
func (m Manager) RegisterGRPCServices(ctx context.Context) *grpc.Server {
log.Debug(ctx, "Registering GRPC services")
log.Debug(ctx, "Registering gRPC services")

opts := []grpc.ServerOption{permissions.WithUnixPeerCreds(), grpc.ChainUnaryInterceptor(m.globalPermissions, errmessages.RedactErrorInterceptor)}
grpcServer := grpc.NewServer(opts...)
Expand All @@ -80,7 +80,7 @@ func (m Manager) RegisterGRPCServices(ctx context.Context) *grpc.Server {

// stop stops the underlying cache.
func (m *Manager) stop() error {
log.Debug(context.TODO(), "Closing grpc manager and cache")
log.Debug(context.TODO(), "Closing gRPC manager and cache")

return m.userManager.Stop()
}
2 changes: 1 addition & 1 deletion internal/services/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func TestAccessAuthorization(t *testing.T) {
// Global authorization for NSS is always granted for non root user.
nssClient := authd.NewNSSClient(conn)
_, err = nssClient.GetPasswdByName(context.Background(), &authd.GetPasswdByNameRequest{Name: ""})
require.Error(t, err, "Expected a GRPC error from the server")
require.Error(t, err, "Expected a gRPC error from the server")

err = conn.Close()
require.NoError(t, err, "Teardown: could not close the client connection")
Expand Down
2 changes: 1 addition & 1 deletion internal/services/nss/nss.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type Service struct {

// NewService returns a new NSS GRPC service.
func NewService(ctx context.Context, userManager *users.Manager, brokerManager *brokers.Manager, permissionManager *permissions.Manager) Service {
log.Debug(ctx, "Building new GRPC NSS service")
log.Debug(ctx, "Building new gRPC NSS service")

return Service{
userManager: userManager,
Expand Down
6 changes: 3 additions & 3 deletions internal/services/nss/nss_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ func newNSSClient(t *testing.T, sourceDB string, currentUserNotRoot bool) (clien
})

conn, err := grpc.NewClient("unix://"+socketPath, grpc.WithTransportCredentials(insecure.NewCredentials()))
require.NoError(t, err, "Setup: Could not connect to GRPC server")
require.NoError(t, err, "Setup: Could not connect to gRPC server")

t.Cleanup(func() { _ = conn.Close() }) // We don't care about the error on cleanup

Expand Down Expand Up @@ -359,7 +359,7 @@ func requireExpectedResult[T authd.PasswdEntry | authd.GroupEntry | authd.Shadow
if wantErr {
require.Error(t, err, fmt.Sprintf("%s should return an error but did not", funcName))
s, ok := status.FromError(err)
require.True(t, ok, "The error is always a GRPC error")
require.True(t, ok, "The error is always a gRPC error")
if wantErrNotExists {
require.Equal(t, codes.NotFound, s.Code(), fmt.Sprintf("%s should return NotFound error", funcName))
}
Expand All @@ -377,7 +377,7 @@ func requireExpectedEntriesResult[T authd.PasswdEntry | authd.GroupEntry | authd
if wantErr {
require.Error(t, err, fmt.Sprintf("%s should return an error but did not", funcName))
s, ok := status.FromError(err)
require.True(t, ok, "The error is always a GRPC error")
require.True(t, ok, "The error is always a gRPC error")
require.NotEqual(t, codes.NotFound, s.Code(), fmt.Sprintf("%s should never return NotFound error even with empty list", funcName))
return
}
Expand Down
2 changes: 1 addition & 1 deletion internal/services/pam/pam.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type Service struct {

// NewService returns a new PAM GRPC service.
func NewService(ctx context.Context, userManager *users.Manager, brokerManager *brokers.Manager, permissionManager *permissions.Manager) Service {
log.Debug(ctx, "Building new GRPC PAM service")
log.Debug(ctx, "Building new gRPC PAM service")

return Service{
userManager: userManager,
Expand Down
2 changes: 1 addition & 1 deletion internal/services/pam/pam_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ func newPamClient(t *testing.T, m *users.Manager, brokerManager *brokers.Manager
})

conn, err := grpc.NewClient("unix://"+socketPath, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithUnaryInterceptor(errmessages.FormatErrorMessage))
require.NoError(t, err, "Setup: Could not connect to GRPC server")
require.NoError(t, err, "Setup: Could not connect to gRPC server")

t.Cleanup(func() { _ = conn.Close() }) // We don't care about the error on cleanup

Expand Down
4 changes: 2 additions & 2 deletions internal/services/permissions/permissions.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ func (m Manager) IsRequestFromRoot(ctx context.Context) (err error) {

p, ok := peer.FromContext(ctx)
if !ok {
return errors.New("context request doesn't have grpc peer information")
return errors.New("context request doesn't have gRPC peer information")
}
pci, ok := p.AuthInfo.(peerCredsInfo)
if !ok {
return errors.New("context request doesn't have valid grpc peer credential information")
return errors.New("context request doesn't have valid gRPC peer credential information")
}

if pci.uid != m.rootUID {
Expand Down
2 changes: 1 addition & 1 deletion internal/services/permissions/permissions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,5 @@ func TestWithUnixPeerCreds(t *testing.T) {

g := grpc.NewServer(permissions.WithUnixPeerCreds())

require.NotNil(t, g, "New grpc with Unix Peer Creds is created")
require.NotNil(t, g, "New gRPC with Unix Peer Creds is created")
}
2 changes: 1 addition & 1 deletion pam/go-exec/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -1076,7 +1076,7 @@ do_pam_action_thread (pam_handle_t *pamh,
server = setup_dbus_server (module_data, &error);
if (!server)
{
notify_error (pamh, action, "can't create DBus connection: %s", error->message);
notify_error (pamh, action, "can't create D-Bus connection: %s", error->message);
return PAM_SYSTEM_ERR;
}

Expand Down
2 changes: 1 addition & 1 deletion pam/internal/dbusmodule/transaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ func prepareTestServer(t *testing.T, expectedReturns []methodReturn) (string, *t
require.NoError(t, err, "Setup: Connecting to system Bus failed")
t.Cleanup(func() {
if err := conn.Close(); err != nil {
t.Logf("Failed closing the dbus connection: %v", err)
t.Logf("Failed closing the D-Bus connection: %v", err)
}
})

Expand Down

0 comments on commit 1127cf2

Please sign in to comment.