smb

package
v0.0.0-...-683b059 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2022 License: BSD-3-Clause Imports: 21 Imported by: 0

Documentation

Overview

Package smb supports the setup and utility functions relating to tests that require a Samba share.

Index

Constants

View Source
const (
	// GuestShareName is the standard share used by most settings.
	GuestShareName = "guestshare"
)

Variables

This section is empty.

Functions

func AddFileShareAction

func AddFileShareAction(ui *uiauto.Context, kb *input.KeyboardEventWriter, rememberPassword bool, shareName, username, password string) uiauto.Action

AddFileShareAction returns a ui.Action that enters all the inputs required for an SMB file share in the corresponding dialog. This assumes the SMB file share dialog is already open.

func UnmountAllSmbMounts

func UnmountAllSmbMounts(ctx context.Context, cr *chrome.Chrome) error

UnmountAllSmbMounts uses the chrome.fileManagerPrivate.removeMount API to unmount all the identified SMB FUSE filesystems. Chrome maintains a mapping of SMB shares so if we unmount via cros-disks it still thinks the volume is mounted with chained tests all failing after the first.

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

Config represents the enter smb.conf file with a [global] section and 1 or more file shares.

func NewConfig

func NewConfig() *Config

NewConfig creates a Config which represents a smb.conf file.

func (*Config) AddFileShare

func (c *Config) AddFileShare(share *Section)

AddFileShare adds a share as a section to the Config object.

func (*Config) SetGlobalParam

func (c *Config) SetGlobalParam(key, value string)

SetGlobalParam sets a key value pair for the [global] section.

func (*Config) String

func (c *Config) String() string

String returns a string representation of the samba config file as per: https://www.samba.org/samba/docs/current/man-html/smb.conf.5.html

type FixtureData

type FixtureData struct {
	Chrome         *chrome.Chrome
	Server         *Server
	GuestSharePath string
}

FixtureData is the struct exposed to tests.

type Section

type Section struct {
	// contains filtered or unexported fields
}

Section represents either the [global] section or a file share. Each section is made up of parameters of the format:

key = value

func CreateBasicShare

func CreateBasicShare(name, path string) *Section

CreateBasicShare creates a file share Section with common parameters shared by all file shares.

func NewFileShare

func NewFileShare(name string) *Section

NewFileShare creates a subsection that starts with [name] and has key value pairs representing information about a file share.

func (*Section) SetParam

func (s *Section) SetParam(key, value string)

SetParam sets a key value pair on a section, these are individual configuration items.

func (*Section) String

func (s *Section) String() string

String returns the string representation of a section, starting with the section name as [name] then each configuration item as key = value.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server is the instance of the smb daemon.

func NewServer

func NewServer(smbConf string) *Server

NewServer sets up a smb daemon using the supplied smb.conf file.

func (*Server) Start

func (s *Server) Start(ctx context.Context) error

Start begins the smb daemon and ensures it's log file is adequately flushed to a file in the event an error occurs. A SIGTERM is not considered worth of a log dump here due to Stop() sending a SIGTERM to gracefully shut down the process.

func (*Server) Stop

func (s *Server) Stop(ctx context.Context) error

Stop tries to gracefully shut down the underlying smb daemon by sending a SIGTERM signal to the process. https://www.samba.org/samba/docs/current/man-html/smbd.8.html

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL