testutils

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ApplicationConfigPath = "/testutils/testdata/sample_config.json"    // AplicationConfigPath points to dummy config file in json format for NucleusConfig
	TaskPayloadPath       = "/testutils/testdata/taskPayload.json"      // TaskPayloadPath points to json file containing dummy TaskPayload
	PayloadPath           = "/testutils/testdata/payload.json"          // PayloadPath points to json file containing dummy PayloadPath
	GitlabCommitDiff      = "/testutils/testdata/gitlabCommitDiff.json" // GitLabCommitDiff points to json file containing dummy GitLabCommitDiff
)

Various constant defined for to obtain dummy data for tests

Variables

This section is empty.

Functions

func GetConfig

func GetConfig() (*config.NucleusConfig, error)

GetConfig returns a dummy NucleusConfig using the json file pointed by ApplicationConfigPath. It returns error if it is unable to ReadFile from the provided location or if it is unable to Unmarshal the file contents

func GetGitDiff

func GetGitDiff() map[string]int

GetGitDiff returns a dummy map[string]int for testing purpose.

func GetGitlabCommitDiff

func GetGitlabCommitDiff() ([]byte, error)

GetGitlabCommitDiff returns a dummy GitlabCommitDiff as slice of byte data. Itreturns error if unable to readfile

func GetLogger

func GetLogger() (lumber.Logger, error)

GetLogger returns a dummy lumber.Logger. It returns error if it is unable establish logger using lumber.NewLogger function

func GetPayload

func GetPayload() (*core.Payload, error)

GetPayload returns a dummy core.Payload using the json file pointed by PayloadPath. It returns error if unable to readfile or if unable to unmarshal file components

func GetTaskPayload

func GetTaskPayload() (*core.TaskPayload, error)

GetTaskPayload returns a dummy core.TaskPayload using the json file pointed by TaskPayloadPath. It returns error if unable to readfile or if unable to unmarshal file components

func LoadFile

func LoadFile(relativePath string) ([]byte, error)

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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