fakedms

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: 15 Imported by: 0

Documentation

Overview

Package fakedms implements a library for setting policies via a locally-hosted Device Management Server.

Index

Constants

View Source
const EnrollmentFakeDMSDir = "/var/enrolling-fdms"

EnrollmentFakeDMSDir is the directory where FakeDMS stores state during enrollment. Used to share state between the enrolled fixture and the fakeDMSEnrolled fixtures. TODO(crbug.com/1187473): Remove

View Source
const LogFile = "fakedms.log"

LogFile is the name of the log file for FakeDMS.

View Source
const PolicyFile = "policy.json"

PolicyFile is the name of the config file for FakeDMS.

View Source
const StateFile = "state.json"

StateFile is the name of the state file for FakeDMS.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeDMS

type FakeDMS struct {
	URL string // fakedms url; needs to be passed to Chrome; set in start()
	// contains filtered or unexported fields
}

A FakeDMS struct contains information about a running policy_testserver instance.

func New

func New(ctx context.Context, outDir string) (*FakeDMS, error)

New creates and starts a fake Domain Management Server to serve policies. outDir is used to write logs and policies, and should either be in a temporary location (and deleted by caller) or in the test's results directory.

func (*FakeDMS) FakeDMS

func (fdms *FakeDMS) FakeDMS() *FakeDMS

FakeDMS retrieves the underlying FakeDMS object.

func (*FakeDMS) Ping

func (fdms *FakeDMS) Ping(ctx context.Context) error

Ping pings the running FakeDMS server and returns an error if all is not well.

func (*FakeDMS) SetPersistentPolicies

func (fdms *FakeDMS) SetPersistentPolicies(persistentPolicies []policy.Policy)

SetPersistentPolicies will ensure that the provided policies are always set.

func (*FakeDMS) SetPersistentPolicyUser

func (fdms *FakeDMS) SetPersistentPolicyUser(persistentPolicyUser *string)

SetPersistentPolicyUser will ensure that the provided PolicyUser is always set.

func (*FakeDMS) SetPersistentPublicAccountPolicies

func (fdms *FakeDMS) SetPersistentPublicAccountPolicies(persistentPublicAccountPolicies map[string][]policy.Policy)

SetPersistentPublicAccountPolicies will ensure that the provided public account policies are always set.

func (*FakeDMS) Stop

func (fdms *FakeDMS) Stop(ctx context.Context)

Stop will stop the FakeDMS and return once the command has exited.

func (*FakeDMS) WritePolicyBlob

func (fdms *FakeDMS) WritePolicyBlob(pb *policy.Blob) error

WritePolicyBlob will write the given PolicyBlob to be read by the FakeDMS.

func (*FakeDMS) WritePolicyBlobRaw

func (fdms *FakeDMS) WritePolicyBlobRaw(pJSON []byte) error

WritePolicyBlobRaw writes the given PolicyBlob JSON string to be read by the FakeDMS. To apply persistent settings, pJSON is unmarshalled and then marshalled as PolicyBlob.

type HasFakeDMS

type HasFakeDMS interface {
	FakeDMS() *FakeDMS
}

HasFakeDMS is an interface for fixture values that contain a FakeDMS instance. It allows retrieval of the underlying FakeDMS object.

Jump to

Keyboard shortcuts

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